Repository navigation
Description
Background
After #5194, each PolarisAuthorizer implementation resolves an AuthorizationRequest's intents into resolved entity paths on its own, so it can choose what to resolve. As a result, the mechanical mapping from an AuthorizationIntent to its resolved target/secondary paths is now duplicated verbatim in two authorizers:
PolarisAuthorizerImpl(built-in RBAC,polaris-core)RangerPolarisAuthorizer(Apache Ranger extension)
Both contain the same per-intent-type dispatch over the 7 sealed AuthorizationIntent types plus identical private helpers getResolvedSecurable(...) and getPathNamesWithinCatalog(...).
This was raised while reviewing #5170 (which was superseded by #5194); the suggestion there was to file a follow-up PR to deduplicate the shared resolution logic.
Problem
The intent-to-resolved-path translation is correctness-sensitive and drift-prone:
getResolvedSecurableencodes which resolution-manifest lookup applies per entity type (CATALOG→ reference catalog, top-level → top-level entity, else → resolved path), andgetPathNamesWithinCatalogstrips the catalog segment before lookup.- Because the logic is copy-pasted, a change to the resolution rules or the addition of a new intent type can be applied to one authorizer and missed in the other, producing an authorization inconsistency between the built-in and Ranger paths. This has already shown up as a maintenance cost: the
CATALOGbranch ingetResolvedSecurablehad to be added to both copies.
Proposal
Extract the shared translation into a single AuthorizationIntentResolver in org.apache.polaris.core.auth:
ResolvedIntent resolve(PolarisResolutionManifest manifest,
AuthorizationIntent intent,
boolean prependRootContainer)
- Authorizer-specific concerns stay in each authorizer: the operation-semantics / rooting decision (each authorizer computes and passes its own
prependRootContainer), the terminal decision call (authorizeRbacOrThrowvsauthorizeRangerOrThrow), and exception handling. - The change is behavior-preserving; the existing authorization test suites are the safety net.
OpaPolarisAuthorizer is out of scope: it maps intents to its own ResourceEntity model and ships them to an external OPA server, so it does not perform resolution-manifest path resolution.
Acceptance Criteria
- A shared
AuthorizationIntentResolverinpolaris-coreis used by bothPolarisAuthorizerImplandRangerPolarisAuthorizer; the duplicated private helpers are removed. - No behavior change: existing authz suites pass (
PolarisAuthorizerImplTest, the runtime-service catalog handler authz tests, the Ranger unit tests +intTest, and the OPA tests). polaris-coreremains Java 17 source-compatible.
Possible follow-up (out of scope for this issue)
Consider moving securable naming onto the AuthorizationIntent types themselves (each intent exposes its own target/secondary securables). That would remove the per-type dispatch entirely and provide compile-time exhaustiveness for future intent types, without requiring a Java 21 pattern switch (which polaris-core cannot use since it compiles with --release 17).
Activity
ZephyrYWZhou commentedon Sep 10, 2026
Follow-up note (from the #5486 review): @flyrain suggested passing the resolved targets/secondaries down into
PolarisAuthorizerImpl.findMissingPrivileges(), since the structure of targets and secondaries may change in the future.This followup refactor is to be picked up right after #5486 merges, alongside the "let each
AuthorizationIntentexpose its own securables" refactor already noted above.