Repository navigation
Revert "Require the FILE source grant for an EmbeddedRocksDB table with an explicit rocksdb_dir" - #117651
Conversation
…th an explicit rocksdb_dir"
|
Workflow [PR], commit [aecef40] AI ReviewSummaryThis PR reverts the recently added Findings❌ Blockers
Final Verdict❌ Changes requested |
|
I think the issue is the test cannot run in parallel, but it didn't fail in the PR? |
| /// An explicit `rocksdb_dir` opens a directory under `user_files_path` and needs the same `FILE` grant | ||
| /// as `file`; the argument-less form touches only the table's own data directory, and `clickhouse-local` | ||
| /// has no `user_files` fence to authorize. A replayed definition was authorized when it was introduced. | ||
| auto local_context = args.getLocalContext(); | ||
| const bool from_existing_metadata = isLoadingFromExistingMetadata(args.mode) || args.query.attach_short_syntax; | ||
| if (!rocksdb_dir.empty() && !from_existing_metadata | ||
| && local_context->getApplicationType() != Context::ApplicationType::LOCAL) | ||
| { | ||
| const AccessFlags required | ||
| = read_only ? AccessFlags(AccessType::READ) : (AccessType::READ | AccessType::WRITE); | ||
| local_context->checkAccess(required, toStringSource(AccessTypeObjects::Source::FILE)); |
There was a problem hiding this comment.
This check is the only thing that prevents EmbeddedRocksDB(..., rocksdb_dir, ...) from becoming an unguarded server-side file opener. The constructor still resolves a relative rocksdb_dir under user_files_path, and initDB still opens that directory immediately, so after this revert any user who can CREATE TABLE with EmbeddedRocksDB can point a new table at another RocksDB directory under user_files and read it through their own table. In writable mode they can also mutate it with INSERT/DELETE/TRUNCATE.
If 05054_embedded_rocksdb_explicit_dir_file_grant.sh is flaky, the fix needs to be in the test. Dropping the READ/WRITE ON FILE gate for fresh CREATE, full ATTACH, and RESTORE definitions reopens the privilege bypass that the deleted test was covering.
|
The The mechanism: the test's RESTORE arm has a restricted user run The enforcement reverted here was itself sound, and its PR description documents the bypass it closed (reopening another user's RocksDB directory under |
Reverts #117428
Workflow [PR]
Sync PR [sync-upstream/pr/117651]
Version info
26.9.1.530(included in26.9and later)