roryqi opened a new issue, #14995:
URL: https://github.com/apache/gravitino/issues/14995

   ### Version
   
   main branch, source inspected at `1c7623b898e57eb7901a4a738727aa68fb314a77`.
   
   ### Describe what's wrong
   
   Several Iceberg catalog paths apply inconsistent name, location and 
authorization checks:
   
   | Case | Current behavior | Expected behavior |
   | --- | --- | --- |
   | Drop an existing long namespace | A namespace longer than 64 characters 
can be created through Iceberg REST and loaded through Gravitino, but Gravitino 
rejects its deletion using create-time name validation. | Apply existing-object 
name rules and case normalization when dropping it; retain create-time 
restrictions for new names. |
   | Create or relocate a table over another table's storage location | Create 
checks privileges on the destination namespace, without checking access to 
existing tables at overlapping locations. A caller can become owner of a new 
table at another table's location and obtain credentials for that location. The 
ordinary set-location path also lacks overlap authorization. | Require access 
to every overlapping source table before accepting an explicit location, 
including staged creation and location changes. Return 403 without disclosing 
inaccessible table identities. Compare whole path segments. |
   | Register a table in a large catalog | RegisterTableSourceResolver 
recursively lists all namespaces/tables and reads existing tables' metadata 
files when current metadata pointers do not match. One unrelated unreadable 
metadata file can fail registration. | Preserve source authorization while 
avoiding a storage read for every table on each registration. |
   | Use a local path in a remote-warehouse catalog | Default ResolvingFileIO 
can select HadoopFileIO for file: URIs and paths without a scheme. The existing 
S3 scheme check only applies to an explicitly configured S3FileIO. A table 
create can therefore write metadata on the server's local disk. | Reject 
client-supplied local locations with 400 before creating or staging a table. 
Cover namespace locations, registration, location changes and metadata/data 
write-path overrides while retaining remote multi-storage support and 
local-warehouse development use. |
   
   The long-name and overlap/registration findings above are based on source 
inspection. The default-FileIO local-create behavior was also reproduced 
locally with a JDBC catalog and an S3 warehouse; no deployed-service latency 
benchmark is claimed here.
   
   ### Error message and/or stacktrace
   
   - Long namespace drop: `IllegalArgumentException: The SCHEMA name '...' is 
illegal.`
   - Overlapping and local-location creates can succeed instead of being 
refused.
   - Registration propagates storage failures from other tables encountered 
during the source scan.
   
   ### How to reproduce
   
   1. Create a namespace with a 65-character name through Iceberg REST. Load it 
through the Gravitino schema API, then delete it through that API. Compare with 
a 64-character name.
   2. With authorization and credential vending enabled, create a protected 
table as one user. As a user with CREATE_TABLE in another namespace but no load 
access to the protected table, create a table with the protected table's 
location, a child location, or a parent location. Request vended credentials 
for the new table. Also test staged creation and set-location on a table owned 
by the caller.
   3. Register a metadata file in a catalog with many tables and count storage 
metadata reads. Repeat while an unrelated existing table has unreadable 
metadata.
   4. Configure a JDBC catalog with an S3 warehouse and leave io-impl unset. 
Create and stage tables with file:///tmp/gravitino-location-test or a bare 
local path. Inspect whether metadata files are written locally.
   
   ### Additional context
   
   The source check introduced by #14441 / #14482 must remain effective. It 
currently matches metadata pointers, UUIDs and exact table locations, but does 
not cover create-table or parent/child location overlap. Related location 
validation work: #14765 / #14766.
   
   Metadata pointers alone cannot reliably identify table roots. For example, a 
valid table may have:
   
   ```text
   location = s3://bucket/protected/table
   write.metadata.path = s3://bucket/shared/metadata
   metadata_location = s3://bucket/shared/metadata/00001-example.metadata.json
   ```
   
   Treating every pointer containing /metadata/ as a standard layout infers the 
wrong table root. A candidate query restricted to the requested location and 
its parents, plus pointers without /metadata/, misses this table. An in-memory 
SQL counterexample confirms the miss for equal, parent and child locations.
   
   Caching immutable metadata by pointer can reduce repeated reads, but does 
not make that candidate filter complete. Skipping unreadable potential sources 
would weaken authorization. A complete optimization needs authoritative 
location/identity information, a safe fallback for unknown layouts, and 
consistency with metadata-pointer changes.
   
   Relevant code: SchemaNormalizeDispatcher.dropSchema, 
RegisterTableSourceResolver, RegisterTableAuthzHandler, 
IcebergTableOperations.createTable and 
IcebergCatalogWrapper.validateTableLocation. Iceberg's 
BaseMetastoreTableOperations explicitly supports custom write.metadata.path 
values.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to