Skip to content

Route table-like authorization through authorize(state, request) - #5170

Open
ZephyrYWZhou wants to merge 1 commit into
apache:mainfrom
ZephyrYWZhou:migrate-authz-tablelike-to-authorize
Open

Route table-like authorization through authorize(state, request)#5170
ZephyrYWZhou wants to merge 1 commit into
apache:mainfrom
ZephyrYWZhou:migrate-authz-tablelike-to-authorize

Conversation

@ZephyrYWZhou

@ZephyrYWZhou ZephyrYWZhou commented Jul 28, 2026

Copy link
Copy Markdown

Summary

This is the first preparatory PR to migrate authorizeOrThrow to authorize .

This PR migrates CatalogHandler.authorizeResolvedBasicTableLikeOperationOrThrow to obtain its authorization decision from the decision-native PolarisAuthorizer.authorize(AuthorizationState, AuthorizationRequest) path (via the throwing authorizeOrThrow(state, request) convenience wrapper) instead of the legacy resolved-path authorizeOrThrow(principal, activatedEntities, op, target, secondary) overload.

Why this method first

authorizeResolvedBasicTableLikeOperationOrThrow is the most widely used table-like authorization method — loadTable, loadCredentials, loadView, dropTable, commitView, and others all flow through it (directly or via resolveAndAuthorizeBasicTableLikeOperationOrThrow).

The resolution manifest is already populated by resolveBasicTableLikeTargetOrThrow before this method runs, so the authorizer re-resolves the same table-like securable from the request intent with no manifest changes required. This makes it the safest, highest-leverage starting point.

Changes

  • CatalogHandler.javaauthorizeResolvedBasicTableLikeOperationOrThrow now builds an AuthorizationRequest (single SingleTargetAuthorizationIntent) and calls authorizer().authorizeOrThrow(state, request). The existing null-check guard is retained so a missing entity still surfaces as a not-found (404) response rather than a server error from the authorizer's re-resolution.
  • IcebergCatalogHandlerTest.java — updated loadCredentialsFallbackResolvesOnceThenAuthorizesReadDelegation to stub/verify the decision-native authorizeOrThrow(state, request) path (matched by the request intent's operation) instead of the legacy overload; added a small requestWithOperation(...) argument-matcher helper.

Behavior

No behavioral change. Every table-like operation that flows through this method still throws ForbiddenException on denial (the wrapper delegates to authorize(...) and throws when not allowed), and loadTable/loadCredentials keep their existing write-delegation-probe → read-delegation-fallback control flow.

Testing

  • IcebergCatalogHandlerTest (mock-based) passes.
  • Real-PolarisAuthorizerImpl authz suites that exercise allow/deny through this method all pass with no changes required: IcebergCatalogHandlerAuthzTest (6921), IcebergCatalogHandlerNoSqlAuthzTest (6921), IcebergCatalogHandlerFineGrainedDisabledTest (107), PolarisGenericTableCatalogHandlerAuthzTest (538), PolicyCatalogHandlerAuthzTest (1518) — 0 failures.

Checklist

  • 🛡️ Not a security issue
  • 🔗 Resolves the existing TODO in IcebergCatalogHandler
  • 🧪 Updated existing tests to cover the new authorize() path
  • 💡 Added Javadoc for the new helper
  • 🧾 No CHANGELOG update required (internal refactoring)
  • 📚 No documentation update required

Migrate authorizeResolvedBasicTableLikeOperationOrThrow in CatalogHandler
to obtain its authorization decision from the decision-native
PolarisAuthorizer.authorize(AuthorizationState, AuthorizationRequest) path
(via the throwing authorizeOrThrow(state, request) convenience wrapper)
instead of the legacy resolved-path authorizeOrThrow overload.

This is a small, behavior-preserving preparatory step toward migrating all
callers off the legacy authorizeOrThrow overloads so those overloads can be
removed. The resolution manifest is already populated by
resolveBasicTableLikeTargetOrThrow, so the authorizer re-resolves the same
table-like securable from the request intent. The existing null-check guard
is retained so a missing entity still surfaces as a not-found (404) response
rather than a server error from the authorizer's re-resolution.

All table-like operations that flow through this method (loadTable,
loadCredentials, loadView, dropTable, etc.) still throw ForbiddenException on
denial, so behavior is unchanged.

Update IcebergCatalogHandlerTest#loadCredentialsFallbackResolvesOnceThenAuthorizesReadDelegation
to stub/verify the decision-native authorizeOrThrow(state, request) path
(matching the request intent's operation) instead of the legacy overload.
@ZephyrYWZhou

Copy link
Copy Markdown
Author

Tagging @dimas-b for review on this PR as the first preparatory PR of the migration efforts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant