GeezerVison is showing github.com — [improve][client] Use SHA-256 for generated reader subscription names by david-streamlio · Pull Request #26153 · apache/pulsar
Conversation
Motivation
When a reader is created without an explicit subscription name, ReaderImpl/MultiTopicsReaderImpl generate one by hashing a random UUID with SHA-1 (DigestUtils.sha1Hex). The hash is not a security control — it just produces a short random identifier — but strict security providers reject SHA-1: under BC-FIPS in approved-only mode the call throws, so creating a reader without a subscription name fails on FIPS-configured JVMs.
This is one of a set of small preparatory cleanups for FIPS-restricted deployments; a broader PIP is being drafted separately.
Modifications
Replaced DigestUtils.sha1Hex(...) with DigestUtils.sha256Hex(...) in the generated-subscription-name paths of ReaderImpl and MultiTopicsReaderImpl. The generated names keep the same shape (reader- / multiTopicsReader- prefix + 10 hex chars) and entropy (40 bits of a hash over a random UUID). The names are ephemeral, used for non-durable subscriptions, and never persisted, so nothing is observable across versions.
Verifying this change
- Make sure that the change passes the CI checks.
This change is a trivial rework / code cleanup without any test coverage. (Existing reader tests, e.g. ReaderImplTest, exercise the generated-name path.)
Does this pull request potentially affect one of the following parts:
- Dependencies (add or upgrade a dependency)
- The public API
- The schema
- The default values of configurations
- The threading model
- The binary protocol
- The REST endpoints
- The admin CLI options
- The metrics
- Anything that affects deployment
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
The auto-generated reader subscription name hashed a random UUID with
SHA-1. The hash is not a security control, but SHA-1 is rejected by strict
security providers (e.g. BC-FIPS in approved-only mode), which would make
readers without an explicit subscription name fail on FIPS-configured JVMs.
The generated names are ephemeral and never persisted, so the change is not
observable across versions.
This was referenced Jul 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR improves Pulsar client compatibility with FIPS-restricted JVMs by removing SHA-1 usage from autogenerated reader subscription names, which can fail under strict security providers.
Changes:
- Switch
ReaderImpl autogenerated subscription name hashing from SHA-1 to SHA-256.
- Switch
MultiTopicsReaderImpl autogenerated subscription name hashing from SHA-1 to SHA-256 (keeping the same prefix + 10-hex-char shape).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File |
Description |
| pulsar-client/src/main/java/org/apache/pulsar/client/impl/ReaderImpl.java |
Replace DigestUtils.sha1Hex(...) with DigestUtils.sha256Hex(...) for generated reader subscription names. |
| pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsReaderImpl.java |
Replace DigestUtils.sha1Hex(...) with DigestUtils.sha256Hex(...) for generated multi-topic reader subscription names. |
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
david-streamlio
added a commit
to david-streamlio/pulsar
that referenced
this pull request
Aug 26, 2026
PIP-478 has landed since this proposal was written, and it moved or closed several of the things
the Motivation section cites as current state. Reviewers who check the first claim and find it
already fixed will discount the rest, so the audit is done against master rather than left to them.
SecurityUtility is gone (apache#26322 deleted it with the rest of the PIP-337 TLS stack), and the PIP
leaned on it in six places -- the Background paragraph establishing that Pulsar is already
FIPS-capable at the JCA layer, the packaging jar-swap rationale, the EC curve allowlist, the
fipsMode validator's first assertion, the High Level Design, and the integration test. Each now
names JcaProviders, whose ResolvedBouncyCastleProvider(Provider, boolean fips) reports the flavour
as a value rather than a static predicate. Its registration-first resolution order is recorded too:
a provider an operator registered in java.security is preserved rather than shadowed by a
classpath-constructed one, which is the property a FIPS deployment depends on.
Motivation item 2 is closed. PulsarSslConfiguration, PulsarSslFactory and DefaultPulsarSslFactory
no longer exist; every listener builds from a PulsarTlsFactory, and the broker binary listener
carries engineProvider(TlsFactorySupport.engineProvider(conf.getTlsProvider())). Rewritten to what
survives -- an unset tlsProvider still resolves to the native engine, because tcnative remains an
unconditional pulsar-common dependency, so FIPS mode must pin the engine and drop the jar.
Motivation item 3 is stale in form: the declared defaults are now empty rather than the literal
Conscrypt, and unset *means* Conscrypt only through resolveWebJsseProvider, on the web listeners.
The concern survives; the citations did not.
Items 1, 4, 5 and 6 were re-verified and hold, with line numbers corrected. Item 1 gains the
version catalog's own statement of the gap (libs.versions.toml:62-63).
Adds the gap the PIP did not list: DefaultBrokerTlsFactory resolves its JSSE provider as
resolveJsseProvider(null, ...), so the broker's jsseProvider and brokerClientJsseProvider keys are
declared but ignored -- item 2's shape in a newer key. apache#26326 fixes it and adds the jcaProvider
configuration surface that design (a) assumes, so the dependency is now stated rather than implied.
Housekeeping: apache#26152 and apache#26153 are merged, not open; apache#26154 no longer claims the KeyManagerProxy
half, which PIP-478 obsoleted; and the Configuration table's four pre-PIP-478 provider rows become
two rows naming the keys fipsMode actually evaluates.
Reviewers
merlimat
merlimat approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|