Skip to content

Support access delegation in registerTable - #3734

Merged
adutra merged 1 commit into
apache:mainfrom
adutra:feature/iceberg-1.11-register-table-access-delegation
Jun 5, 2026
Merged

adutra merged 1 commit into
apache:mainfrom
adutra:feature/iceberg-1.11-register-table-access-delegation

Conversation

@adutra

@adutra adutra commented Feb 10, 2026 •

Copy link
Copy Markdown
Contributor

This PR introduces support for access delegation in the registerTable endpoint.

Four new authorizable operations are introduced:

  • REGISTER_TABLE_WITH_READ_DELEGATION: requires TABLE_CREATE + TABLE_READ_DATA
  • REGISTER_TABLE_WITH_WRITE_DELEGATION: requires TABLE_CREATE + TABLE_WRITE_DATA
  • REGISTER_TABLE_OVERWRITE_WITH_READ_DELEGATION: requires TABLE_FULL_METADATA+ TABLE_READ_DATA
  • REGISTER_TABLE_OVERWRITE_WITH_WRITE_DELEGATION: requires TABLE_FULL_METADATA + TABLE_WRITE_DATA

The implementation is inspired by the loadTable endpoint; the authorization checks are very similar.

Checklist

  • 🛡️ Don't disclose security issues! (contact [email protected])
  • 🔗 Clearly explained why the changes are needed, or linked related issues: Fixes #
  • 🧪 Added/updated tests with good coverage, or manually tested (and explained how)
  • 💡 Added comments for complex logic
  • 🧾 Updated CHANGELOG.md (if needed)
  • 📚 Updated documentation in site/content/in-dev/unreleased (if needed)

@github-project-automation github-project-automation Bot moved this to PRs In Progress in Basic Kanban Board Feb 10, 2026
@adutra
adutra force-pushed the feature/iceberg-1.11-register-table-access-delegation branch from c964522 to 878e6c1 Compare February 10, 2026 20:45
@adutra
adutra force-pushed the feature/iceberg-1.11-register-table-access-delegation branch from 878e6c1 to 2ad57d8 Compare March 5, 2026 17:48
@adutra

adutra commented Mar 5, 2026

Copy link
Copy Markdown
Contributor Author

Rebased to fix conflicts.

@adutra

adutra commented Mar 5, 2026

Copy link
Copy Markdown
Contributor Author

For some reason, CI is not running for this PR 🤷‍♂️

@adutra
adutra force-pushed the feature/iceberg-1.11-register-table-access-delegation branch 2 times, most recently from 9b17f73 to 078ae3c Compare March 5, 2026 18:02
@adutra

adutra commented Mar 5, 2026

Copy link
Copy Markdown
Contributor Author

Now it's running 😅 🤷‍♂️

@adutra
adutra force-pushed the feature/iceberg-1.11-register-table-access-delegation branch from 078ae3c to f2298d8 Compare March 11, 2026 17:29
@adutra

adutra commented Mar 11, 2026

Copy link
Copy Markdown
Contributor Author

FYI I had to rebase and change the implementation due to #3719.

@sririshindra and @flyrain since you authored/reviewed #3719, could you review this one please?

}

@TestFactory
Stream<DynamicNode> testLoadTablePrivileges() {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I moved this test down below because it was misplaced.

@adutra
adutra requested review from dimas-b, flyrain and snazy and removed request for flyrain March 16, 2026 13:39
@github-project-automation github-project-automation Bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board Mar 16, 2026
dimas-b
dimas-b previously approved these changes Mar 17, 2026
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions Bot added the stale label May 12, 2026
flyrain
flyrain previously approved these changes May 13, 2026

@flyrain flyrain left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Lefts minor questions and comments.

Comment on lines +132 to +135
REGISTER_TABLE_WITH_READ_DELEGATION(EnumSet.of(TABLE_CREATE, TABLE_READ_DATA)),
REGISTER_TABLE_WITH_WRITE_DELEGATION(EnumSet.of(TABLE_CREATE, TABLE_WRITE_DATA)),
REGISTER_TABLE_OVERWRITE_WITH_READ_DELEGATION(EnumSet.of(TABLE_FULL_METADATA, TABLE_READ_DATA)),
REGISTER_TABLE_OVERWRITE_WITH_WRITE_DELEGATION(EnumSet.of(TABLE_FULL_METADATA, TABLE_WRITE_DATA)),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These looks correct to me, they are also consistent with the table creation operations. cc @collado-mike @dennishuo @singhpk234

identifier, metadata, delegationModes, actionsRequested, refreshCredentialsEndpoint)
.build();
}
throw new IllegalStateException("Cannot wrap catalog that does not produce BaseTable");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This message is confusing, how about the following:

  throw new IllegalStateException(
      "Expected a BaseTable object from registerTable() for %s, got: %s"
          .formatted(identifier, table.getClass().getName()));

Not a blocker since this PR doesn't touch it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I agree that the current message is cryptic, but your suggestion leaks internal implementation details to clients, so I'm a bit reluctant to follow it.

OTOH, this throw statement is imho never reached in practice.

How about:

throw new IllegalStateException(
        "Cannot register table %s: unknown table format".formatted(identifier));

?

.build();
}

throw new IllegalStateException("Cannot wrap catalog that does not produce BaseTable");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This message is confusing, how about the following:

  throw new IllegalStateException(
      "Expected a BaseTable object from registerTable() for %s, got: %s"
          .formatted(identifier, table.getClass().getName()));

It'd be nice to fix in this PR, but not a blocker since this PR follows the previous pattern.

authorizeCreateTableLikeUnderNamespaceOperationOrThrow(readOp, tableIdentifier);
}

checkAllowExternalCatalogCredentialVending(delegationModes);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A question: do we support register table in the remote catalogs?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, for non-overwrite scenarios only.

@adutra

adutra commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

FYI: with the release of Iceberg 1.11, I am going to attempt to change the base branch of this PR from feature/iceberg-1.11 to main. Pray for me 😅

@adutra
adutra changed the base branch from feature/iceberg-1.11 to main May 20, 2026 12:45
@adutra
adutra dismissed stale reviews from flyrain and dimas-b May 20, 2026 12:45

The base branch was changed.

Copilot AI review requested due to automatic review settings May 20, 2026 13:29
@adutra
adutra force-pushed the feature/iceberg-1.11-register-table-access-delegation branch from 76ca5cf to c970093 Compare May 20, 2026 13:29
@adutra
adutra marked this pull request as draft May 20, 2026 13:30
@adutra

adutra commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

FYI I successfully changed the base branch to main and updated the PR.

However, since this PR depends on #4506, I switched it back to draft for now.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the Iceberg REST registerTable flow to support access delegation (credential vending) and adds overwrite semantics (overwrite=true) for internal Polaris catalogs, including new RBAC authorizable operations and accompanying tests/docs.

Changes:

  • Add new RBAC operations for registerTable with read/write delegation and for overwrite variants, and wire them into authorization semantics.
  • Implement registerTable access delegation + internal-catalog overwrite handling in the service layer and REST adapter.
  • Add unit/integration tests for overwrite behavior and access-delegation responses; document federation limitation and update the changelog.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
site/content/in-dev/unreleased/federation/iceberg-rest-federation.md Document that overwrite=true registration is rejected for federated external catalogs.
runtime/service/src/test/java/org/apache/polaris/service/catalog/iceberg/AbstractIcebergCatalogTest.java Add unit tests for internal-catalog overwrite registration behavior.
runtime/service/src/test/java/org/apache/polaris/service/catalog/iceberg/AbstractIcebergCatalogHandlerAuthzTest.java Add authz coverage for new register/overwrite + delegation operations.
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java Implement registerTable delegation/overwrite flow and new authorization routing.
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogAdapter.java Parse delegation header and pass delegation modes + refresh endpoint to handler.
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java Add overwrite-capable registerTable(..., boolean overwrite) implementation.
polaris-core/src/main/java/org/apache/polaris/core/auth/RbacOperationSemantics.java Map new authorizable operations to required privileges.
polaris-core/src/main/java/org/apache/polaris/core/auth/PolarisAuthorizableOperation.java Introduce new authorizable operation enum values for register/overwrite + delegation.
integration-tests/src/main/java/org/apache/polaris/service/it/test/PolarisRestCatalogIntegrationBase.java Add integration tests for registerTable credential vending and overwrite via REST.
integration-tests/src/main/java/org/apache/polaris/service/it/env/CatalogApi.java Add helper methods to register tables with/without access-delegation header.
CHANGELOG.md Record new overwrite semantics and new REGISTER_TABLE_OVERWRITE authorization operation.

@github-actions github-actions Bot removed the stale label May 31, 2026
@adutra
adutra force-pushed the feature/iceberg-1.11-register-table-access-delegation branch from fd865b4 to 1bb1e0c Compare June 2, 2026 17:51
under the License.

-->
<configuration debug="false">

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was missing and logs were being printed at DEBUG level.

@adutra
adutra marked this pull request as ready for review June 2, 2026 17:56
@adutra

adutra commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

Heads up: this is finally ready for review.

@flyrain
@sririshindra
@sneethiraj
@dimas-b
@sungwy

@adutra adutra changed the title [Iceberg 1.11] Support access delegation in registerTable Support access delegation in registerTable Jun 2, 2026
@adutra
adutra requested a review from Copilot June 2, 2026 17:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

This PR introduces support for access delegation in the `registerTable` endpoint.

Four new authorizable operations are introduced:

- `REGISTER_TABLE_WITH_READ_DELEGATION`: requires `TABLE_CREATE` + `TABLE_READ_DATA`
- `REGISTER_TABLE_WITH_WRITE_DELEGATION`: requires `TABLE_CREATE` + `TABLE_WRITE_DATA`
- `REGISTER_TABLE_OVERWRITE_WITH_READ_DELEGATION`: requires `TABLE_FULL_METADATA`+ `TABLE_READ_DATA`
- `REGISTER_TABLE_OVERWRITE_WITH_WRITE_DELEGATION`: requires `TABLE_FULL_METADATA` + `TABLE_WRITE_DATA`

The implementation is inspired by the `loadTable` endpoint; the authorization checks are very similar.
@adutra
adutra force-pushed the feature/iceberg-1.11-register-table-access-delegation branch from 1bb1e0c to 9dbdebd Compare June 3, 2026 09:50

@flyrain flyrain left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I have approved before. Approved again, thanks @adutra for wrapping this up!

@adutra
adutra merged commit 4c6bffb into apache:main Jun 5, 2026
24 checks passed
@adutra
adutra deleted the feature/iceberg-1.11-register-table-access-delegation branch June 5, 2026 11:41
@github-project-automation github-project-automation Bot moved this from Ready to merge to Done in Basic Kanban Board Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants