Skip to content

Cherry pick #124905 to 26.8: Reject CR/LF in outgoing HTTP request lines and headers - #126361

Merged
robot-clickhouse merged 23 commits into
backport/26.8/124905from
cherrypick/26.8/124905
Oct 17, 2026
Merged

robot-clickhouse merged 23 commits into
backport/26.8/124905from
cherrypick/26.8/124905

Conversation

@robot-ch-test-poll3

Copy link
Copy Markdown
Contributor

Original pull-request #124905

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.

Before you resolve anything

Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.

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

Algunenano and others added 22 commits October 9, 2026 11:32
`billing_project` and `access_token` were sent as HTTP headers unchecked, so CR/LF could inject headers or a second request.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The token was sent in the `Authorization` header unchecked, so CR/LF could inject headers or a second request.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A value with CR/LF in the request line or a header could inject headers or a second request. This covers every client, including headers built by the AWS and Azure SDKs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…Filter`

The `tracestate` forwarded by `url`, Paimon DLF signing headers, REST catalog OAuth tokens, the BigLake `x-goog-user-project` and S3 Tables SigV4 headers were sent unchecked.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… schema

The registration request used the decoded path of `format_avro_schema_registry_url`, so an encoded CR/LF reached the request line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Tokens from the metadata service or a token endpoint were sent as `Authorization: Bearer` unchecked.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The `api_key` of the named collection was sent as an HTTP header unchecked.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An unknown storage class is sent as is in `x-amz-storage-class`, and `BACKUP` and `s3_validate_request_settings = 0` skip validation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… too

The early check ran only for `mode <= CREATE`, so a user `ATTACH TABLE ... UUID ... ENGINE = ...` skipped it. Use `isReplayedTableDefinition`, which skips only stored definitions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The `Authorization`, `x-api-key` and `anthropic-version` headers sent by AI functions bypassed `http_forbid_headers`. `createAIProvider` now validates the provider's headers with the context's filter, which also rejects CR/LF in their values.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`HTTPRequest::write` now also checks the version in the request line. The Avro schema registry test raises the registry timeouts, because the default of 1 second is too short under TSan.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…uth` S3 client

The `gcp_oauth` client adds `Authorization` itself, so `http_forbid_headers` was bypassed. Check it when the client is created for tables, disks and backups.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Share the validation between the `std::ostream` and `std::string` overloads, so requests sent through `sendHTTPRequest` are checked too.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Reject CR/LF in outgoing HTTP request lines and headers
@robot-ch-test-poll3 robot-ch-test-poll3 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-bugfix Pull request with bugfix, not backported by default labels Oct 16, 2026
Adaptations to 26.8:
- `HTTPHeaderFilter::checkHeaders` does not exist here; use `checkAndNormalizeHeaders`, which also rejects CR and LF.
- `isReplayedTableDefinition` does not exist here; use `isFreshTableDefinition` and `isRecoveryFromStoredMetadata` in `StorageBigQuery` and `StorageYTsaurus`.
- `Poco::Net::HTTPRequest::write(std::string &)` does not exist here, so only `write(std::ostream &)` gets the check.
- The AI providers keep the `call` signature and the `X-ClickHouse-AI-Function` header of 26.8.
- `S3::getStorageClassForName` is added to `Requests.cpp` together with the declaration of `INVALID_SETTING_VALUE`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@robot-clickhouse
robot-clickhouse merged commit 3914f33 into backport/26.8/124905 Oct 17, 2026
1 check passed
@robot-clickhouse
robot-clickhouse deleted the cherrypick/26.8/124905 branch October 17, 2026 03:41
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-bugfix Pull request with bugfix, not backported by default pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants