Skip to content

Reject the file: prefix in time zone names - #13

Merged
thevar1able merged 1 commit into
ClickHouse/2026cfrom
fix-file-prefix-bypass
Sep 21, 2026
Merged

thevar1able merged 1 commit into
ClickHouse/2026cfrom
fix-file-prefix-bypass

Conversation

@thevar1able

Copy link
Copy Markdown
Member

CheckTimeZoneName runs on the raw name, but FileZoneInfoSource::Open strips the file: prefix before it builds the path. A name such as file:/abs/path therefore passes the leading / check and opens an arbitrary absolute path, which is exactly what the carried "Prevent arbitrary file open while loading timezone" patch is meant to prevent. The prefix is a test-only interface, so reject it outright.

Adds regression tests for the previously unchecked forbidden patterns and for the file: bypass. The new test copies a zone outside of the zoneinfo directory so the rejection is not just a missing file. Verified the test fails without the fix and passes with it; the full suite passes (built with -DCMAKE_CXX_STANDARD=20, since the existing starts_with in this branch already needs C++20).

Closes: ClickHouse/ClickHouse#121367
Related: ClickHouse/ClickHouse#121325

🤖 Generated with Claude Code

`CheckTimeZoneName` runs on the raw name, but `FileZoneInfoSource::Open`
strips the `file:` prefix before it builds the path. A name such as
`file:/abs/path` therefore passes the leading `/` check and opens an
arbitrary absolute path, which is exactly what the check is meant to
prevent. The prefix is a test-only interface, so reject it outright.

Add regression tests for the previously unchecked forbidden patterns
and for the `file:` bypass, copying a zone outside of the zoneinfo
directory so the rejection is not just a missing file.

ClickHouse/ClickHouse#121367

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@thevar1able
thevar1able merged commit 820e2f3 into ClickHouse/2026c Sep 21, 2026
1 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant