You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Follow-up to #5486: thread resolved paths into findMissingPrivileges and let AuthorizationIntent expose its own securables #5491
#5486 extracted the intent-to-resolved-path translation shared by PolarisAuthorizerImpl and RangerPolarisAuthorizer into a single AuthorizationIntentResolver (behavior-preserving). During that review (and tracked in the now-closed #5485), two follow-up refactors were identified.
1. Thread the resolved targets/secondaries into findMissingPrivileges()
Per @flyrain's review comment on #5486: in PolarisAuthorizerImpl, the resolved targets / secondaries should be passed down into findMissingPrivileges() rather than being consumed implicitly, since the structure of targets and secondaries may evolve. This keeps the RBAC evaluation explicit about the resolved paths it operates on and makes future changes to that structure localized.
2. Let each AuthorizationIntent expose its own securables
Today AuthorizationIntentResolver.resolve(...) dispatches over the seven sealed AuthorizationIntent types with an if/else if chain to pull out each intent's target/secondary securables. If each AuthorizationIntent instead exposed its own securables (e.g. targetSecurables() / secondarySecurables()), the resolver could iterate uniformly and the per-type dispatch would go away entirely.
Benefits:
Removes the dispatch chain from the resolver.
Provides compile-time exhaustiveness: a new AuthorizationIntent type must supply its securables, so it cannot be silently missed (the current else branch throws IllegalStateException only at runtime).
Works at polaris-core's --release 17 level, so it does not depend on a Java 21 pattern switch.
The two "root container as target" intents (TargetlessAuthorizationIntent when rooted, and RootPrivilegeGrantAuthorizationIntent) do not map to a PolarisSecurable, so a small explicit representation for that case would still be needed.
Acceptance Criteria
findMissingPrivileges() receives the resolved targets/secondaries explicitly.
(Optionally, may be split into its own PR) The per-type dispatch in AuthorizationIntentResolver is replaced by having each AuthorizationIntent expose its securables, with the root-container cases handled explicitly.
Behavior-preserving; existing authorization suites (PolarisAuthorizerImplTest, the runtime-service catalog handler authz tests, the Ranger unit tests + intTest, and the OPA tests) plus AuthorizationIntentResolverTest continue to pass.
Activity