Skip to content

Cherry pick #111483 to 26.3: Restrict local object access only for user files path - #112254

Merged
scanhex12 merged 14 commits into
backport/26.3/111483from
cherrypick/26.3/111483
Aug 12, 2026
Merged

scanhex12 merged 14 commits into
backport/26.3/111483from
cherrypick/26.3/111483

Conversation

@robot-clickhouse

Copy link
Copy Markdown
Member

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-pick locally.
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:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

scanhex12 and others added 13 commits July 22, 2026 21:04
`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
@robot-clickhouse robot-clickhouse added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request pr-critical-bugfix labels Jul 28, 2026
@robot-clickhouse-ci-2

Copy link
Copy Markdown
Contributor

Dear @SmitaRKulkarni, @scanhex12, this cherry-pick PR has not been updated for 3d0h56m47s. 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.

@robot-clickhouse-ci-1

Copy link
Copy Markdown
Contributor

Dear @SmitaRKulkarni, @scanhex12, this cherry-pick PR has not been updated for 7d0h8m6s. Closing automatically. If you still want to backport #111483, please resolve the conflicts and reopen this PR.

@robot-clickhouse

Copy link
Copy Markdown
Member Author

Dear @SmitaRKulkarni, @scanhex12, this PR is opened while #111483 was marked as backported. The pr-backports-created is removed, so the original PR can be processed again.

If the cherry-pick is not needed anymore, then just close this PR.

2 similar comments
@robot-ch-test-poll3

Copy link
Copy Markdown
Contributor

Dear @SmitaRKulkarni, @scanhex12, this PR is opened while #111483 was marked as backported. The pr-backports-created is removed, so the original PR can be processed again.

If the cherry-pick is not needed anymore, then just close this PR.

@robot-ch-test-poll

Copy link
Copy Markdown
Contributor

Dear @SmitaRKulkarni, @scanhex12, this PR is opened while #111483 was marked as backported. The pr-backports-created is removed, so the original PR can be processed again.

If the cherry-pick is not needed anymore, then just close this PR.

@scanhex12
scanhex12 merged commit 6a495a6 into backport/26.3/111483 Aug 12, 2026
@scanhex12
scanhex12 deleted the cherrypick/26.3/111483 branch August 12, 2026 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! pr-critical-bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants