Fix issue with GCP auth and unity catalog#98456
Conversation
|
Melvyn Peignon seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
Workflow [PR], commit [05ce6e6] Summary: ✅ AI ReviewSummaryThis PR adds Missing context
ClickHouse Rules
Final Verdict
|
| secret_access_key = s3_creds->getSecretAccessKey(); | ||
| session_token = s3_creds->getSessionToken(); | ||
| LOG_DEBUG(getLogger("getClient"), "Got new S3 access tokens"); | ||
| } |
There was a problem hiding this comment.
let's throw an exception in other cases
|
I tested it with GCP/Polaris combo. There are a lot of exceptions and retries. It does work after retries. |
| { | ||
| access_key_id = s3_creds->getAccessKeyId(); | ||
| secret_access_key = s3_creds->getSecretAccessKey(); | ||
| session_token = s3_creds->getSessionToken(); |
There was a problem hiding this comment.
❌ gcs_creds->getToken() comes from external catalog data and is copied into an HTTP header without header-value validation on the refresh path.
StorageS3Configuration::check validates headers parsed from AST, but this branch bypasses that path and pushes Authorization directly. If the token contains \n, it can inject extra headers.
Please validate refreshed headers before client creation, e.g. call context->getGlobalContext()->getHTTPHeaderFilter().checkAndNormalizeHeaders(headers) after replacing Authorization.
- Use erase-remove idiom instead of in-place loop for Authorization header, fixing stale connection issues (suggested by @bacek) - Throw BAD_ARGUMENTS exception for unrecognized credential types (requested by @scanhex12)
- Call checkAndNormalizeHeaders on refreshed headers before creating the S3 client, preventing header injection from untrusted catalog tokens - Add unit test for GCSCredentials and header validation
fc34c26 to
05ce6e6
Compare
LLVM Coverage Report
PR changed lines: PR changed-lines coverage: 60.55% (66/109, 0 noise lines excluded) |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix a bug when using Unity catalog on top of GCS
Documentation entry for user-facing changes