[rest] Add view penetration endpoint for table access via view#8112
Open
JingsongLi wants to merge 9 commits into
Open
[rest] Add view penetration endpoint for table access via view#8112JingsongLi wants to merge 9 commits into
JingsongLi wants to merge 9 commits into
Conversation
Add POST /v1/{prefix}/databases/{db}/tables/{table}/via/{via_db}/{via_object}
endpoint that enables view penetration: if the caller has permission on a view,
they can access the underlying table referenced by that view.
This API can only be called by trusted engines. The server must authenticate
whether the caller is a trusted engine.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Mirror the Java implementation in Python: - ResourcePaths: add table_via() path method - RESTApi: add get_table_via() client method - Catalog: add get_table_via() with default fallback to get_table() - RESTCatalog: override to call the new REST endpoint Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Test cases: - testGetTableVia: verifies table can be retrieved via view - testGetTableViaWhenTableNotExist: verifies TableNotExistException - testGetTableViaWhenTableNoPermission: verifies TableNoPermissionException Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Test cases: - test_get_table_via: verifies table can be retrieved via view - test_get_table_via_with_string_identifier: verifies string identifiers work - test_get_table_via_not_exist: verifies TableNotExistException Also adds _table_via_handle to test REST server mock. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The via path /databases/{db}/tables/{table}/via/{via_db}/{via_object}
splits into 6 segments, not 5.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- path_parts length should be 6, not 5 - Remove extra blank line (E303) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove table.name() calls (FileStoreTable has no name method) - Fix TableNotExistException import from catalog_exception module Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
Thanks for adding this endpoint. Two things should be addressed before merge:
|
- Override getTableVia in PrivilegedCatalog to wrap FileStoreTable
in PrivilegedFileStoreTable, matching the getTable pattern
- Add /via/{viaDatabase}/{viaObject} endpoint to OpenAPI spec
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
POST /v1/{prefix}/databases/{db}/tables/{table}/via/{via_db}/{via_object}REST endpoint for view penetrationgetTableVia(Identifier table, Identifier via)default method toCataloginterface (defaults togetTable(table))RESTCatalogto call the new REST endpoint, and delegate inDelegateCatalogCatalog,RESTCatalog,RESTApi,ResourcePaths)Test plan
testGetTableVia,testGetTableViaWhenTableNotExist,testGetTableViaWhenTableNoPermissiontest_get_table_via,test_get_table_via_with_string_identifier,test_get_table_via_not_exist🤖 Generated with Claude Code