Skip to content

P09: Port SPIFFE identity compatibility to ZooKeeper 3.8.7 - #185

Merged
bellatrix007 merged 2 commits into
adbansal/zk-387-p08-tls-defaultsfrom
adbansal/zk-387-p09-spiffe-identity
Dec 3, 2026
Merged

bellatrix007 merged 2 commits into
adbansal/zk-387-p08-tls-defaultsfrom
adbansal/zk-387-p09-spiffe-identity

Conversation

@bellatrix007

@bellatrix007 bellatrix007 commented Nov 23, 2026 •

Copy link
Copy Markdown

Description

Port #142, #149 and #158 to ZooKeeper 3.8.7, stacked on #184:

  • Extract typed SPIFFE v1/v2 identities from certificate URI SANs, with the existing legacy SAN/Subject DN fallback.
  • Allow eligible SPIFFE application identities to match legacy service-principal ACLs, mappings and superuser settings without granting reverse legacy-to-SPIFFE aliases.
  • Store the legacy x509:servicePrincipal(<app> creator ACL form when setX509ClientIdAsAcl is enabled, while retaining the original authenticated identity.
  • Carry that identity through follower/observer requests using reserved quorum metadata, removed before authorization.

Differences from branch-3.6 at 9d245933379762dc83e8f44934ac1d80b7c55897:

  • SPIFFE extraction, alias direction, creator-ACL formatting, quorum metadata, identity APIs and the basic provider's authentication method follow the fork.
  • X509AuthenticationUtil.getClientId(...) returns ClientIdentity. The basic provider uses the shared certificate-validation helper and derives identity once, without a protected custom-ID hook or special hook-compatibility branch.
  • Retain 3.8.7's basic-provider constructor/checked-exception contract, trust-manager setup, FIPS, password-file, reverse-DNS, READ/exists and watcher-ACL integration.
  • Preserve branch-3.6's volatile/non-volatile choices for X509 configuration/mapping fields, together with the original lazy-initialization rationale and SpotBugs suppressions.
  • Tests use Jupiter, target certificate helpers and additional regression cases; documentation/test examples are generic.

An unmatched optional legacy SAN capture now falls back to Subject DN as in the fork, restoring behavior missing from the earlier P03 port. This is a restoration of source behavior, not a new fallback policy.

Tests

  • Added/adapted X509AuthTest, X509SpiffeAuthIntegrationTest, X509DirectAclTest, X509CreatorAclTest, X509QuorumAuthInfoTest, QuorumX509IdentityTest, PrepRequestProcessorTest, X509GroupAclIntegrationTest, X509ZNodeGroupAclProviderTest and ZkClientUriDomainMappingHelperTest.

  • At 29284e4c, the selected baseline plus affected identity/ACL/request/TLS suites passed 234 cases per JDK on Java 8/11/17: 702 passed executions, zero failures/errors/skips/automatic reruns. The selection does not repeat every unchanged regression class from the earlier P09 runs.

  • Callers and tests use the fork's typed identity API. Only the two tests for the removed protected identity hook were removed; permission-denial and persisted-ACL controls remain.

  • Real TLS group-ACL cases use CA-signed certificates and hostname verification on dedicated and unified listeners. They inspect persisted ACLs with getACL and verify denied reads/writes. Certificate-parser tests and mocked quorum-relay tests are not presented as full-network interoperability tests.

  • Java 11 assembly, RAT, Checkstyle including test sources, and SpotBugs passed using clean package -DskipTests apache-rat:check checkstyle:check spotbugs:check -Dcheckstyle.includeTestSourceDirectory=true.

  • Base P08: Port runtime TLS defaults to ZooKeeper 3.8.7 #184 has one failed full Java 11 CI job: the pre-existing testMappingLifecycleAndReadAuthorization timed out waiting for SyncConnected after reconnect. Its duplicate full Java 11 job passed, and that case passed in this candidate's selected runs on all three JDKs. The CI timeout's cause remains unresolved; this PR does not claim to fix it.

  • Full upstream, Linux/native, deployed-client, real SPIFFE multi-server and mixed-version rolling-upgrade/rollback qualification remain separate.

  • Local code review completed

Changes that Break Backward Compatibility (Optional)

  • SPIFFE detection and eligible legacy aliases are always active, independent of the configured legacy SAN extraction mode. Legacy application-name grants and generated creator ACLs are not product/tag scoped.
  • With automatic ACL replacement enabled, new/reset eligible SPIFFE creator ACLs use the legacy service-principal form rather than the full SPIFFE ID. Existing stored ACLs are not rewritten automatically.
  • Forwarded compatibility requires both the receiving server and leader to support the reserved identity context. Missing context does not enable aliases; do not assume this behavior is qualified during a mixed-version rollout.
  • The old six-argument ZooKeeperServer.checkACL remains callable, but production requests use the request-based overload. External subclasses overriding only the old method must account for that dispatch change. This caveat also exists in the current fork; it is not a new divergence from branch-3.6.
  • X509AuthenticationUtil.getClientId(...) now returns ClientIdentity, as in the fork. Consumers of the previous String-returning helper must adapt to .getId() and recompile. This is a server-side helper API change, not a change to ordinary ZooKeeper client APIs.
  • The protected X509AuthenticationProvider.getClientId hook is removed, as in the fork. Existing custom subclasses relying on that hook must be adapted. Authentication failures now use the shared helper's logging path.

Documentation (Optional)

Updated zookeeperAdmin.md with one-way identity compatibility, creator-ACL representation, application-name scope and mixed-version quorum limits.

🤖 Generated with GitHub Copilot CLI

Aditi Bansal and others added 2 commits December 2, 2026 12:12
Port the fork's SPIFFE URI-SAN principal extraction (#142),
one-way compatibility between SPIFFE application identities and legacy
service-principal identities (#149), and legacy-form
creator ACLs for SPIFFE clients (#158).

SPIFFE v1/wl, v1 application/airflow and v2 URI SANs are extracted before
configured SAN or Subject DN extraction and are retained as typed identity
on the connection and request, including requests forwarded between quorum
peers. Eligible SPIFFE application identities may match bare or formatted
legacy service-principal ACLs, URI-domain mappings and superuser IDs; legacy
identities do not gain reverse aliases. With setX509ClientIdAsAcl enabled,
automatic ACLs store servicePrincipal(<app> for eligible SPIFFE creators.

Adapted to 3.8.7: the String X509AuthenticationUtil.getClientId methods are
kept and typed identities are exposed through getClientIdentity; the
X509AuthenticationProvider.getClientId hook and its inline certificate trust
checks are kept, and typed compatibility is used only when the hook returns
the extracted ID. The exists ACL check also uses the request identity.
Carried tests are converted to JUnit 5, with focused hook, SAN fallback and
real TLS creator ACL regressions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Return ClientIdentity from getClientId, reuse the canonical certificate authentication path, and remove the protected identity hook. Update callers, tests and documentation while preserving target TLS setup, READ checks and volatile publication.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bellatrix007
bellatrix007 force-pushed the adbansal/zk-387-p09-spiffe-identity branch from 020f3e5 to dc9dd7a Compare December 2, 2026 06:47
@bellatrix007 bellatrix007 added the upgrade-3.8.x Port of LinkedIn patches onto Apache ZooKeeper 3.8.x label Dec 2, 2026

@arkmish arkmish left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@bellatrix007
bellatrix007 merged commit b346696 into li-dev/base-3.8.7 Dec 3, 2026
37 of 40 checks passed
@bellatrix007
bellatrix007 deleted the adbansal/zk-387-p09-spiffe-identity branch December 3, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

upgrade-3.8.x Port of LinkedIn patches onto Apache ZooKeeper 3.8.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants