Repository navigation
Cherry pick #111483 to 26.6: Restrict local object access only for user files path - #112257
Conversation
`resolvePathRelativelyToBase` was joining the incoming path onto `key_prefix` (`norm_base / path`) and returning the canonicalized result. This was wrong on two counts: - `remote_path` produced by `MetadataStorageFromPlainObjectStorage` already contains `key_prefix` (it is `ObjectStorageKey::createAsRelative` serialized), so joining it again doubled the prefix. - Returning the canonical absolute path changed the string form that `listObjects` reports as `relative_path`. `listDirectory` then hit `chassert(p.find(absolute_key) == 0)` and aborted, crashing `MetadataPlainDiskTest.RemoveDirectoryNonEmpty` in the unit tests. It also broke `remove_orphan_files`, which compares listed paths against manifest paths verbatim: a table reached through a symlink resolving inside `user_files` would have live files misclassified as orphans. Instead, validate the path as-is against the canonical base (so `..` and symlinks that escape are still rejected with `PATH_ACCESS_DENIED`) and return the original path unchanged, preserving the form callers expect. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=111483&sha=fd80c3406a6e7344ef18d69567ad55bf69c93cab&name_0=PR&name_1=Unit%20tests%20%28tsan%29 PR: #111483 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Restrict local object access only for user files path
|
Dear @SmitaRKulkarni, @scanhex12, this cherry-pick PR has not been updated for 3d0h55m38s. Please resolve the conflicts to backport #111483, or close this PR if the backport is no longer needed. This PR will be automatically closed after 7 days of inactivity. |
|
Dear @SmitaRKulkarni, @scanhex12, this cherry-pick PR has not been updated for 7d0h8m11s. Closing automatically. If you still want to backport #111483, please resolve the conflicts and reopen this PR. |
|
Dear @SmitaRKulkarni, @scanhex12, this PR is opened while #111483 was marked as backported. The If the cherry-pick is not needed anymore, then just close this PR. |
2 similar comments
|
Dear @SmitaRKulkarni, @scanhex12, this PR is opened while #111483 was marked as backported. The If the cherry-pick is not needed anymore, then just close this PR. |
|
Dear @SmitaRKulkarni, @scanhex12, this PR is opened while #111483 was marked as backported. The If the cherry-pick is not needed anymore, then just close this PR. |
Original pull-request #111483
Do not merge this PR manually
This pull-request is a first step of an automated backporting.
It contains changes similar to calling
git cherry-picklocally.If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.
The check results does not matter at this step - you can safely ignore them.
Troubleshooting
If the conflicts were resolved in a wrong way
If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job