Skip to content

Publish as org.owasp.html-sanitizer:html-sanitizer with relocation and SHA-512 signatures - #540

Draft
jmanico wants to merge 15 commits into
mainfrom
move-to-org-owasp-coordinates
Draft

jmanico wants to merge 15 commits into
mainfrom
move-to-org-owasp-coordinates

Conversation

@jmanico

@jmanico jmanico commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Summary

Implements #531: future releases publish as org.owasp.html-sanitizer:html-sanitizer, signed only with the project release key F6109A4F3F5616E1A7A62099E02DB03BAF6C438C.

Draft until one Maven Central token can publish both namespaces. Every release stages a relocation POM at the old coordinates, and com.googlecode.owasp-java-html-sanitizer is not in the Owasp Central organization. Claiming it there is refused ("Protected domain which requires manual review"); a request to Sonatype support covers it. Until then Central would reject the whole deployment, after the release commit and signed tag are pushed.

Merge just before the first release under the new coordinates. The user-facing docs are part of this change, and they name coordinates that do not exist until that release.

Coordinates

  • Library: org.owasp.html-sanitizer:html-sanitizer, in a project namespace like the other OWASP libraries on Central (org.owasp.encoder, org.owasp.antisamy, org.owasp.json-sanitizer). Central grants publishing rights per namespace, so the repository's token can be limited to this project.
  • Parent: org.owasp.html-sanitizer:html-sanitizer-parent. The shims, examples and empiricism modules take the html-sanitizer- prefix and stay unpublished.
  • New legacy-relocation/ module publishes, with each release, a POM-only com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:<version>. It relocates to the new coordinates, with no dependencies and no pinned target version. Existing releases at the old coordinates are untouched.
  • Unchanged: the org.owasp.html package, the JPMS module owasp.java.html.sanitizer, Java 8 bytecode, and the version scheme. Bundle-SymbolicName is pinned to com.googlecode.owasp-java-html-sanitizer, because bnd would otherwise derive a new name from the coordinates. The packaging verification checks this.
  • The shade exclude names the two shim metadata directories in full, so the library's own pom.properties, which scanners use to identify the JAR, stays in.

Signing

  • JReleaser's built-in signer hard-codes SHA-1. Signing now runs gpg in command mode with --digest-algo SHA512.
  • scripts/with-release-key.sh puts only the pinned release key in a temporary keyring for JReleaser, and does not pass the armored key on to the command it runs.
  • scripts/verify-artifact-signatures.sh rejects digests weaker than SHA-256 and prints gpg's status on failure.

Release safety

  • scripts/check-staged-release.sh runs after the build and before tagging. Staging must hold exactly the library jar, sources, javadoc and POM, the parent POM, and the relocation POM; every other file must be a checksum or signature of one of them. It also checks the relocation target, that the library POM declares only test and provided dependencies, the JAR's own Maven metadata, the absence of shim metadata, and the OSGi name.
  • A failed staging check reverts the release commit, as a build failure does. Both happen before anything is published.
  • Verify release signing has an opt-in central_upload input. With it, scripts/validate-central-bundle.sh uploads the placeholder bundle to the Central Portal as USER_MANAGED, reports Central's validation result and drops the deployment. It makes no publish request. Run it, and get VALIDATED, before the first release. It has been tested against a mock of the Publisher API only, never against Central.

Docs

  • docs/maven.md, the README badge and the javadoc and download links name the new coordinates.
  • docs/maven.md gains a migration section, including how to find and remove a second copy of the library when an older release still arrives under the old coordinates.

Validation (local, Homebrew JDKs)

  • ./mvnw clean verify on JDK 11, 17, 21 and 25: 768 + 7 tests pass on each, including the JPMS and Java 8 consumer checks.

  • The release workflow's version-bump commands, run in a scratch clone, update all seven POMs, change_log.md, SECURITY.md and both version lines in docs/maven.md.

  • A publication build at placeholder version 20991231.0 stages exactly the six expected components, and check-staged-release.sh passes. The staged jar has the same entries as the released 20261110.1 jar apart from the META-INF/maven/ path, and the same manifest apart from version strings.

  • JReleaser deploy in dry-run mode with a throwaway key signs all six files with SHA-512, and the verifier passes.

  • Negative cases fail as intended: a SHA-1 signature, a key that does not match the pinned fingerprint, an extra artifact, a stray checksum or signature file, a missing component, a compile-scope or shim dependency in the library POM, a pinned or redirected relocation.

  • validate-central-bundle.sh against a mock Publisher API: validated, failed, stuck, drop refused, upload refused, namespace refused, already published, and failing status requests.

  • Resolution against the staged repository, with Maven 3.10 and Gradle 8.14:

    Case Result
    new coordinates only one jar
    old coordinates at the relocated version, or a version range resolves to the new jar
    both coordinates at the new version one jar
    old real release (20261110.1), direct or transitive, plus new two jars; the first on the path loads, on the class path and the module path alike
    same, old coordinates managed (Maven) or constrained (Gradle) to the relocated version one jar
    same, old coordinates excluded, or substituted (Gradle) one jar
  • ShellCheck, actionlint and git diff --check pass.

Before the first release

  • Merge main in again. If any release has gone out from main since 20261110.1, update that version where docs/maven.md names it as the last release under the old coordinates.
  • One Central token must be able to publish org.owasp.html-sanitizer and com.googlecode.owasp-java-html-sanitizer, and be in the repository secrets.
  • Dispatch Verify release signing on this branch with central_upload and confirm VALIDATED.
  • Future security advisories need to list both coordinate families, since scanners match on the coordinates a build declares.

Not in this PR

  • Maven 4 and an OSGi container upgrade test.
  • Moving the release secrets into a protected environment.

🤖 Generated with Claude Code

jmanico and others added 11 commits November 7, 2026 19:40
…signatures

Move the reactor to org.owasp coordinates (issue #531): the library is
org.owasp:java-html-sanitizer, its parent java-html-sanitizer-parent,
and the unpublished modules get the same prefix.  A new
legacy-relocation module publishes, with each release, a POM-only
relocation at com.googlecode.owasp-java-html-sanitizer:
owasp-java-html-sanitizer that points to the same version under the new
coordinates.  Java packages, the JPMS module name and, now pinned, the
OSGi bundle symbolic name are unchanged.  The shade exclude names the
shim metadata directories in full, since java*/** under org.owasp would
also strip the library's own pom.properties.

JReleaser's built-in signer hashes with SHA-1, so sign with gpg in
command mode with SHA-512 instead.  scripts/with-release-key.sh puts the
pinned release key alone in a temporary keyring for it.  The release and
the no-publish check now verify the staging repository holds exactly the
expected components before anything is tagged or uploaded, and the
signature check rejects digests weaker than SHA-256.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in release 20261110.1.  The only conflict was change_log.md: the
Next release section of this branch now sits above Release 20261110.1.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The staging check looked for a version only as the first child of the
relocation element, and it also requires groupId and artifactId to come
first, so a version written after them passed.  A pinned version would
send every later release at the old coordinates to one fixed release.
Look anywhere inside the element.  See issue #531.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A release now deploys two namespaces in one bundle, and nothing in the
repository can show whether the publishing token may deploy both.  If
it may not, the release fails after the release commit and the signed
tag are pushed, which the workflow does not undo.

The Verify release signing workflow gets an opt-in central_upload
input.  With it, the bundle JReleaser built at the placeholder version
is uploaded to the Central Portal as USER_MANAGED, which Central holds
until a separate publish request that the script never makes.  The
script reports Central's validation result and errors, then drops the
deployment.  See issue #531.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The library becomes org.owasp.html-sanitizer:html-sanitizer rather
than org.owasp:java-html-sanitizer.  A namespace of its own matches
the other OWASP libraries on Maven Central (org.owasp.encoder,
org.owasp.antisamy, org.owasp.json-sanitizer), and Central grants
publishing rights per namespace, so the token this repository holds
can be limited to this project instead of covering all of org.owasp.
"java" is dropped from both names as redundant on Maven Central.

The parent and the unpublished modules take the html-sanitizer-
prefix.  The relocation module, the staging check, the packaging
checks and the Java 8 consumer job follow.  The Java package, the JPMS
module name and the OSGi symbolic name are unchanged.  See issue #531.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
When Central refused a request, the script exited with curl's status
alone and discarded the response body, the one thing that says why.
The body now goes to the log.

A failed status request ended the run at once and left a deployment
that might still validate; three in a row are needed now.  When the
deployment validated but could not be dropped the run was green; it
now fails, since a validated placeholder left in the Portal has a
Publish button.  The upload is named validation-only-DO-NOT-PUBLISH.

Before uploading, the script asks Central whether each POM in the
bundle is already published, as JReleaser does before a release, so
the check exercises that request for both namespaces too.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Checksum and signature files were skipped wherever they were, so a
stray one, such as org/owasp/stray.sha512, passed the check and would
have been uploaded: JReleaser leaves only the repository metadata out
of the bundle.  Each such file now counts as the file it belongs to,
which must be an expected component, and each expected component must
itself be present.

The check also reads the staged library POM.  The library has no
runtime dependencies and the shims are unpublished, so a dependency
there that is neither test nor provided scope fails the release.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The file's own header says a new module needs a line under
directories, and legacy-relocation had none.  The ignore rule for the
new coordinates now covers the whole project namespace, as the rule
for the old one does.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
with-release-key.sh ran its command with GPG_SECRET_KEY and
GPG_PUBLIC_KEY still exported, so the armored secret key reached
Maven, every plugin and JReleaser, none of which need it once it is
in the temporary keyring.  They are unset before the command runs.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The release workflow rewrites the version in docs/maven.md in place.
With the docs left for a later change, a release cut in between, such
as an urgent security fix, would have told users to depend on the old
coordinates at a version that is only a relocation POM, and the
relocation message would have sent them to a guide that did not yet
mention the move.

The Maven guide, the README badge and the javadoc and download links
now name org.owasp.html-sanitizer:html-sanitizer, and docs/maven.md
gains a migration section: what changed and what did not, where the
old coordinates may be named, what the relocation POM does, and how
to find and remove a second copy of the library when an older release
still arrives under the old coordinates.  The Maven and Gradle fixes
it lists were each resolved against a staged repository.  The change
log entry says the same in brief.

This pull request should therefore be merged just before the first
release under the new coordinates: until then they, and the javadoc.io
pages for them, do not exist.  See issue #531.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@jmanico jmanico changed the title Publish as org.owasp:java-html-sanitizer with relocation and SHA-512 signatures Publish as org.owasp.html-sanitizer:html-sanitizer with relocation and SHA-512 signatures Nov 24, 2026
@jmanico

jmanico commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Update: new coordinates, main merged in, review taken

Coordinates. The target is now org.owasp.html-sanitizer:html-sanitizer rather than org.owasp:java-html-sanitizer (commit 55eaecf). The relocation POM at the old coordinates stays.

Main. Merged in (9e780ff); the only conflict was change_log.md.

Review. An independent Opus 5.5 review of ced9c86 found the build, the artifacts and the signing correct, and no blocker in the code. Its findings and what was done:

Finding Commit Change
One bundle spans two namespaces and nothing proves Central accepts it with our token (blocker, outside the repo) ced9c86, 9201a90 Opt-in central_upload on Verify release signing: Central validates the placeholder bundle, then it is dropped. Also asks /published for each POM, as JReleaser does. Still needs a token that covers both namespaces.
The release workflow would bump docs/maven.md while it still names the old coordinates (blocker for the first release) 3290f42 The docs and a migration guide are now part of this PR, which should merge just before the first release.
validate-central-bundle.sh hid Central's error body, gave up on one failed status call, and was green when the drop failed 9201a90 Body is logged, three failed status calls in a row are needed, a failed drop fails the run, the upload is named validation-only-DO-NOT-PUBLISH.
/legacy-relocation missing from dependabot.yml 9b518c6 Added; the ignore rule covers the project namespace.
Consumer advice did not cover an old release arriving transitively 3290f42 Change log and docs/maven.md say to manage or exclude the old coordinates, with tested Maven and Gradle snippets.
with-release-key.sh passed the armored key on to Maven and JReleaser 29b0b2b Unset before the command runs; signing re-tested.
check-staged-release.sh accepted a stray checksum or signature file f035f6a Every staged file must belong to an expected component, and each component must be present. The library POM must declare only test and provided dependencies.
Staging check missed a pinned relocation version after artifactId (found before the review) 51b175f Looks anywhere in the relocation element.
Shim POM comments named the old jar 6578f69 Reworded.

Left for the maintainers to decide:

  • Split the signing change out? The review suggests shipping the SHA-512 signing on one release at the old coordinates first, so the first release under the new ones does not exercise three new things at once.
  • Protected environment for the release secrets. All secrets are repository-wide today; a release environment limited to main with required reviewers would cover both workflows.
  • Advisories. Future advisories need to list both coordinate families.

Verification on the final head 3290f42: clean verify passes on JDK 11 locally and on the CI matrix; the release pre-flight at a placeholder version stages exactly the six components and passes the staging check; the signing dry-run signs all six with SHA-512; Maven 3.10 and Gradle 8.14 resolve as the description's table says.

🤖 Generated with Claude Code

jmanico and others added 4 commits November 24, 2026 13:27
The script runs with pipefail, so when the library POM held no
dependency, or none in test or provided scope, the grep that counts
them matched nothing, failed the pipeline, and ended the script with
status 1 and no message.  The release was stopped, correctly, but the
log did not say by what.  The counts now tolerate zero matches and the
check reports them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The check read only the first dependencies element outside build.
The dependency-reduced POM writes profiles before dependencies, so a
profile holding only test dependencies was the block that got read,
and a compile-scope dependency in the main block after it passed.
The reviewer got this through a real publication build.

Every dependency outside build is counted now, and a POM with
profiles or dependency management of its own is refused, since the
count would misread it; the library POM has neither.

The file listing also takes symbolic links, which JReleaser follows
into the bundle and find -type f skipped.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A bundle that could not be read, or held no POM, skipped the
published check in silence and went on to upload; it now stops.
A reply of {"published":"false"}, a string, passed as unpublished;
the value must be the boolean.  When the upload request failed or
returned no identifier, nothing said that Central might still hold a
deployment; a warning now does.  A status reply that was not JSON
ended the run on jq's parse error; it now counts as a failed request
and the reply is logged if three come in a row.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
After a correct fix Gradle's dependencyInsight still lists the old
coordinates, at the relocated version, so "if the old coordinates
show up" sent readers looking for a problem they no longer had.  The
guide now says to act on 20261110.1 or earlier.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@jmanico

jmanico commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Second review, of the fixes

Because the fix series changed behaviour (a second rename, a rewritten Central script, a tighter release gate, the docs), a second independent Opus 5.5 review covered ced9c86..1b4b7d5. Verdict: merge after fixes, no blocker in the code. It confirmed by its own builds that the staged jar is identical to the released 20261110.1 jar apart from the META-INF/maven/ path and version strings, that the rename is consistent everywhere, and that the Central script cannot publish or leak the token.

Finding Commit Change
The staging check read only the first dependencies block, so a profile with test dependencies hid a compile-scope dependency after it; reproduced through a real publication build (should-fix) 89a68e2 Every dependency outside build is counted; a library POM with profiles or dependency management is refused. Symbolic links are listed too.
The staging check could stop with status 1 and no message when a count was zero (found while preparing the review) 1b4b7d5 The counts tolerate zero matches and the reason is printed.
validate-central-bundle.sh: unreadable bundle skipped the published check; "false" as a string passed; no warning when the upload outcome was unknown; a non-JSON status reply ended the run on a parse error (nits) dd23127 Each closed; thirteen mock cases pass.
docs/maven.md told Gradle users to act whenever the old coordinates show up, which they still do after a correct fix (nit) b075594 Says to act on 20261110.1 or earlier.
Docs name coordinates that do not exist until the first release — By design: merge just before that release, as the description says.

Each new failing case was run against the previous commit as well, where it passed the gate or failed silently, and against the fix, where it is reported.

Not run anywhere yet: the scripts on Linux. They were exercised under bash 3.2 with BSD tools only; a Verify release signing run on this branch with central_upload unticked would exercise them on the release runner without touching Central.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant