Skip to content

Implement opting out of S3 Express session auth via config variables#3631

Merged
aemous merged 27 commits intoboto:developfrom
aemous:disable-s3-express-auth
Mar 24, 2026
Merged

Implement opting out of S3 Express session auth via config variables#3631
aemous merged 27 commits intoboto:developfrom
aemous:disable-s3-express-auth

Conversation

@aemous
Copy link
Copy Markdown
Contributor

@aemous aemous commented Feb 11, 2026

Description of changes:

  • Added support for opting out of S3 Express session authentication via new disable_s3_express_session_auth client configuration setting, or the new AWS_S3_DISABLE_EXPRESS_SESSION_AUTH environment variable, or the disable_s3_express_session_auth S3 shared configuration setting.
  • Added new tests against the new configuration and functionality.

Description of tests:

  • Successfully ran all unit and functional tests.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 11, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 93.75000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.62%. Comparing base (b0a4fbe) to head (d662f0e).
⚠️ Report is 401 commits behind head on develop.

Files with missing lines Patch % Lines
botocore/args.py 93.33% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3631      +/-   ##
===========================================
- Coverage    92.71%   92.62%   -0.10%     
===========================================
  Files           68       68              
  Lines        15561    15664     +103     
===========================================
+ Hits         14428    14509      +81     
- Misses        1133     1155      +22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SamRemis
Copy link
Copy Markdown
Contributor

One high level comment (got a few more comments to come):

Your PR description says that there's a new client configuration setting, but this doesn't work:

config = Config(disable_s3_express_session_auth=True)
s3 = boto3.client('s3',config=config)

We never added it to the Config class; how are users expected to set this in code?

@aemous
Copy link
Copy Markdown
Contributor Author

aemous commented Feb 12, 2026

We never added it to the Config class; how are users expected to set this in code?

@SamRemis As we discussed offline, it is set in code-config via the S3 config.

import boto3

from botocore.config import Config

my_config = Config(
    s3 = {
        'disable_s3_express_session_auth': True
    }
)

client = boto3.client('s3', config=my_config)
# client = boto3.client('s3')

@SamRemis
Copy link
Copy Markdown
Contributor

Thank you, you're right. I wasn't familiar with the code path for service specific configs and was expecting an update in config.py

from tests import ClientHTTPStubber


@pytest.mark.parametrize(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate the use of pytest.mark.parametrize here, but I think it may make more sense to split this into two more readable test cases. One where we assert that s3express auth is disabled, and one where we assert that it's not.

We can use class constants for reusable variables like the method responses, bucket name, and date. Then use a pytest fixture for the datetime.

We should also be adding an assertion on len(http_stubber.requests) for the number of requests on the stubbed client (expect one for the non-session auth test and two for the one with session auth). We could potentially even assert the URL of the first request using stubber.requests[0].url.endswith('?session'), but that's relying on the URL of the API not changing.

I'm asking for a refactoring of the whole class, so happy to chat more about this if you disagree or find any of it confusing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Published a revision.

Comment thread botocore/configprovider.py Outdated
Comment thread tests/functional/test_disable_s3_express_auth.py
Comment thread tests/functional/test_disable_s3_express_auth.py
Copy link
Copy Markdown
Contributor

@SamRemis SamRemis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks Ahmed :)

@ashovlin ashovlin requested a review from SamRemis March 3, 2026 15:17
Comment thread tests/functional/test_disable_s3_express_auth.py
Comment thread botocore/config.py Outdated
Comment thread tests/functional/test_disable_s3_express_auth.py
Comment thread botocore/args.py Outdated
@aemous aemous requested a review from ashovlin March 9, 2026 22:14
@aemous aemous merged commit 6cd03e6 into boto:develop Mar 24, 2026
46 checks passed
aemous added a commit to aemous/botocore that referenced this pull request Mar 24, 2026
aemous added a commit that referenced this pull request Mar 24, 2026
aws-sdk-python-automation added a commit that referenced this pull request Mar 24, 2026
* release-1.42.75:
  Bumping version to 1.42.75
  Update to latest models
  Revert "Add support for opting out of S3 Express session auth via config settings. (#3631)" (#3657)
  Replace glacier integration and smoke tests with functional tests (#3656)
  Add support for opting out of S3 Express session auth via config settings. (#3631)
  Bump github/codeql-action from 4.32.0 to 4.34.1 (#3655)
hswong3i pushed a commit to alvistack/boto-botocore that referenced this pull request Mar 25, 2026
hswong3i pushed a commit to alvistack/boto-botocore that referenced this pull request Mar 25, 2026
aemous added a commit to aemous/botocore that referenced this pull request Mar 25, 2026
aemous added a commit to aemous/botocore that referenced this pull request Mar 25, 2026
aemous added a commit that referenced this pull request Mar 30, 2026
…ariables" (#3658)

* Reapply "Add support for opting out of S3 Express session auth via config settings. (#3631)"

This reverts commit b55e169.
hswong3i pushed a commit to alvistack/boto-botocore that referenced this pull request Mar 31, 2026
…ariables" (boto#3658)

* Reapply "Add support for opting out of S3 Express session auth via config settings. (boto#3631)"

This reverts commit b55e169.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants