[rest] Add view penetration endpoint for table access via view#8112
[rest] Add view penetration endpoint for table access via view#8112JingsongLi 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>
|
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>
|
I think At For view penetration, the read path probably needs to preserve the |
|
Considering the acquisition of tokens, I feel that using identifiers like system tables may be a simpler approach.. |
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