Skip to content

Reject the file: prefix in time zone names (2026d) - #14

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

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

Conversation

@thevar1able

Copy link
Copy Markdown
Member

Cherry-pick of #13 onto ClickHouse/2026d, so that ClickHouse/ClickHouse#121325 can carry the fix.

The only conflict was in time_zone_lookup_test.cc, where upstream 2026d added its own path-traversal tests at the same spot. Both blocks are kept. Full suite passes (4 of 4) with -DCMAKE_CXX_STANDARD=20.

Related: ClickHouse/ClickHouse#121367

🤖 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]>
(cherry picked from commit ddb2b7d)
@thevar1able
thevar1able merged commit bfd13df into ClickHouse/2026d Sep 21, 2026
1 of 13 checks passed
thevar1able added a commit to actueleai/ClickHouse that referenced this pull request Sep 21, 2026
`CheckTimeZoneName` in the `cctz` fork ran on the raw name, but
`FileZoneInfoSource::Open` strips the `file:` prefix before it builds
the path, so `file:/abs/path` bypassed the leading `/` check and opened
an arbitrary absolute path. The fork now rejects the prefix outright.

Add a stateless test for the `file:` bypass and the other forbidden
patterns across `toDateTime`, `toTimeZone`, the `DateTime` type
parameter and `session_timezone`.

Closes: ClickHouse#121367
ClickHouse/cctz#14

Co-Authored-By: Claude Fable 5.1 <[email protected]>
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