Repository navigation
Cherry pick #124905 to 26.8: Reject CR/LF in outgoing HTTP request lines and headers - #126361
Merged
Merged
Conversation
`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]>
…ine tests Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-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.
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:
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