Skip to content

[improve][build] Fix publishing of public libraries with correct POM and Gradle module metadata - #26020

Merged
merlimat merged 12 commits into
apache:masterfrom
lhotari:lh-improve-published-dependencies
Jun 13, 2026
Merged

merlimat merged 12 commits into
apache:masterfrom
lhotari:lh-improve-published-dependencies

Conversation

@lhotari

@lhotari lhotari commented Jun 13, 2026 •

Copy link
Copy Markdown
Member

Motivation

Pulsar's public client/admin libraries (including the new v5 client) must publish to a Maven
repository with correct POM and Gradle Module Metadata so that both Maven and Gradle consumers
resolve them properly. The Gradle-based publishing (PIP-463) had several metadata problems:

  • The public v5 client libraries (pulsar-client-api-v5, pulsar-client-v5) were not being
    published at all.
  • Many dependencies were mis-scoped implementation where they should be api, producing the
    wrong Maven scope (runtime instead of compile) and incorrect Gradle Module Metadata variants —
    so Gradle consumers couldn't compile against types that are part of a module's public API.
  • Every dependency in every published POM carried two blanket <exclusion> entries
    (log4j-slf4j-impl, bc-fips), produced by a build-wide configurations.all { exclude(...) }.
  • The internal enforced version-alignment platform (pulsar-dependencies) leaked into published
    Gradle Module Metadata
    as an enforced-platform dependency on every library's runtimeElements,
    forcing Pulsar's internal dependency versions onto downstream Gradle consumers and removing their
    ability to override — and the resulting publication-validation error was being suppressed rather
    than fixed.
  • The shaded client jars (pulsar-client, pulsar-client-admin, pulsar-client-all) declared
    the bundled (relocated) modules as runtime dependencies in their published metadata, so consumers
    pulled the entire un-shaded tree alongside the relocated copies, defeating the purpose of shading.

This PR makes publishing produce correct metadata end to end. It supersedes #26018 (the initial
v5-publishing fix), whose commit is included here, so #26018 can be closed in favor of this PR.

Modifications

  • (from [fix][build] Fix publishing public v5 client libraries to Maven repository #26018) Publish the public v5 client libraries. pulsar-client-api-v5 and
    pulsar-client-v5 now use pulsar.public-java-library-conventions. A MavenPublishLock shared
    build service serializes uploads (Nexus creates an implicit staging repo on first upload and
    dislikes concurrent uploads). A CI step runs publishAllPublicationsToLocalDeployRepository to
    catch publishing regressions.
  • Correct api vs implementation scopes across 34 modules (153 ABI-driven
    implementation→api promotions), so published POM scopes (compile/runtime) and Gradle module
    metadata variants accurately reflect each module's public API. No dependency versions change.
  • Remove the blanket POM exclusions. Dropped the build-wide configurations.all { exclude(...) }
    for log4j-slf4j-impl and bc-fips (and the modulesUsingBcFips allowlist); both only arrive
    transitively via bookkeeper-server, which already has a component-metadata rule that strips them.
  • Fix a bc-fips test-classpath leak. pulsar-common/pulsar-broker-common carried a vestigial
    testImplementation(bc-fips) that re-exported FIPS BouncyCastle through their testJar onto
    downstream test classpaths already carrying non-FIPS bcprov, causing
    CryptoServicesRegistrar signer-mismatch failures. They now use the non-FIPS bcprov (the
    provider used in production); FIPS stays isolated in the dedicated FIPS test module.
  • Keep the enforced platform out of published metadata. enforcedPlatform(:pulsar-dependencies)
    is now declared on a non-published internalPlatform bucket that only the resolvable build
    classpaths extend, so it aligns the build (and feeds versionMapping) without leaking into
    published apiElements/runtimeElements. The suppressedValidationErrors("enforced-platform")
    workaround is removed, so the validation now actively guards against regression. pulsar-dependencies
    remains published as a platform so other Pulsar projects (e.g. pulsar-connectors) can depend on it
    to align versions.
  • Align distribution versions. The server/shell distLib configurations extend internalPlatform
    so bundled dependency versions match the version catalog (verified by checkBinaryLicense).
  • Publish dependency-reduced POMs for the shaded client jars. pulsar-client,
    pulsar-client-admin, and pulsar-client-all now publish the com.gradleup.shadow shadow
    component, whose declared dependencies are exactly the non-bundled runtime libraries (the API
    modules, protobuf, jackson-annotations, bcprov/bcpkix, opentelemetry, jspecify, and slf4j/slog —
    logging is slf4j+slog only, no log4j) instead of the bundled/relocated modules. This restores the
    Maven createDependencyReducedPom behaviour that was lost in the Gradle migration: consumers no
    longer pull the un-shaded dependency tree.
  • Remove the BouncyCastle wrapper modules. bouncy-castle:bouncy-castle-bc and
    bouncy-castle:bcfips were thin wrappers that only bundled the upstream BouncyCastle jars (plus a
    NAR-era JCA provider loader). The dead NAR loader is removed; MessageCryptoBc no longer registers
    a provider globally — it holds a lazily-initialized BouncyCastleProvider instance (initialization-
    on-demand holder) and passes it explicitly to the JCA APIs, so the client never mutates the
    JVM-global provider list — and the now-empty wrapper modules are deleted. Consumers (pulsar-client,
    both distributions, the shade tests) depend on org.bouncycastle:bcprov-jdk18on + bcpkix-jdk18on
    directly. The FIPS TLS integration test moves to tests/pulsar-client-test-bcfips and selects the
    FIPS provider by excluding the non-FIPS *-jdk18on jars.

Verifying this change

This change is covered by build verification (it is a build/packaging change):

  • publishAllPublicationsToLocalDeployRepository succeeds with the enforced-platform validation
    un-suppressed; across all published modules there are 0 blanket exclusions, 0
    enforced-platform entries and 0 pulsar-dependencies references, POM versions are concrete,
    and the v5 client libraries are published.
  • A Gradle consumer resolves the published pulsar-client-original from a local repo with
    pulsar-dependencies absent from the graph and can override a version the enforced platform
    previously forced (strict commons-lang3:3.12.0 wins over Pulsar's 3.20.0).
  • A consumer of the shaded pulsar-client resolves only the non-bundled runtime dependencies (≈15
    components) instead of the full un-shaded tree (≈85), with no relocated artifacts leaking and no
    log4j.
  • assemble, rat, spotlessCheck, checkstyle, both distributions' checkBinaryLicense, the
    FIPS TlsProducerConsumerTest, and the affected unit/integration tests pass in CI.
  • A new CI step publishes all public libraries to a local Maven repository to catch future
    publishing-metadata regressions.

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies — the api/implementation scope corrections change the scopes in published
    POMs and the variants in Gradle Module Metadata, the shaded jars now publish dependency-reduced
    POMs, and the blanket <exclusion> entries are removed. No dependency versions change;
    distribution contents are verified unchanged by checkBinaryLicense.
  • Anything that affects deployment — changes how the public client/admin libraries (and the
    new v5 client) are published to Maven repositories.

Warning

Breaking change for downstream consumers (Pulsar 5.0). The published artifacts
org.apache.pulsar:bouncy-castle-bc and org.apache.pulsar:bouncy-castle-bcfips — including the
pkg classifier — are removed. They were internal convenience wrappers that only re-exposed the
upstream BouncyCastle jars and carried no Pulsar classes or public API. Downstream projects that
depended on them directly should instead depend on the upstream coordinates:
org.bouncycastle:bcprov-jdk18on + org.bouncycastle:bcpkix-jdk18on (or, for FIPS,
org.bouncycastle:bc-fips / bcpkix-fips / bcutil-fips) — which is exactly what the Pulsar
client now does.

Documentation

  • doc-not-needed

(Build/packaging change with no user-facing documentation impact. The removed
org.apache.pulsar:bouncy-castle-bc / bouncy-castle-bcfips artifacts are an internal packaging
detail; the breaking-change note above is for downstream build authors.)

lhotari added 2 commits June 13, 2026 06:57
…itory

The pulsar-client-api-v5 and pulsar-client-v5 modules used
pulsar.java-conventions, which does not configure Maven publishing. Because
the published :pulsar-client-tools module depends on them, the publish
validation in pulsar.public-java-library-conventions failed:

  Published module ':pulsar-client-tools' depends on unpublished projects:
    - implementation -> :pulsar-client-api-v5 (not published)
    - implementation -> :pulsar-client-v5 (not published)

Switch both v5 modules to pulsar.public-java-library-conventions so they are
published. Add a mavenPublishLock shared build service that serializes
PublishToMavenRepository uploads (maxParallelUsages = 1) so release uploads
land in a single Nexus staging repository without requiring --no-parallel.
Add a CI step running publishAllPublicationsToLocalDeployRepository to catch
publishing regressions.

Assisted-by: Claude Code (claude-opus-4-8)
…p blanket POM exclusions

Two related fixes to the dependency metadata of published modules.

1. api vs implementation classification

   Many modules declared dependencies as `implementation` even though their
   types appear in the module's public API (ABI). Gradle maps `implementation`
   to `runtime` scope in the published POM (and the runtime-only variant in
   Gradle Module Metadata), so consumers could not compile against types the API
   exposes. Promote those dependencies to `api` (153 declarations across 34
   modules) so they are published with compile scope and the api variant, while
   genuinely internal dependencies stay `implementation`. The classification was
   produced with ABI analysis (the dependency-analysis Gradle plugin's
   buildHealth) rather than by hand.

   For example, pulsar-client-original now publishes pulsar-common,
   opentelemetry-api, guava, async-http-client, slog, avro and jspecify with
   compile scope (they surface through the client API), while netty, gson,
   datasketches, RoaringBitmap, etc. remain runtime.

2. Remove blanket dependency exclusions from published POMs

   pulsar.java-conventions used `configurations.all { exclude(...) }` to drop
   log4j-slf4j-impl and bc-fips. Per-configuration excludes are emitted onto
   every dependency of every published POM, producing two <exclusion> entries on
   every dependency. Both unwanted artifacts only arrive transitively through
   bookkeeper-server, which already has a component-metadata rule stripping its
   BouncyCastle. Extend that rule to also drop log4j-slf4j-impl and remove the
   two global excludes plus the module-name-based `modulesUsingBcFips` allowlist.
   The FIPS modules declare bc-fips directly, so they are unaffected.

Verified: compileJava/compileTestJava, spotlessCheck, checkstyleMain/Test and
publishAllPublicationsToLocalDeployRepository all pass; published POMs no longer
contain the log4j-slf4j-impl/bc-fips exclusions and carry correct dependency
scopes.

Assisted-by: Claude Code (claude-opus-4-8)
…n tests

pulsar-common and pulsar-broker-common declared testImplementation(libs.bc.fips),
but no test in either module exercises FIPS (FIPS is covered by the dedicated
bouncy-castle/bcfips-include-test module). Their testJar configurations extend
testImplementation, so bc-fips was re-exported to every downstream module
consuming those testJars (pulsar-proxy, pulsar-client-tools-test,
tests:integration, ...), which also carry the non-FIPS bcprov-jdk18on.

Both jars define org.bouncycastle.* with different signers, so the JVM threw
"class org.bouncycastle.crypto.CryptoServicesRegistrar's signer information does
not match signer information of other classes in the same package" when
SecurityUtility loaded the non-FIPS BouncyCastleProvider in its static
initializer, failing the Proxy, Messaging, Kubernetes and client-tools jobs.

The blanket exclusion removed in the previous commit had been masking this leak.
Replace bc-fips with the non-FIPS bcprov-jdk18on (the provider SecurityUtility
prefers in production), so FIPS and non-FIPS BouncyCastle never share a classpath,
without reintroducing the per-POM <exclusion> pollution.

Verified locally: DefaultPulsarSslFactoryTest, SslContextTest,
JettySslContextFactoryTest, ProxyAuthenticatedProducerConsumerTest and the FIPS
TlsProducerConsumerTest all pass; dependencyInsight confirms bc-fips is off every
non-FIPS test classpath and bcfips-include-test stays FIPS-only.

Assisted-by: Claude Code (claude-opus-4-8)
@lhotari
lhotari marked this pull request as draft June 13, 2026 12:03
…ished module metadata

Every published Gradle Module Metadata (.module) recorded
org.apache.pulsar:pulsar-dependencies as an org.gradle.category=enforced-platform
dependency in its runtimeElements variant, because the platform was declared on the
`implementation` bucket (which the consumable runtimeElements variant extends). An
enforced platform in published metadata forces Pulsar's internal dependency versions
onto every downstream Gradle consumer and removes their ability to override them
(Gradle's platforms docs warn against using enforcedPlatform on a component intended
for consumption). The build was hiding the resulting GenerateModuleMetadata validation
error with suppressedValidationErrors("enforced-platform") instead of fixing it.

Declare the enforced platform on a new non-consumable, non-resolvable `internalPlatform`
bucket that only the resolvable build classpaths (compile/runtime/test classpaths and
the annotation-processor paths) extend. The platform still aligns the build's own
resolution and feeds versionMapping for POM versions, but it no longer reaches the
published apiElements/runtimeElements variants. The validation suppression is removed so
the check now guards against the leak regressing.

The async-http-client / jakarta.activation component-metadata rule re-added
jakarta.activation-api and angus-activation without versions, relying on the ambient
platform; give them explicit catalog versions so configurations that do not extend the
platform (e.g. the protobuf plugin's *ProtoPath) still resolve.

pulsar-dependencies itself remains published as a platform/BOM so other Pulsar projects
(e.g. pulsar-connectors) can depend on it to align versions; only the unconditional
forcing through every library's published metadata is removed.

Verified: publishAllPublicationsToLocalDeployRepository succeeds with the validation
un-suppressed; across all published modules there are 0 enforced-platform entries, 0
pulsar-dependencies references and 0 versionless deps, and POM versions stay concrete; a
Gradle consumer resolves pulsar-client-original with pulsar-dependencies absent from the
graph and a consumer-declared strict commons-lang3 3.12.0 overrides Pulsar's 3.20.0.

Assisted-by: Claude Code (claude-opus-4-8)
@lhotari
lhotari marked this pull request as ready for review June 13, 2026 13:05
lhotari added 2 commits June 13, 2026 16:39
…platform off implementation

The preceding commit moved the enforced version-alignment platform from the
`implementation` bucket to the non-published `internalPlatform` bucket. The server and
shell distributions collect their bundled jars through a custom `distLib` configuration
that extendsFrom `implementation`, so it stopped inheriting the platform and its
transitive versions drifted (e.g. netty-codec-http2 4.2.15 -> 4.2.13, grpc 1.79 -> 1.75,
snakeyaml 2.0 -> 2.6), which checkBinaryLicense correctly rejected in CI.

Have both distributions' `distLib` extend `internalPlatform` so the enforced platform
aligns the bundled versions with the version catalog again. Also clarify the
convention-plugin comment: the alignment platform is wired onto the standard resolvable
classpaths by name, and custom artifact-collecting configurations (like distLib) must
extend internalPlatform explicitly because flag-based matching is unreliable for
configurations created via `configurations.creating {}` (their canBeResolved/canBeConsumed
flags are set inside the creation block, after a flag-based configureEach has run).

Verified: checkBinaryLicense passes for both distributions (forced rerun);
publishAllPublicationsToLocalDeployRepository still succeeds with the enforced-platform
validation un-suppressed (0 enforced-platform and 0 pulsar-dependencies references across
published module metadata); assemble/rat/spotlessCheck/checkstyle pass; and the consumer
override test still resolves with pulsar-dependencies absent and a strict commons-lang3
3.12.0 winning over Pulsar's 3.20.0.

Assisted-by: Claude Code (claude-opus-4-8)
…agecrypto-bc

pulsar-client-messagecrypto-bc declared implementation(project(":bouncy-castle:bouncy-castle-bc"))
alongside its direct bcpkix (implementation) and bcprov (api) dependencies. MessageCryptoBc compiles
against bcpkix/bcprov types directly, and the bc module only re-exposes those same jars as
`implementation` plus an unused BouncyCastleLoader (legacy NAR-era code, never instantiated —
SecurityUtility loads the provider via Class.forName). The bc-module dependency was therefore
redundant; removing it changes nothing at runtime (bcprov/bcpkix remain via the direct declarations)
and the bc module is still bundled in the distributions via their direct distLib dependency.

While checking the FIPS test, fix a stale exclusion in bouncy-castle/bcfips-include-test: it excluded
the non-FIPS module as `module = "bc"`, but the module's artifactId is "bouncy-castle-bc", so the
exclusion silently stopped matching after the rename. FIPS isolation still held (the non-FIPS
bcprov/bcpkix libraries are excluded by name), but the exclusion now correctly targets the module.

Verified: bcfips-include-test (FIPS TlsProducerConsumerTest) and messagecrypto-bc tests pass; both
distributions' checkBinaryLicense pass; publishAllPublicationsToLocalDeployRepository is clean and
messagecrypto-bc's published metadata no longer references bouncy-castle-bc while still exposing
bcprov (compile) and bcpkix (runtime).

Assisted-by: Claude Code (claude-opus-4-8)
@lhotari lhotari changed the title [improve][build] Correct api/implementation dependency scopes and drop blanket POM exclusions [improve][build] Fix publishing of public libraries with correct POM and Gradle module metadata Jun 13, 2026

@void-ptr974 void-ptr974 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Excellent work on a fairly tricky Gradle publishing cleanup.

This does a great job addressing several subtle metadata issues at once: publishing the v5 client artifacts, fixing ABI-relevant scopes, removing blanket POM exclusions, and keeping the internal enforced platform out of published Gradle Module Metadata. The local publish check in CI is a particularly good addition and should make this area much easier to keep correct going forward.

lhotari added 5 commits June 13, 2026 19:27
The shaded client artifacts (pulsar-client-shaded, pulsar-client-admin-shaded,
pulsar-client-all) bundle and relocate their third-party dependencies (netty, guava,
jackson, bookkeeper, ...) under org.apache.pulsar.shade.*, but their published
POM/Gradle Module Metadata declared the bundled component modules (pulsar-client-original,
pulsar-client-admin-original, pulsar-common, pulsar-client-messagecrypto-bc) as runtime
dependencies. Consumers therefore pulled the entire UNSHADED dependency tree (85
components: all of netty, guava, jackson-core, bookkeeper, async-http-client, ...)
alongside the relocated copies inside the jar -- defeating the shading and forcing
Pulsar's dependency versions onto consumers. The Maven build produced a
dependency-reduced POM (createDependencyReducedPom); the Gradle migration (PIP-463) lost it.

Publish the com.gradleup.shadow plugin's `shadow` component for the shaded modules
instead of the `java` component. The `shadow` component carries the shadow jar plus
EXACTLY the dependencies declared in the `shadow` configuration, mapped to Maven runtime
scope -- the Gradle-native dependency-reduced POM. Each shaded module now declares its
bundled component modules as `implementation` (so shadowJar packs them) and the
non-bundled runtime dependencies via the `shadow` configuration: pulsar-client-api
(+admin-api), protobuf-java, jackson-annotations, bcprov/bcpkix (signed, not relocatable),
opentelemetry-api(+incubator), jspecify, and -- for logging -- slf4j-api + slog ONLY
(never log4j).

publish-conventions branches on the shadow plugin: shaded modules publish
components["shadow"] (wired after the shadow plugin's own afterEvaluate, no
versionMapping); all other java-library modules keep publishing components["java"] with
resolved version mapping, unchanged. public-java-library-conventions adds `shadow` to the
published-scope validation.

Verified: a Gradle consumer resolving pulsar-client-shaded now sees 15 runtime/compile
components (was 85) with NO unshaded io.netty/guava/jackson-core/bookkeeper/
async-http-client, NO log4j, and pulsar-client-api present on both classpaths; the
shade-test modules still compile; both distributions' checkBinaryLicense pass;
publishAllPublicationsToLocalDeployRepository succeeds with the enforced-platform
validation un-suppressed.

Assisted-by: Claude Code (claude-opus-4-8)
…g the JCA provider globally

The bc/bcfips modules carried a NAR-era loader (BouncyCastleLoader, BouncyCastleFipsLoader, the
BCLoader interface, and the META-INF/services/bouncy-castle.yaml descriptors) that was a workaround
for loading the BouncyCastle provider inside Pulsar IO connector NARs. Nothing instantiates these
loaders or reads the descriptors any more (no ServiceLoader, no reflection); Pulsar IO connectors
are moving to a separate repository and can re-add such a mechanism there if ever needed. Removed
the loader classes, package-info files and yaml descriptors, and dropped the now-unused slog /
pulsar-common dependencies from the bc/bcfips build files (the modules now carry no classes; they
only bundle the BouncyCastle provider jars onto the runtime classpath).

Message crypto no longer registers the BouncyCastle provider in the global JCA provider list.
MessageCryptoBc previously called Security.addProvider(new BouncyCastleProvider()) and referenced
the provider by name ("BC") in Cipher/KeyFactory.getInstance(...). It now holds a single
BouncyCastleProvider instance and passes it directly to getInstance(...) and to
JcaPEMKeyConverter.setProvider(...), so it never mutates the JVM-wide provider list -- client
applications are free to manage their own JCA providers. AES-GCM still prefers the JDK's SunJCE
provider (registered by the JDK) and falls back to the BouncyCastle instance. The redundant global
registrations in the pulsar-functions ProducerBuilderFactory and PulsarSource -- which existed only
so message crypto could find "BC" by name -- are removed too.

bcprov/bcpkix remain required: ECIES (no JDK equivalent), RSA-OAEP key wrapping and EC key handling
are implemented against BouncyCastle. SecurityUtility's reflective, FIPS-agnostic
getProvider()/getBCProviderFromClassPath() is kept -- it loads whichever provider
(BouncyCastleProvider or the differently-named BouncyCastleFipsProvider) is on the classpath for
TLS, without pulsar-common having to compile against either.

Verified: testECDSAEncryption (ECIES), testRSAEncryption (RSA-OAEP) and
testE2EEncryptionWithCompression pass; the FIPS TlsProducerConsumerTest passes; checkstyle/spotless
pass for the changed code; publishAllPublicationsToLocalDeployRepository and both distributions'
checkBinaryLicense pass.

Assisted-by: Claude Code (claude-opus-4-8)
…age crypto

Follow-up to the previous commit: defer creating the BouncyCastle provider until it is actually
needed, and make AES-GCM provider selection robust on non-HotSpot JVMs.

- The BouncyCastle provider is now created via the initialization-on-demand holder idiom
  (BcProviderHolder), so message crypto that only performs AES-GCM through a JDK provider never
  instantiates it, and any failure to construct it surfaces at use time rather than at class load.
- AES-GCM cipher creation no longer fixes a SunJCE-vs-BouncyCastle choice at class initialization.
  It prefers the SunJCE provider instance when present (HotSpot), falls back to the platform default
  provider (e.g. IBMJCE on IBM JDKs where SunJCE is absent), and only then to BouncyCastle. The
  provider is resolved lazily per thread, so a missing or unusual provider cannot break class loading.

Verified: testECDSAEncryption, testRSAEncryption and testE2EEncryptionWithCompression pass;
checkstyle and spotless pass.

Assisted-by: Claude Code (claude-opus-4-8)
… BC libraries directly

### Motivation

The `bouncy-castle/bc` and `bouncy-castle/bcfips` modules were thin wrappers whose only
purpose was to (a) put the BouncyCastle provider jars on the runtime classpath and (b) host
the NAR loader classes. After the loader was removed, both modules carried no classes of their
own — they were empty published artifacts that only added indirection plus an extra `-pkg`
artifact to the distributions.

### Modifications

- Delete the empty `bouncy-castle:bouncy-castle-bc` and `bouncy-castle:bcfips` modules.
- Consumers (`pulsar-client`, both distributions, and the `pulsar-client-all` shade test) now
  depend on `bcprov-jdk18on` + `bcpkix-jdk18on` directly via the version catalog.
- Drop the `-pkg` classifier rename logic from the server/shell distribution scripts and the
  `bouncy-castle-bc` entries from `CheckBinaryLicenseTask` and the NAR platform-module set. The
  BC jars are already listed in both distribution LICENSE files under their Maven artifact
  names, so `checkBinaryLicense` stays green.
- Remove the two wrapper modules from `pulsar-bom`.
- Relocate the FIPS TLS integration test from `bouncy-castle/bcfips-include-test` to
  `tests/pulsar-client-test-bcfips`, depending on the FIPS BC libraries (`bc-fips`,
  `bcpkix-fips`, `bcutil-fips`) directly. FIPS is selected by excluding the non-FIPS
  `*-jdk18on` jars so the two signed providers never share a classpath.

### Verifications

- `publishAllPublicationsToLocalDeployRepository` clean; `pulsar-client-original` GMM/POM now
  reference `org.bouncycastle:bcprov-jdk18on`/`bcpkix-jdk18on` directly (no `bouncy-castle-bc`).
- Both distributions' `checkBinaryLicense` report `Result: OK`.
- The relocated FIPS test (`TlsProducerConsumerTest`) passes (3/3) with only the FIPS provider
  on the classpath.

Assisted-by: Claude Code (claude-opus-4-8)
…stle-bc module

The bouncy-castle-bc wrapper module was removed in the previous commit; update the
pulsar-client-messagecrypto-bc dependency comment so it no longer names a module that
no longer exists, leaving a self-contained rationale for the direct BC dependencies.

Assisted-by: Claude Code (claude-opus-4-8)
@lhotari lhotari added this to the 5.0.0-M1 milestone Jun 13, 2026
@lhotari
lhotari marked this pull request as draft June 13, 2026 21:46
… via SecurityUtility

### Motivation

`MessageCryptoBc` hardcoded the non-FIPS `BouncyCastleProvider`, so it resolved the JCA
provider differently from the rest of Pulsar (TLS) and could not work on a FIPS-only
classpath. Message crypto should resolve the provider the same FIPS-agnostic way.

Separately, `pulsar-common` was declared `compileOnly` in `pulsar-client-messagecrypto-bc`
even though `MessageCryptoBc` uses its types at runtime (`MessageMetadata`, and now
`SecurityUtility`), so the published POM omitted it and a standalone consumer would hit
`NoClassDefFoundError`.

### Modifications

- `MessageCryptoBc` now resolves the JCA provider via `SecurityUtility.getProvider()` — the
  same FIPS-agnostic lookup used for TLS (non-FIPS "BC" or FIPS "BCFIPS", whichever is on
  the classpath) — instead of `new BouncyCastleProvider()`. Resolution stays lazy via the
  initialization-on-demand holder. Non-FIPS behavior is unchanged (the lookup returns a
  `BouncyCastleProvider`); a FIPS classpath now uses `BCFIPS` rather than failing to load
  the hardcoded class.
- Change `pulsar-common` from `compileOnly` to `implementation` in
  `pulsar-client-messagecrypto-bc` so its published POM correctly declares the runtime
  dependency.

### Verifications

- `SimpleProducerConsumerTest.testECDSAEncryption`/`testRSAEncryption` and `V5EncryptionTest`
  pass with the `SecurityUtility`-resolved provider.
- `publishAllPublicationsToLocalDeployRepository` clean; the messagecrypto-bc POM now declares
  `org.apache.pulsar:pulsar-common` (runtime scope).
- `spotlessCheck` passes.

Assisted-by: Claude Code (claude-opus-4-8)
@lhotari
lhotari marked this pull request as ready for review June 13, 2026 23:11
@merlimat
merlimat merged commit cf0c24e into apache:master Jun 13, 2026
83 of 85 checks passed
lhotari added a commit to lhotari/pulsar that referenced this pull request Jul 19, 2026
185 master commits since the merge-base. 27 conflicts resolved:
- 3 PIP-337 files master modified but PIP-478 deletes (DefaultPulsarSslFactory,
  PulsarSslConfiguration, PulsarHttpAsyncSslEngineFactory): deletion stands; the
  Netty 4.2 endpoint-identification semantics from 982eac3 are handled by the
  new SPI's JdkSslContext path (native-path fix follows as its own commit).
- bouncy-castle bcloader modules: master's apache#26020 removal stands (branch's import
  fix is moot).
- 23 content conflicts (TLS/admin/proxy/websocket integration surface, PIP-472
  jakarta migration, Swagger v3, PIP-473, apache#26020 build conventions): both sides'
  intents preserved.
Merge adaptations for master-side API changes to branch-only code:
- AHC 3.0.10 Duration-typed timeouts/TTL in HttpClient, FrameworkHttpClientFactory
- pulsar-perf v5-client migration rewired from removed api.v5.config.TlsPolicy to
  org.apache.pulsar.tls.TlsPolicy
lhotari added a commit to lhotari/pulsar that referenced this pull request Jul 19, 2026
…all sites after the master merge

- MessageCryptoBc (master apache#26020) resolved the BouncyCastle provider via the
  removed SecurityUtility.getProvider(); use its decomposed equivalent
  JcaProviders.getProvider() (same FIPS-agnostic lookup).
- PulsarClientTool + PerfClientUtils (master's v5-client migrations) built the
  removed experimental api.v5.config.TlsPolicy; both translate to the PIP-478
  org.apache.pulsar.tls.TlsPolicy builder unchanged.
- pulsar-client-api-v5: drop the stale 'unpublished module' comment (apache#26020
  made it a published public library).
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.

4 participants