Skip to content

authn: Ignore local AWS credentials when authenticating with Cognito - #552

Open
trvrb wants to merge 2 commits into
masterfrom
trvrb/cognito-unsigned
Open

trvrb wants to merge 2 commits into
masterfrom
trvrb/cognito-unsigned

Conversation

@trvrb

@trvrb trvrb commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Via Claude

Description of proposed changes

Creates the boto3 Cognito client unsigned, so commands that authenticate with nextstrain.org (nextstrain login, nextstrain whoami, and nextstrain remote with nextstrain.org addresses) no longer load AWS credentials. The Cognito user pool APIs we use (InitiateAuth, RespondToAuthChallenge) don't use them.

Previously, a local AWS profile using console login credentials (login_session, from aws login) made these commands fail with a MissingDependencyException asking for botocore[crt]. Standalone users can't install that.

This is the approach @victorlin suggested in #533, which @joverlee521 agreed with: local AWS credentials shouldn't interfere with nextstrain login. Adding boto3[crt] is proposed separately in #553. That change would also avoid this error, but with this one, login doesn't depend on the optional dependency or on local AWS credentials at all.

One thing this doesn't change: a misspelled AWS_PROFILE still fails with ProfileNotFound, as on master, because botocore looks up the profile before credentials are involved.

Related issues

Resolves #533

Checklist

  • Checks pass (./devel/pytest locally; CI pending)
  • Update changelog
  • Manual testing without awscrt installed:
    • nextstrain whoami with a [default] profile holding a valid or an expired aws login session fails on master and succeeds on this branch
    • nextstrain remote download https://nextstrain.org/groups/… with AWS_PROFILE set to such a profile succeeds
  • Test this PR's standalone build

🤖 Generated with Claude Code

The Cognito user pool APIs that CognitoSession uses (InitiateAuth and
RespondToAuthChallenge) don't use AWS credentials, but creating the
boto3 client still loaded them from local AWS configuration.  For a
profile using console login credentials (`login_session`, from `aws
login`), botocore needs the optional awscrt dependency to do that, so
`nextstrain login`, `nextstrain whoami`, and nextstrain.org remote
commands failed with a MissingDependencyException when awscrt wasn't
installed, as in the standalone bundle.

Create the client unsigned so no credentials are loaded, as suggested
in the issue.

Resolves: <#533>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@trvrb
trvrb requested a review from victorlin October 23, 2026 22:09
@trvrb
trvrb marked this pull request as ready for review October 23, 2026 22:09

@victorlin victorlin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Failing tests on windows runners is a known issue outside of this PR.

Will merge+release next week.

@trvrb

trvrb commented Oct 24, 2026

Copy link
Copy Markdown
Member Author

Thank you @victorlin!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Standalone bundle ships botocore 1.43.0 without botocore[crt], breaking login for users with local AWS config

2 participants