GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [CI] PIP-478 final-review fixes (stack top: #26326 + #26327 + #26328) by lhotari · Pull Request #258 · lhotari/pulsar

Conversation

@lhotari

@lhotari lhotari commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Personal CI for the whole open PIP-478 stack with the final-review fixes applied. apache/pulsar runs only the semantic-title check on stacked PRs that are not at the bottom, so the stack is exercised here instead.

New in this run, on top of the three open PRs:

  • [fix][build] declare pulsar-client-api-v5 / pulsar-tls-factory-api / pulsar-http-client-api on the three shaded client artifacts — they were referenced by bundled classes but neither bundled nor declared, so AuthenticationFactory.token(...) and any TLS client threw NoClassDefFoundError on the published pulsar-client
  • [fix][client] ClientBuilderImpl.build() hands the client a copy of the configuration, so two clients from one builder no longer share (and close) one TLS factory
  • [fix][broker] CompactorTool carries brokerClientTlsFactoryClassName/Config
  • [fix][misc] provider-resolution order corrected in 14 doc sites; WARN added for an empty PEM trust file
  • [improve][pip] six pip-478.md claims reconciled with the shipped behaviour

Local gates: quickCheck and sanityCheck green at the stack top; the new client and compactor tests pass and are mutation-verified.

Do not merge — CI only.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
lhotari added 30 commits August 15, 2026 12:25
@lhotari
[improve][client] PIP-478: move the binary auth driver out of the pub…
9da0ed9
…lic API module

AsyncAuthenticationDriver lived in pulsar-client-api as a "stable internal" marker, because
it existed for a carve-out: a v4 Authentication could additionally implement it and
ClientCnx would then drive that plugin asynchronously instead of synchronously. Since the
client drives the v5 model natively there is no such choice — the client resolves the
authentication it drives and wraps it itself, and nothing outside pulsar-client implements
or observes the type.

Move it to org.apache.pulsar.client.impl.auth.v5 and name it for what it now is,
BinaryAuthenticationDriver. That removes an internal type from the API module's surface, and
its javadoc no longer has to describe a synchronous alternative that no longer exists.

Also make the client's own blocking auth executor queue rather than reject. It was a
SynchronousQueue with the default abort policy, so the seventeenth concurrent credential call
failed outright — and every caller is a connection attempt or an authenticated request, so a
reconnect storm against a slow identity provider produced failed connections rather than slow
ones. This is the same fix the shared fallback pool already received, and it is what
pip-478.md already claims the executor does.

Assisted-by: Claude Code (Opus 5)
@lhotari
[improve][client] PIP-478: re-home the two invariants the v5->v4 adap…
a53269b
…ter carried

Deleting V5ToV4AuthenticationAdapter took two loud failures with it, and neither is exotic.

A plugin that exposes no BinaryAuthDataProvider cannot authenticate a binary connection —
PIP-478 binary routing rule 1. The adapter refused it in start(), so a misconfiguration
failed the client build. Without that, the client builds fine and every connection attempt
fails for its lifetime with the reason buried in a connection error. The client now checks
it where the adapter did, on the path the adapter served: a plugin configured through the v5
builder is initialized at build time (which PIP-478 already specifies for that path) and the
capability is checked once initialization has run, since capabilities are only meaningful
after it.

Serializing a configuration that carries a v5 plugin used to fail with an actionable
NotSerializableException naming authPluginClassName. The v5 slot is transient, so it became
a silent drop — and a configuration whose authentication was dropped authenticates as
nobody, discovered as a broker rejection far from its cause. ClientConfigurationData now
refuses, unless the string form is also configured, which does survive the round trip and is
what a remote or forked context should carry.

Both are pinned by ClientAuthenticationFailsLoudlyTest, including the case that must keep
working: a configuration using authPluginClassName + authParams still serializes.

Assisted-by: Claude Code (Opus 5)
@lhotari
[improve][misc] PIP-478: correct two comments that describe code that…
455ff55
… moved

BrokerService carried two stacked javadoc blocks before warnOnStalePip337ClusterFactory:
the first documents resolveBrokerClientTlsFactory, which has its own copy further down, so
the helper's real javadoc was preceded by a description of a different method. Remove the
orphan.

PulsarAdminImpl's binding said the scheduler and blocking executor are "unused on the
HTTP-only admin path". That stopped being true when SASL gained a v5 body: its
SASL-over-HTTP challenge rounds off-load their GSSAPI work through exactly that executor.
Leaving it unbound is still the right choice — an unbound executor now falls back to the
shared pool rather than running on the caller thread, and lending the admin's own request
threads would let a slow KDC consume them — but the comment should say that rather than
claim nothing uses it.

Assisted-by: Claude Code (Opus 5)
@lhotari
[fix][misc] PIP-478: wire the provider keys and stop handing plugins …
3df1eff
…a null executor

Four defects the PIP-vs-code consistency sweep turned up, each a case of the code not doing
what the design document says it does.

The broker ignored its own jsseProvider and brokerClientJsseProvider settings.
DefaultBrokerTlsFactory passed null as the explicit JSSE provider at all three sites, so a
key shipped in broker.conf and standalone.conf did nothing — while the proxy, websocket
service and functions worker all honour theirs. Wired.

An adopted PulsarTlsFactory was never initialized on a plaintext client.
needsClientTlsFactory() omitted the adopted-factory arm, so a factory handed in through the
v5 builder on a pulsar:// URL with no policy map was closed on shutdown without ever having
been initialized. The admin path has that arm and cites the PIP for it.

AuthenticationInitContext handed out a null blocking executor when no client bound services.
The SPI tells a plugin to off-load its blocking work onto that executor, so null makes every
third-party plugin either fail with an NPE or defensively do the one thing the contract
forbids. It now returns the shared pool, which is what the built-ins already got by funnelling
through supplyBlocking.

TlsHandle#get()'s javadoc said only that its value after dispose() is "unspecified", where
the PIP says an implementation must not return a released native context. A consumer handed a
released ReferenceCountedOpenSslContext has a use-after-free, so the stronger statement is the
one that belongs in the contract.

Also removes org.apache.pulsar.client.api.internal, left empty in a shipped public artifact
when the binary auth driver moved, with a package javadoc still linking the type that left.

Assisted-by: Claude Code (Opus 5)
@lhotari
[improve][pip] PIP-478: reconcile the PIP with what was implemented
5833229
The design document and the code drifted apart over the series, most of all where the
client's authentication changed direction: the PIP still specified V5ToV4AuthenticationAdapter
as permanent machinery, described the built-in shims as additionally exposing an async driver
with the no-credential-I/O ones staying on a verbatim synchronous path, and listed the
framework-services marker as new public API. None of that survives the inversion — the client
resolves one v5 Authentication and drives every binary connection from it, and the only bridge
left runs v4 to v5.

Reconciled across four axes — bridging direction, API inventory, threading and off-loading,
and the TLS SPI — as 46 edits derived from reading each passage against the code it describes.
Beyond the direction rewrite, the notable corrections are:

- The inventories were incomplete. Four deleted public classes were never listed
  (JettySslContextFactory, PulsarHttpAsyncSslEngineFactory, the PIP-466 AuthenticationData
  stub, the CN-matching helpers), and neither was ClientCnx's protected-surface change — the
  authentication field replaced by a driver whose type is not in a public API module, plus a
  new overridable authMethodName(). An out-of-tree subclass notices both.
- The threading text claimed a re-entrancy-aware executor the code does not implement, and
  described a "degraded inline" fallback that no longer exists now that credential work always
  off-loads.
- The built-in mapping was described as a closed class-name allow-list; it is interface-based,
  which means a third-party plugin implementing the seam *is* picked up — the opposite of what
  the PIP promised.

Passages that describe removed machinery as history are deliberately untouched: the PIP-337
critique in Motivation, the JettySslContextFactory and TrustManagerProxy analyses in the
appendices, and the migration tables telling operators what to move away from.

What this does NOT do is paper over the one place the code is behind the design: the PIP
specifies a two-axis provider model and only the JSSE axis is implemented. That is a missing
port, not documentation drift, so the JCA column stays and the decision is recorded as a
follow-up rather than resolved by quietly deleting the text.

Assisted-by: Claude Code (Opus 5)
@lhotari
[fix][misc] PIP-478: whole-series cross-review fixes
c7db8c9
A review of the cumulative final state of every file the series touched — 320 paths, 286 surviving —
rather than of any one PR's diff, run with Codex gpt-5.6-sol against pip/pip-478.md as the spec. Nine
defects, each verified against the code before being accepted. The three that would bite an operator:

tlsFactory(...) forced transport TLS on a plaintext broker. PulsarClientBuilderV5.tlsFactory called
setUseTls(true), so adopting a factory to serve CLIENT_OAUTH2 — an HTTPS identity provider behind a
private CA, the case the SPI exists for — made a pulsar:// client attempt a TLS handshake against the
plaintext broker port. The PIP states the rule for this method by name, and the sibling tlsPolicy(...)
already implements it with a comment describing this exact failure; tlsFactory was simply missed. The
factory is still composed: needsClientTlsFactory() has its own adopted-factory arm.

The PIP-337 deprecation warning copied secrets into the log. warnOnStalePip337ClusterFactory attached
the whole brokerClientSslFactoryPluginParams value as a log attribute. PIP-337 defined it as an opaque
plugin-interpreted string, so it routinely carries keystore passwords or KMS credentials. It now
reports only whether the value was set.

The functions worker had no outbound provider keys at all. The PIP promises the worker propagates its
brokerClient* provider keys onto its own PulsarClient and PulsarAdmin independently of
brokerClientTlsFactoryClassName, and that an embedded worker inherits them from the broker. WorkerConfig
declared only the listener-side tlsProvider/jsseProvider, and it ignores unknown YAML — so an operator
pinning BCJSSE for FIPS got silence, not an error. Adds brokerClientSslProvider and
brokerClientJsseProvider (the two implemented axes; the JCA axis waits on its own decision), wires both
into the client and admin builders, and inherits them — plus the two web-listener keys — for an
embedded worker.

The rest:

- A failed post-connect auth challenge left the channel open. The three failure paths in
  ClientCnx.completeAuthChallenge only failed connectionFuture, which on a broker-pushed REFRESH is
  already completed and so a no-op: no auth response was sent, the channel stayed open, and the client
  neither reauthenticated nor reconnected until the broker timed it out. PIP-478's own off-event-loop
  resolution timeout made this newly reachable. Now closes the channel, as the challenge-round cap in
  the same file already did.
- A failed TLS probe leaked the initialized factory, with its metrics registration, file watcher and
  refresh task. PulsarClientImpl assigns conf.setTlsFactory(...) only to the returned value, so a throw
  left no owner.
- TlsHandle.get() could return a released native context. Both handle kinds returned the instance after
  dispose() released it — a use-after-free on a ReferenceCountedOpenSslContext. They now throw
  IllegalStateException, which the contract explicitly permits.
- Disabling hostname verification produced no WARN, though the PIP promises one for any insecure
  setting on first use; only allowInsecureConnection was covered.
- Two comments that describe code as it is not: ClientTlsFactorySupport claiming
  brokerClientTlsFactoryConfig params are "not yet plumbed" when all five callers plumb them, and a
  test citing SimpleAuthInitContext, a class this series deleted.
- BasicAuthenticationV5 resolves inline on the event loop, unlike the four sibling bodies. Left inline
  deliberately — the v4 shim supplies two field reads and a thread hop per connection would cost more
  than it buys — but the constructor now documents that suppliers must not block.

Tests: the builder's useTls behaviour both ways, the dispose contract on both handle kinds, and the
embedded-worker inheritance.

Assisted-by: Claude Code (Opus 5), Codex (gpt-5.6-sol)
@lhotari
[improve][misc] PIP-478: correct three javadocs describing the delete…
b9243d7
…d v5→v4 adapter

The inversion deleted V5ToV4AuthenticationAdapter, but three javadocs still described the design built
around it as current — and one of them was wrong about threading, not just about a name:

- PulsarClientBuilderV5.applyAuthentication carried a paragraph routing every credential-fetching plugin
  "through V5ToV4AuthenticationAdapter so its getAuthData off-loads", which is no longer how off-loading
  happens: the client resolves one v5 body and the driver it builds is what keeps credential work off the
  event loop. Its resolveAuthenticationForTest @return likewise promised "a raw v4 engine, or a wrapping
  V5ToV4AuthenticationAdapter"; the slot now holds the raw v4 plugin or nothing.
- BinaryAuthenticationExchange described itself as shared by two drivers that must not drift. There is
  one, V5BinaryAuthenticationDriver.
- ClientAuthenticationServicesAware listed the deleted bridge as an implementor, and said an unbound
  driver "runs inline on the caller thread rather than being off-loaded". That stopped being true when
  the shared fallback pool landed — which matters, because the paths that skip binding are the proxy's
  broker connections, where the caller thread is a Netty event loop.

The fourth surviving mention, in ClientAuthenticationFailsLoudlyTest, is correct: it names the adapter as
the deleted thing whose invariants the test re-homes.

Assisted-by: Claude Code (Opus 5)
@lhotari
[fix][misc] PIP-478: second cross-review pass — builder reuse, purpos…
c38c43e
…e scoping, SASL token

An independent second reviewer (Claude Fable) covered the same cumulative final state and found what the
first pass did not. The three that change behaviour:

A closed client's TLS factory was left in the caller's builder, breaking builder reuse.
ClientBuilderImpl.build() hands the builder's own ClientConfigurationData to the client without cloning
it, so the factory PulsarClientImpl composes during construction is written into an object the
application still holds. shutdown() closed that factory but left the reference. The next build() from the
same builder then took the dead factory for one adopted through the v5 builder, re-initialized it —
violating the SPI's initialize-exactly-once rule — and failed the build with "FileBasedTlsFactory is
closed". Reusing a builder is ordinary v4 usage that worked before this series, and the same hazard is
already documented and avoided for the v5 authentication slot a few lines away. A composed factory is now
cleared on shutdown; an adopted one is left alone, since the application supplied that instance.

tlsPolicy(purpose, ...) enabled the binary transport for every client-role purpose. The guard excluded
only CLIENT_OAUTH2, so BROKER_CLIENT and any plugin-minted purpose from TlsPurpose.client("...") still
flipped useTls — the same defect the guard was added to fix, for the purposes it did not name. pip-478.md
calls transport enablement "one narrow addition" belonging to CLIENT_DEFAULT alone, which is now the
condition.

The SASL HTTP driver rebuild discarded a validated Kerberos role token. The driver is rebuilt when the
bound services change, on the stated ground that it "holds no cross-request state" — but the rebuild
minted a fresh SaslAuthenticationV5, and that body holds the cached role token whose whole purpose is to
spare a full renegotiation per request. One plugin shared between a PulsarClient and a PulsarAdmin — the
scenario the comment itself cites — is exactly when rebinds happen. The body is now kept across driver
rebuilds and dropped with the plugin on close.

Also, dead code and comments that assert the opposite of the code:

- PulsarClientBuilderV5.resolveBridgedV4 returned a raw-vs-stay-wrapped decision that its only caller
  discards, and warned that a bridged plugin with both TLS material and a fetched credential "runs inline
  (no credential off-load)" with advice to set tlsPolicy(...) to fix it. Since the inversion the client
  always re-wraps through LegacyV4AuthenticationAdapter, which always off-loads, so the warning told
  users to act on a problem they did not have. Both removed; the probe is now skipped entirely when there
  is no policy to fold into, which also avoids an eager credential fetch at build time.
- TlsFactorySupport said the PIP-337 removed-key validation "arrives with the server-side migration"; it
  ships (PulsarConfigurationLoader.rejectRemovedPip337TlsFactoryKeys).
- SaslAuthenticationV5 and AthenzAuthenticationV5 described a null executor as "degraded inline
  computation"; supplyBlocking substitutes the shared pool and never runs inline.
- The pulsar.tls.reload metric described itself as counting attempts; it counts events, as the PIP says.
- ServiceChannelInitializer.tlsEnabledWithKeyStore was written and never read, left by the deleted
  KeyStoreSSLContext branch.
- conf/websocket.conf omitted jsseProvider, the one component whose provider pin was undocumented while
  its config class declares it and its server reads it.

Tests: builder reuse after close, and that the composed factory is cleared from the configuration.
Mutation-verified.

Assisted-by: Claude Code (Opus 5), Claude Fable
@lhotari
[improve][pip] PIP-478: correct five specification errors found revie…
b0fdb31
…wing the final state

Reviewing the whole series against the PIP surfaced five places where the document, not the code, is the
wrong side. Two of them would mis-steer someone building against it:

- The normative "HTTP challenge routing" rules describe a 401-reactive driver: single-pass headers on the
  initial request, the plugin's challenge handler invoked on the server's 401, the response returned
  unhandled when no handler exists. The shipped driver does none of that. It runs the exchange as a
  pre-flight side band of bodiless GETs to the original URI, engages only when the plugin exposes BOTH
  the challenge handler and the headers provider, and never sees the real request's response at all — it
  cannot resubmit. The adjacent prose already described this correctly, so the rule list contradicted its
  own section. Rewritten to the shipped behaviour, with a note on why reactive was not chosen.
- The LegacyV4CredentialAdapter section was stale on four counts: it omitted BinaryAuthChallengeHandler
  from the adapter's interface list, said the post-start has*() probe decides the binary capabilities
  (they are advertised unconditionally, which is what preserves v4 parity for third-party multi-round
  plugins), described the credential as rendered via getCommandData() rather than
  authenticate(INIT_AUTH_DATA), and carried a "known limitation" — that a non-"sasl" third-party
  challenge plugin's multi-round flow "is not driven" — that the implementation fixed.

And three narrower ones:

- The binary routing rules omitted two shipped normative behaviours: the 10-round challenge cap, which is
  a real v4 behaviour change (an unusually long GSSAPI negotiation that used to complete now fails), and
  the dropping of a non-refresh challenge that arrives mid-round.
- "Both HTTP transports off-load the whole v4 header composition" is true of the lookup client only;
  BaseResource still composes on the calling thread. The known gap had become invisible to a PIP reader.
- The perf tools were said to "gain --jsse-provider / --jca-provider". They gained neither.

The provider matrix also now states plainly what ships: the JSSE column everywhere except pulsar-perf and
the WebSocket proxy's outbound leg, and the JCA column in the SPI and default factory but with no
configuration key anywhere — reachable today only through the v5 builder. That is the open decision, so
the column stays and the note describes the gap rather than hiding it.

Assisted-by: Claude Code (Opus 5), Claude Fable
@lhotari
[fix][misc] PIP-478: invalidate a rejected SASL role token, and pin t…
0cb3595
…he WebSocket proxy's outbound providers

A poisoned SASL role token was never invalidated. isRoleTokenExpired only recognised an explicit
rejection — a Kerberos SASL response whose State reports the token expired — which is all
AuthenticationSasl ever checked. A broker whose signer secret has rotated, or a peer broker holding a
divergent secret, instead rejects a replayed token with a bare response carrying no SASL headers at all.
That case fell through, so the cached token was replayed on every request, burned the whole round budget,
and failed, for the life of the client — and the cross-request cache exists precisely so it is replayed.
An unadorned response to a round that replayed the token is now treated as a rejection: the token is
dropped from both the conversation and the cache, and the exchange restarts. The cost when a server
merely answers oddly is one extra negotiation; the cost of the previous behaviour was every request.

The WebSocket proxy gains brokerClientSslProvider and brokerClientJsseProvider for its own outbound
proxy-to-broker client, wired independently of brokerClientTlsFactoryClassName and documented in
websocket.conf. It was the last component whose outbound leg could not be pinned — the broker, the proxy
and the functions worker all could — so a FIPS deployment had one process that silently ran on the
platform default. The listener-side tlsProvider/jsseProvider keep governing its web server alone.

Assisted-by: Claude Code (Opus 5)
@lhotari
[feat][misc] PIP-478: give the JCA provider axis its configuration keys
96bfbf5
The PIP specifies a two-axis provider model — a JSSE provider for the SSLContext and a JCA provider for
the KeyStore/CertificateFactory/KeyFactory engines that parse the material — and its FIPS argument
(Motivation apache#4, Goal #5) rests on having both, since BCJSSE is only half of a FIPS deployment without
BCFIPS underneath it.

The axis itself was already implemented and honoured end to end: TlsPolicy.jcaProvider() is threaded
through TlsMaterialSource into every material load — keystores, PEM certificates, private keys, trust
certs and the auth-provided material source — and TlsContexts resolves both axes together on the JDK and
Netty trust paths. What was missing was the configuration surface, so the axis was reachable only
programmatically through the v5 builder and no operator could pin it from a config file. That is what
made the PIP's provider matrix read as an overclaim.

Adds jcaProvider and, where the component has an outbound leg, brokerClientJcaProvider to
ServiceConfiguration, ProxyConfiguration, WebSocketProxyConfiguration and WorkerConfig, plus jcaProvider
on ClientConfigurationData. Each is wired into the TlsPolicy at the same site as its jsseProvider
counterpart — all nine of them, including the v5 builder's material fold, where dropping half a pinned
pair is as bad as dropping both, and PulsarClientTool's client.conf mapping. The embedded functions
worker inherits both new keys from the broker on the same terms as the JSSE ones, and all six shipped
conf files document them.

Note the asymmetry with jsseProvider, which is deliberate: the JSSE axis has a web-listener default
(Conscrypt when usable) resolved by the caller, so it is threaded through resolveWebJsseProvider /
resolveJsseProvider. The JCA axis has no such default — unset means the JVM search order everywhere — so
it is read straight from the configuration on every purpose.

Assisted-by: Claude Code (Opus 5)
@lhotari
[feat][cli] PIP-478: add --jsse-provider / --jca-provider to the perf…
857cc5f
… tools

The PIP specified both flags and neither was implemented, so pulsar-perf could reach neither provider
axis — leaving no way to run a FIPS validation against a cluster whose brokers are pinned, which is
exactly the scenario the flags exist for. Both are format-independent: they apply to PEM and keystore
material alike, and both fall back to client.conf through the existing default-value provider.

The PIP's provider matrix now states that both columns ship on every row, in place of the note added a
few commits ago recording the JCA column as unreachable from configuration.

Assisted-by: Claude Code (Opus 5)
@lhotari
[fix][client] PIP-478: stop handing plugins a null scheduler
4b13add
AuthenticationInitContext.scheduler() returned null when no client bound framework services, the same
defect blockingExecutor() had: the SPI invites a plugin to schedule its credential refresh there, so null
makes every third-party plugin either NPE or roll its own pool. It now returns a shared process-lifetime
daemon scheduler, sized at one thread because the contract is that scheduled work hands the blocking off
to blockingExecutor(); core threads time out so an unused pool costs nothing.

httpClientFactory() deliberately stays null and now says why. An HTTP client factory cannot be built
without the client's TLS configuration and lifecycle, and handing back a bare one would give a plugin an
HTTP client that quietly ignores the deployment's trust settings — worse than an honest absence. It is
the one accessor a plugin must null-check.

Assisted-by: Claude Code (Opus 5)
@lhotari
[doc][misc] PIP-478: pin the shared-executor contract and the REFRESH…
39b0be1
… sentinel delta

Two review follow-ups that are contract statements rather than behaviour changes.

`TlsFactoryInitContext` presents `scheduler()` and `blockingExecutor()` as if they
were distinct pools, but every wiring in the repository — broker binary and web,
proxy inbound, broker-client and web, websocket, functions worker, and the client —
passes one general-purpose scheduled pool for both. That is a deliberate choice
rather than an oversight: neither role is ever an event loop, so an occasional
blocking material load is tolerable, and eight dedicated pools would cost more than
they buy. The contract now says so, and states the obligation that makes sharing
safe — work triggered on a scheduler thread must be dispatched to the blocking
executor rather than run in place, which is what `FileBasedTlsFactory`'s poll
already does.

`pip-478.md` specified that a broker-pushed REFRESH starts a fresh exchange
(binary routing rule 2) but never drew the consequence for a bridged v4 plugin:
its refresh call arrives as `authenticate(INIT_AUTH_DATA)` where the v4 client
passed `REFRESH_AUTH_DATA`, so the sentinel never reaches such a plugin at all.
Invisible for every plugin that ignores the argument on its credential path — all
the built-ins — but observable for a third-party plugin that branches on it, which
makes it a behaviour change worth stating rather than leaving to be discovered.
@lhotari
[test][misc] PIP-478: pin the JCA provider inheritance an embedded wo…
ee7269b
…rker relies on

The commit adding the JCA configuration keys states that an embedded functions
worker inherits both new keys from the broker on the same terms as the JSSE ones,
and PulsarService.initializeWorkerConfigFromBrokerConfig does exactly that — but
WorkerConfigProviderInheritanceTest only asserted the four older pins, so the two
newest ones were the untested half of the claim. Removing both inheritance blocks
left the suite green.

Extends the two existing cases to cover jcaProvider and brokerClientJcaProvider.
Mutation-verified: dropping the JCA inheritance now fails
embeddedWorkerInheritsProviderPinsFromTheBroker with "expected: BCFIPS but was:
null".

The pair matters together rather than individually: BCJSSE without BCFIPS
underneath it is FIPS-shaped rather than FIPS-compliant, so an embedded worker
inheriting only half a pinned pair fails open in precisely the deployment the pair
is configured for.

Assisted-by: Claude Code (Opus 5)
@lhotari
[cleanup][broker] PIP-478: name the stale-PIP-337 warning attribute f…
cf1d120
…or what it is

The attribute carries a boolean — whether brokerClientSslFactoryPluginParams was
set — because the value itself must never be logged: PIP-337 defined it as an
opaque plugin-interpreted string, so it routinely holds keystore passwords or KMS
credentials.

brokerClientSslFactoryPluginParamsSet reads as easily as "the params set" (a
collection) as it does "params: set?", and every other *Set attribute in the tree
— keySet, statefulSet, ackedSet — really is a collection, so the local convention
argues for the wrong reading. Renamed to hasBrokerClientSslFactoryPluginParams.

Assisted-by: Claude Code (Opus 5)
@lhotari
[fix][broker] PIP-478: carry brokerClientJcaProvider onto every outbo…
041deb9
…und leg

The commit adding the JCA configuration keys wired brokerClientJcaProvider into the
components that build a TlsPolicy directly, but four legs that build a PulsarClient
or PulsarAdmin instead propagate the outbound pins onto a ClientConfigurationData —
and each of those was given sslProvider and jsseProvider and stopped there: the
broker's own internal client (PulsarService), the geo-replication client and the
cross-cluster admin (BrokerService), and the proxy's lookup client
(ProxyConnection). WorkerUtils and WebSocketService set all three.

That config field is the only route those legs have. Their policy is composed by
ClientTlsFactorySupport.clientDefaultPolicy, which reads conf.getJcaProvider();
DefaultBrokerTlsFactory.brokerClientPolicy does read the ServiceConfiguration key,
but nothing routes the broker's PulsarClient or PulsarAdmin through it. So
brokerClientJcaProvider in broker.conf reached nothing at all, while in proxy.conf
it reached the direct broker connection (via ProxyTlsFactories.brokerClientPolicy)
and not the lookup leg — one setting, two legs, one of them honouring it.

Nothing regresses: the keys are new in this series and unset still means the JVM
search order. What is fixed is a documented key that did nothing on its primary
documented path. The failure mode is the one this PR fixes for the functions worker
— an operator pinning brokerClientJsseProvider=BCJSSE and brokerClientJcaProvider=
BCFIPS got the JSSE half and silently lost the material half, leaving those legs
parsing keystores and certificates on the JVM search order. Half a pinned pair is
FIPS-shaped rather than FIPS-compliant, and it fails open.

Adds BrokerClientProviderPinsTest for the three broker legs and a case to
ProxyConnectionTest for the proxy's lookup leg, each asserting all three pins
rather than the new one alone, so a fourth axis cannot be half-wired the same way.
Mutation-verified: removing each propagation fails its own leg's assertion.

Assisted-by: Claude Code (Opus 5)
@lhotari
[fix][client] PIP-478: carry the provider pins onto the OAuth2 IdP an…
4aca092
…d perf admin legs

A multi-model review sweep of every site that reads or writes the three provider
keys found the two remaining legs where the matched set is propagated as a subset.
Both are specified by the PIP and both were implemented once, in the original JCA
commit b0a91c661fb; they were lost when the series was re-derived onto the current
branches, so this restores that design rather than inventing one.

pulsar-perf: --jsse-provider / --jca-provider reached the binary client and not the
PulsarAdmin builder, so a FIPS run pinned its data connection while its HTTPS admin
calls parsed the broker certificate through the JVM provider search order. pip-478.md
states the requirement directly: "the pulsar-perf flags reach the PulsarAdmin leg as
well as the binary leg". PulsarAdminBuilder exposes no fluent setter for either axis,
so this writes them onto the underlying configuration exactly as
BrokerService.configAdminTlsSettings does.

OAuth2: the CLIENT_OAUTH2 policy carried IdP material and no providers at all, and
the plugin accepted no provider parameters, so the IdP token fetch was unpinnable —
against a PIP that specifies "an explicit OAuth2 parameter wins; otherwise the
framework-bound path inherits the composed CLIENT_DEFAULT value", with no inheritance
step on the standalone path, which has no owning client. Adds the jsseProvider /
jcaProvider OAuth2 parameters, resolves them per axis against the inherited value, and
wires composePolicies to pass the client's composed pins. A flow carrying no IdP TLS
material still contributes no policy — the provider-only case stays the deferred
follow-up the PIP names.

Nothing regresses: unset still means the JVM provider search order on every path.

Verified by mutation, one leg at a time: removing the perf admin propagation fails
adminBuilderCarriesBothProviderAxes; removing the fold's inheritance fails
OAuth2IdpProviderInheritanceTest. The plugin-level precedence rules are covered by
seven cases restored into OAuth2IdpTlsFoldTest, and the wiring by the new
OAuth2IdpProviderInheritanceTest — the plugin tests call the overload directly and so
cannot catch a fold that never passes the client's values, which the mutation showed.

Assisted-by: Claude Code (Opus 5)
@lhotari
[fix][broker] PIP-478: carry the provider pins onto the broker's own …
2f185ae
…admin client

The third leg of the same shape, and the one the earlier sweep could not see: every
other outbound leg sets at least one of the three provider keys, so grepping for their
call sites finds the ones propagating a subset — but not a leg that sets none at all.
Enumerating the legs instead of the call sites is what surfaces this one.

getCreateAdminClientBuilder maps the whole brokerClient* TLS material family onto the
builder — ciphers, protocols, keystore, PEM cert/key/trust, insecure and hostname
flags — and even the sibling factory axis via applyBrokerClientTlsFactoryToAdmin, but
none of brokerClientSslProvider / brokerClientJsseProvider / brokerClientJcaProvider.
The ClientConfigurationData is their only route: the admin transport composes its
policy through ClientTlsFactorySupport.clientDefaultPolicy (jsse/jca) and settings()
(engine). So a broker.conf pinning BCJSSE and BCFIPS left the broker's own admin
client building its SSLContext on the JVM default and parsing key material on the JVM
search order.

Each pin is set only when configured, so the brokerClient_* loadConf escape hatch
applied earlier in the same method is not clobbered by an unset documented key.

BrokerClientProviderPinsTest gains the leg its own javadoc already claimed to cover
("every outbound leg the broker drives"), which is now true: internal client,
geo-replication client, cross-cluster admin, and the broker's own admin client. The
fixture gains a TLS web listener, without which that leg cannot be built at all.
Mutation-verified: removing the pins fails it with expected "JDK" but was null.

Also from the same review, each verified against the code:

* conf/proxy.conf documented two of the three outbound pins. brokerClientSslProvider
  exists and is read (ProxyConnection, ProxyTlsFactories) and every sibling template
  documents its engine key; only proxy.conf omitted it, so a template-driven audit
  would report the matched set complete at 2/3.

* ProxyConfiguration.webServiceTlsProvider and its conf/proxy.conf mirror both claimed
  "the proxy's own HTTPS listener reads tlsProvider rather than this setting". It has
  not since the TLS SPI landed: ProxyTlsFactories resolves the WEB purpose from
  firstNonBlank(webServiceTlsProvider, tlsProvider), so this setting wins — matching
  the broker. An operator following the doc would pin the wrong key.

* Stale artifacts of the AsyncAuthenticationDriver -> BinaryAuthenticationDriver move:
  a javadoc still pointing at the deleted org.apache.pulsar.client.api.internal
  package, and three "an BinaryAuthenticationDriver" left by the rename.

Assisted-by: Claude Code (Opus 5)
@lhotari
[fix][client] PIP-478: close the last four provider-pin gaps found ve…
9b184f8
…rifying the fix

A verification pass over the whole axis found four more, two of them defects in the
OAuth2 inheritance added two commits ago.

The IdP leg inherited from the wrong place. composePolicies read the client's provider
pins off the ClientConfigurationData fields, but the CLIENT_DEFAULT policy it actually
composes may come from the v5 tlsPolicy(CLIENT_DEFAULT, ...) map, where the fields are
unset — so the caller most likely to have pinned deliberately inherited nothing. The
comment claimed the opposite ("the composed one ... rather than the raw field"), which
made it a false statement about its own line. It now reads the pins off the composed
policy, and effectiveClientDefaultPolicy exposes that resolution.

PulsarAdminImpl folded the IdP policy with the no-inheritance overload. That fold runs
before composePolicies and writes into the same map, so the putIfAbsent there could
never supply the inheritance: an admin-bound OAuth2 plugin never inherited the admin's
pins, whatever composePolicies did. It now inherits at its own fold site, which is the
only site that can.

Two more outbound legs carried none of the three, the same shape as the broker's own
admin client: NamespaceService's peer-cluster lookup client and CompactorTool's client.
Both map the whole brokerClient* TLS material family and stopped there.

Tests: OAuth2IdpProviderInheritanceTest gains the v5 policy-map case;
AdminOAuth2IdpTlsBindingTest gains admin inheritance and per-axis precedence; new
CompactorToolProviderPinsTest. All mutation-verified one at a time. Both OAuth2 tests
use resolvable provider names — a pinned name is resolved when the factory is built, so
BCJSSE/BCFIPS placeholders fail the build rather than the assertion.

NamespaceService's peer-cluster client is the one propagation here without a test: it is
built inside a computeIfAbsent on a live PulsarService with cluster metadata, and the
fixture cost is out of proportion to a three-field copy identical to six reviewed sites.

Assisted-by: Claude Code (Opus 5)
@lhotari
[fix][broker] PIP-478: stop an unset provider key clobbering the brok…
0dcfa7f
…erClient_ passthrough

The four legs fixed in 041deb9 wrote the three provider pins unconditionally, and
each of them applies the arbitrary brokerClient_* passthrough first: the broker's
internal client (PulsarService.loadBrokerClientProperties), the geo-replication client
and the cross-cluster admin (BrokerService, both via loadConf), and the proxy's lookup
client (ProxyConnection). So an operator who reached the axis through
brokerClient_jsseProvider — the documented escape hatch, and until this series the only
route on some of these legs — had that value overwritten with null whenever the
first-class key was unset. A silent downgrade of a security control, introduced by the
commit that was fixing the same class of problem.

getCreateAdminClientBuilder already guarded with isNotBlank and said why, as do
WebSocketService, WorkerUtils, and the two legs added in 9b184f8. This makes the
remaining four match, so the hatch behaves identically on all nine.

Pinned by ProxyConnectionTest.theBrokerClientPassthroughSurvivesAnUnsetFirstClassKey,
mutation-verified: dropping one guard fails it with expected "SunJSSE" but was null.
The regression was invisible to every existing test because they all set the
first-class key, which is exactly the case the guard does not change.

Found by an independent verification pass over the axis, not by the tests.

Assisted-by: Claude Code (Opus 5)
@lhotari
[fix][build] PIP-478: declare the three API modules on the shaded cli…
7877895
…ent artifacts

The core migration made pulsar-client-api-v5, pulsar-tls-factory-api and
pulsar-http-client-api `api` dependencies of pulsar-client, because the bundled
implementation classes surface those types on their exported ABI:
ClientConfigurationData exposes getTlsFactory():PulsarTlsFactory and
getTlsPolicyMap():Map<TlsPurpose,TlsPolicy>, AuthenticationToken and
AuthenticationBasic implement V5AuthenticationProvider, and FrameworkHttpClientFactory
implements PulsarHttpClientFactory.

None of the three reached the shaded artifacts. The shadowJar dependency filter is an
allow-list of five projects and they are not on it, and they were not in the
shadow/shadowApi blocks either -- which that file's own comment calls "the ONLY entries
in the dependency-reduced published POM". So every consumer of the published
org.apache.pulsar:pulsar-client, pulsar-client-admin and pulsar-client-all got a jar
whose classes reference org.apache.pulsar.tls.*, org.apache.pulsar.http.* and
org.apache.pulsar.client.api.v5.* with nothing on the class path to resolve them.
Superinterfaces resolve at class load, so AuthenticationFactory.token(...) -- the most
common client auth configuration there is -- throws NoClassDefFoundError, as does any
TLS-enabled client.

Declared rather than bundled, for the same reason pulsar-client-api is: these are API
modules a plugin author compiles against when writing a PulsarTlsFactory or a v5
Authentication, and bundling a second copy inside the shaded jar would put two versions
of the same interface on their class path. Being Pulsar's own packages they are never
relocated, so the declared artifact and the shaded jar agree on the class names.
pip-478.md said "bundle"; it is corrected in the PIP commit of this PR.

Verified on the generated POMs: all three modules now appear in pulsar-client-shaded,
pulsar-client-admin-shaded and pulsar-client-all with compile scope.

Nothing in the build catches this class of mistake -- verifyShadedJarContents only
rejects files outside the allowed roots, never missing ones, and the shade tests build
plaintext AuthenticationDisabled clients, which have no v5 supertype. A packaging
assertion is filed as a follow-up.

Assisted-by: Claude Code (Opus 5)
@lhotari
[fix][client] PIP-478: give each client its own configuration object
9724586
ClientBuilderImpl.build() handed the builder's own ClientConfigurationData to the
client. The client stores the TLS factory it composes back onto that object
(PulsarClientImpl.setupClientTlsFactory), so the factory became shared state on an
object the caller still holds.

Building two clients from one builder -- ordinary usage, and what ClientBuilder.clone()
exists for -- therefore made the second client adopt and re-initialize the first
client's live factory: resolveClientTlsFactory takes its adopted-factory branch on a
non-null slot, and needsClientTlsFactory() returns true for exactly that reason ("an
adopted factory counts too"). Closing either client then closed TLS for the other,
because shutdown closes conf.getTlsFactory() unconditionally. The surviving client kept
reporting itself open while every connect, reconnect, producer/consumer creation and
HTTPS lookup failed with "FileBasedTlsFactory is closed", permanently. Two further
effects on the same path: the first client's certificate-rotation poll was cancelled and
re-registered on the second client's scheduler, and a probe failure during the second
build ran closeQuietly on the first client's live factory.

Before PIP-478 each client built its own SslContext inside its own
PulsarChannelInitializer, so none of this could happen.

build() now hands over a copy. The sequential build -> close -> build case was already
handled by clearing the slot on close; that clearing is kept, since it still guards
construction paths that pass a ClientConfigurationData directly. Every caller that
mutates the builder's configuration (BrokerService, WorkerUtils, CompactorTool,
NamespaceService) does so before build(), so the copy carries their changes.

ClientBuilderReuseTlsFactoryTest gains the two-live-clients case and now asserts the
stronger invariant -- the builder's configuration is never mutated with a composed
factory -- in place of asserting that it is set and then cleared. Both new tests are
mutation-verified: restoring the shared reference fails each of them individually.

Assisted-by: Claude Code (Opus 5)
@lhotari
[fix][broker] PIP-478: carry the broker-client TLS factory selection …
593282f
…onto the compactor

CompactorTool.createClient is an outbound broker-client leg like the others, and this
series gave it the three provider pins -- but not the factory selection. 4.x propagated
the PIP-337 equivalent here (sslFactoryPlugin / sslFactoryPluginParams); its successor
keys were missed, so this is a behaviour regression rather than a pre-existing gap.

An operator who sets brokerClientTlsFactoryClassName in broker.conf -- the PIP-478 way
to source outbound TLS material from an HSM/KMS instead of files -- gets a working
broker and a `pulsar compact-topic` that silently falls back to the built-in file-based
factory composed from whatever brokerClient* paths happen to be set. On a deployment
that keeps no key material on disk that means no client certificate and the system trust
store: the handshake fails against a broker with
tlsRequireTrustedClientCertOnConnect=true, and against one without it the tool connects
as an unauthenticated identity. BrokerService.resolveBrokerClientTlsFactory's own
javadoc calls this shape "a silent downgrade of the TLS mechanism ... a security
regression".

Mirrors BrokerService.configTlsSettings, using the ClientBuilder setters. The pair
resolves atomically (the config follows the class name) and both are written only when
configured, so an unset first-class key cannot clobber a value supplied through the
brokerClient_ passthrough that createClient applies first.

CompactorToolProviderPinsTest gains the propagation case and a passthrough case; the
existing provider-pin assertions were blind to this because they only ever asserted the
three provider fields.

Assisted-by: Claude Code (Opus 5)
@lhotari
[fix][misc] PIP-478: correct the provider-resolution order, and warn …
c3cef51
…on an empty PEM trust file

Two unrelated-looking defects with the same shape: the shipped documentation describes a
security control as weaker or stronger than it is.

JcaProviders.resolveNamedProvider prefers a provider the operator already registered in
the JVM (Security.getProvider) and falls back to ServiceLoader -- an ordering the code
adopted deliberately, and whose own javadoc records why ("before this ordering a pinned
jcaProvider=BC resolved to a fresh provider rather than the registered one"). Fourteen
description sites state the reverse: six shipped conf files and the @FieldContext /
@Schema strings on ServiceConfiguration, ProxyConfiguration, ClientConfigurationData,
WebSocketProxyConfiguration and WorkerConfig, which are the source of the published
configuration reference. The one deployment where the order is load-bearing is the FIPS
one these keys exist for: BouncyCastle's JSSE provider takes its FIPS mode as a
constructor argument and registers under the plain name BCJSSE either way, so
"ServiceLoader first" tells an operator that the FIPS-mode instance they registered in
java.security will be shadowed by a no-arg one. It will not be -- and static
registration is the only way to get BCJSSE in FIPS mode, so the wrong sentence steers
deployments away from the single mechanism that works.

Separately, TlsMaterialSource's PEM axis deliberately keeps 4.x behaviour and falls back
to the platform trust store when trustCertsFilePath yields no certificates, rather than
failing as the keystore axis does. pip-478.md promises that this case "now WARNs naming
the file"; nothing logged. That fallback silently trusts every public CA, so a
truncated, mis-mounted or emptied trust file leaves a deployment that pinned a private
CA quietly accepting anything -- with no signal at all. The WARN the PIP already
promised is added.

Only the prose of each conf comment block is re-wrapped; the commented-out settings an
operator uncomments are untouched.

Assisted-by: Claude Code (Opus 5)
@lhotari
[improve][pip] PIP-478: reconcile four claims with the shipped behaviour
672fe4b
A final-state review of every file the series touched checked the document claim by
claim against the code. Four claims no longer hold; the code is right in each case
except the trust-file WARN, which was added in the preceding commit so the promise
became true rather than being deleted.

- Shading (Public API). The document said the shaded v4 artifacts "bundle" the v5 auth
  API, TLS-factory API and HTTP-client API classes. They are declared as compile-scope
  dependencies instead, like pulsar-client-api, because a plugin author compiles against
  those coordinates and bundling a second copy would put two versions of the same
  interface on their class path.

- Provider-name resolution (Security Considerations). The bullet warned that a
  statically registered provider "can be silently shadowed by a no-arg instance of the
  same name" because resolution "tries ServiceLoader before Security.getProvider(name)".
  Resolution is the other way round, as the Detailed Design and the Configuration
  section both already said -- so the section a FIPS auditor reads contradicted the rest
  of the document and warned against the one mechanism that actually pins a FIPS-mode
  BCJSSE. Replaced with the residual hazard that is real: when nothing has registered
  BCJSSE, Pulsar constructs it from the class path itself, in FIPS mode only when the
  resolved BouncyCastle JCA provider is BCFIPS, and logs that only at INFO. The
  Configuration section's "only ever resolvable through such a registration" is
  corrected to match.

- Eager TLS loading (Upgrade). Listed among the runtime deltas for existing v4
  applications, but ClientTlsFactorySupport gates the fail-fast probe on the v5-builder
  path (an adopted tlsFactory or an explicit tlsPolicy map) precisely so that an
  unmodified v4 application tolerating an unused bad TLS field still starts. Scoped to
  the v5-builder path.

Assisted-by: Claude Code (Opus 5)
@lhotari
[fix][admin] PIP-478: off-load the admin's v4 credential and lend it …
31e862f
…a bounded auth executor

PIP-478 states that every synchronous v4 plugin call is off-loaded, and after the
core migration that was true everywhere except one place: BaseResource resolved
the credential for each admin request on whatever thread issued the call.
HttpClient.computeAuthHeaders off-loads the identical composition for the lookup
path and names the self-deadlock it avoids — an OAuth2 or Athenz shim's
getAuthData() refreshes its credential over synchronous HTTP, and for a broker
calling its own admin client the caller is a request-handling thread. The
composition now runs on a blocking executor, and produces the plugin's headers
verbatim.

The v4 composition is off-loaded to the framework's shared pool rather than the
admin's own, because BaseResource is constructed by 30 subclasses that would each
have to thread an executor through; the shared pool is exactly what PIP-478
provides for a component with none to lend. What a services-aware plugin gets is
different, and is the second half of this change.

PulsarAdminImpl bound its framework services with a null blocking executor. That
stopped being a live defect when the init context grew a shared-pool fallback, but
it left the SASL-over-HTTP challenge rounds putting their GSSAPI work on one
process-wide pool shared with every other client in the JVM, so a stalled KDC
reached by one admin throttled authentication for all of them. The admin now lends
a small bounded pool of its own, created lazily and shut down with the admin, which
keeps that blast radius inside the admin that owns the plugin. Its request threads
are still never lent out — that was the hazard the original null was avoiding.

The scheduler stays unbound: nothing on the admin path schedules periodic
authentication work. Instead the bound init context now falls back to the shared
scheduler and blocking pool when the bound services leave one null, so the SPI's
"never null" contract holds on every path — previously, binding partial services
was worse for a third-party plugin than binding none at all, since the no-services
context has always guaranteed non-null.
@lhotari
[fix][admin] PIP-478: review fixes for the admin authentication executor
6754504
Review of apache#26327 by Copilot.

The admin built a bounded pool for blast-radius isolation and then sent its own
per-request v4 credential composition to the framework's process-wide shared
pool, so the common path — every authenticated admin request — kept the blast
radius the pool exists to contain. The stated reason was cost: BaseResource is
constructed 23 times and each would have to thread an executor through. Lending
the pool right after construction gets the same result without touching the 23
resource classes.

Second hook, same gap: newRequestHeader ran on whatever thread completed the
authentication stage. For a v4 plugin of the multi-round challenge shape that is
its own HTTP callback thread, so off-loading the credential resolution alone
covered half the composition. The continuation now runs on the same blocking
executor. HttpClient's lookup-path composition, which this one mirrors, had the
identical gap and is fixed with it.

The pool is now created with the admin rather than lazily: it is on the default
path, an unused ThreadPoolExecutor starts no threads, and a final field removes
the synchronized accessor.

Tests: theV4CompositionRunsOnTheOwningAdminsOwnPool builds a real PulsarAdmin, so
what is pinned is that the admin lends its pool — not that BaseResource would use
one if given it. theNewRequestHeaderHookIsOffLoadedToo hands the stage back to the
test to complete, because a stage completed before the continuation is registered
runs it on the registering thread and would pass either way. Both mutation-verified:
each fails alone when its fix is reverted.

Assisted-by: Claude Code (Opus 5)
@lhotari
[test][admin] PIP-478: fail the build when a new admin resource is no…
78727d1
…t lent the auth pool

Review follow-up on apache#26327 from david-streamlio.

lendAuthExecutor(...) is opt-in per construction site. A resource added to
PulsarAdminImpl later without the wrapper compiles, runs, and silently falls
back to the framework's shared pool — the fix undone with no symptom, because
the fallback works. Pinning one resource cannot catch that: the twenty-fourth
is the one that would be missed.

everyResourceTheAdminExposesIsLentThePool walks the accessors PulsarAdmin
itself declares and asserts each resource reports the admin's pool, so the
guard grows with the interface rather than with a hand-maintained list. It
reflects over public accessors only — no reading of private state — and reads
the executor through package-private accessors on both classes.

Mutation-verified: dropping the wrapper from one construction site fails the
test naming that accessor ("scalableTopics").

Assisted-by: Claude Code (Opus 5)
@lhotari
[improve][pip] PIP-478: record that the admin's v4 credential path is…
b6c17d9
… off-loaded

The Error-model section still named BaseResource as "the exception" that "composes v4
headers on the calling thread" and said it was "tracked as a follow-up". This PR is that
follow-up: BaseResource.computeAuthHeaders now runs the v4 composition on the bounded
authentication executor the owning PulsarAdmin lends each resource, falling back to the
shared pool for a resource built outside one. Leaving a closed follow-up recorded as
open understates what shipped and makes the surrounding normative sentence read as
false when it is now true.

Assisted-by: Claude Code (Opus 5)
lhotari added 3 commits August 20, 2026 03:19
@lhotari
[fix][proxy] PIP-478: resolve the proxy's broker-client credential of…
7c0009a
…f the event loop

DirectProxyHandler.channelActive called the v4 authentication plugin inline —
getAuthData() then authenticate(INIT_AUTH_DATA) — on the thread delivering the
channel-active event, and handleAuthChallenge did the same for every challenge
round. That is arbitrary plugin code: an OAuth2 token endpoint round trip, an
Athenz ZTS fetch, a GSSAPI exchange with the KDC. While it ran, every connection
multiplexed onto that Netty loop stalled — the exact hazard PIP-478 removed from
the client, left in place on the proxy because pip-478.md put the proxy's
broker-client credential I/O out of scope.

Now that the client has no synchronous path at all, keeping one here has no
justification, so the proxy drives the same v5 machinery: ProxyService owns one
V5BinaryAuthenticationDriver built from its started v4 plugin, and each backend
connection opens its own exchange against it. The exchange's calls always
off-load; with no ClientAuthenticationServices bound — the proxy is not a
PulsarClient and has no executor to lend — the work lands on the framework's
shared blocking pool, which is the case V5AuthContexts documents for exactly this
caller.

Command ordering on the channel is unchanged: the continuation is dispatched back
onto the channel's own event loop, so the connect command and auth responses are
still built and written there. A resolution failure now closes the backend channel
rather than only logging, since the proxy has no credential to send and leaving the
connection open would wait out the broker's timeout instead of letting the client
retry. The broker-pushed REFRESH sentinel starts a fresh exchange, per binary
routing rule 2, mirroring ClientCnx.

Covered by the existing proxy authentication suites, which exercise both the
connect and the REFRESH paths end to end (ProxyRefreshAuthTest,
ProxyForwardAuthDataTest, ProxyAuthenticatedProducerConsumerTest,
ProxyWithAuthorizationTest — 19 tests, all passing). A dedicated assertion that no
credential call lands on a proxy IO thread is still worth adding.
@lhotari
[fix][proxy] PIP-478: serialize and bound the proxy's broker-client a…
f1bce5b
…uth rounds

AuthenticationExchange is single-round and non-thread-safe, and its javadoc makes
serializing rounds the caller's obligation. DirectProxyHandler became its second
caller after ClientCnx and did not honour it: while the frame decoder is still
running (state Init), two challenge frames delivered in one read reach
handleAuthChallenge in the same event-loop turn, before either resolution has
completed, and both drive the same exchange. A challenge arriving while a round is
in flight is now dropped, which makes rounds strictly serialized — so this class
needs none of the generation guarding ClientCnx carries, because nothing left can
supersede an in-flight round. ClientCnx needs it only because it lets a REFRESH
supersede one; the proxy can drop a REFRESH instead, both because it cannot reach
this handler (the connection stops decoding after the handshake) and because the
broker's refresh check is a scheduleAtFixedRate task that re-sends on the next tick.

Also bounds the exchange with MAX_AUTH_CHALLENGE_ROUNDS, mirroring ClientCnx: a
broker that answers every CommandAuthResponse with another challenge would otherwise
loop against the proxy forever, and each round now also schedules credential work
onto a blocking pool.

getProxyClientAuthenticationDriver() now reads the memoized driver lock-free and
synchronizes only on the miss, as ClientCnx.resolveAuthDriver does: every backend
channelActive would otherwise take the ProxyService monitor, which is shared with the
metrics-servlet accessors. The field is volatile accordingly.

Adds DirectProxyHandlerAuthTest, which builds ProxyBackendHandler on an
EmbeddedChannel — whose event loop runs a submitted task only when the test asks it
to, turning "on the event loop or off it" from a race into an assertion, and letting
a challenge be delivered while a resolution is deliberately still pending. All four
tests are mutation-verified: inlining either v4 credential call fails its off-load
test alone with the event-loop thread recorded; removing the drop guard or the round
cap fails its own test alone.

Smaller review points: the discarded whenCompleteAsync future and the inactive-channel
early return now say what they are, and a comment records why the auth method name is
read from the v4 plugin rather than from the exchange.

Assisted-by: Claude Code (Opus 5)
@lhotari
[improve][pip] PIP-478: move the proxy data path out of Out of Scope
6fc324e
Out of Scope still said DirectProxyHandler "resolves the credential inline on the
proxy's Netty loop, on connect and on the broker's refresh sentinel", and that closing
it "requires an async rework of that inline getAuthData()". This PR is that rework, so
the scope contract the PIP was voted on now understates what shipped: an operator
reading it would believe a proxy configured with OAuth2 or Athenz still stalls its event
loop on every backend connect and every refresh sentinel, and might keep sizing around a
hazard that is gone. It also left the serialization and round-cap invariants this PR
adds to DirectProxyHandler with no design text behind them.

The bullet now describes what the data path does -- a per-connection exchange on the
ProxyService-owned V5BinaryAuthenticationDriver, the continuation dispatched back to the
channel's event loop, serialize-or-drop challenge rounds, the shared round cap -- and
keeps only the three items still genuinely deferred: neither proxy leg binds the
framework HTTP client factory, both use the shared library-owned pool rather than a
client-owned bounded executor, and the proxy startup ordering is unchanged. Retitled
accordingly, since the credential I/O itself is no longer the gap.

Assisted-by: Claude Code (Opus 5)
@github-actions github-actions Bot added the PIP label Aug 20, 2026
This was referenced Aug 20, 2026
[improve][misc] PIP-478: close out the migration follow-ups, add the JCA provider keys, and reconcile the PIP apache/pulsar#26326
Merged
[fix][admin] PIP-478: off-load the admin's v4 credential and lend it a bounded auth executor apache/pulsar#26327
Merged
[fix][proxy] PIP-478: resolve the proxy's broker-client credential off the event loop apache/pulsar#26328
Merged
@lhotari lhotari closed this Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

PIP

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@lhotari
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.