Fix/s3v4 signer and oauth2 token#3504
Open
abhishekkumar2024 wants to merge 3 commits into
Open
Conversation
… invalid Bearer token Two bugs affecting REST catalog S3 remote signing with FsspecFileIO: 1. LegacyOAuth2AuthManager.auth_header() returned the string "Bearer None" when no credential or initial_token was configured, instead of returning None. This caused S3V4RestSigner to forward an invalid Authorization header to the catalog signer endpoint, resulting in a 403 that propagated as SignError or was swallowed, leaving the S3 request unsigned. Fix: return None when self._token is None. 2. S3V4RestSigner was registered on the before-sign.s3 botocore event, but botocore short-circuits RequestSigner.sign() and returns early (without emitting before-sign) when signature_version=UNSIGNED is set. Since UNSIGNED is set alongside the signer to prevent botocore's own SigV4 from running, the S3V4RestSigner.__call__ was never invoked, and every S3 request went to the server completely unsigned, resulting in AccessDenied. Fix: register S3V4RestSigner on before-send.s3 instead of before-sign.s3. before-send fires unconditionally after signing (or after UNSIGNED's early return), giving the signer a chance to add catalog-signed headers before the HTTP request is dispatched. Update header assignment from add_header() to dict-style assignment, which is compatible with both AWSRequest (before-sign) and AWSPreparedRequest (before-send). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…fix/s3v4-signer-and-oauth2-token
auth_header() makes no HTTP requests, so checking request_history against an unattached mock was both incorrect and unreachable. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Member
|
@abhishekkumar2024 thanks for your contribution! Could you please update the PR description so reviewers can understand the motivation? |
Collaborator
|
+1 on @ebyhr's comment. I'm not sure what this PR is trying to accomplish. |
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.
Rationale for this change
Are these changes tested?
Are there any user-facing changes?