Skip to content

Replace Modal OIDC helper with manual STS assume role flow#975

Merged
r33drichards merged 1 commit intoclaude/add-s3-docs-mcp-upload-Xwis5from
claude/setup-vector-sqlite-db-dVold
Feb 2, 2026
Merged

Replace Modal OIDC helper with manual STS assume role flow#975
r33drichards merged 1 commit intoclaude/add-s3-docs-mcp-upload-Xwis5from
claude/setup-vector-sqlite-db-dVold

Conversation

@r33drichards
Copy link
Collaborator

Summary

Updated the AWS credential acquisition flow in the Modal app to manually exchange Modal's OIDC token for temporary AWS credentials using STS assume_role_with_web_identity, replacing the previous modal.oidc.assume_role() helper method.

Changes

  • Replaced modal.oidc.assume_role() call with explicit STS token exchange flow
  • Extract MODAL_IDENTITY_TOKEN from environment variable (provided by Modal runtime)
  • Use boto3 STS client to call assume_role_with_web_identity() with the OIDC token
  • Updated credential field access from object attributes to dictionary keys (e.g., creds.access_key_idcreds["AccessKeyId"])
  • Added validation to ensure MODAL_IDENTITY_TOKEN is set, with helpful error message

Implementation Details

  • The Modal runtime automatically provides the OIDC identity token via the MODAL_IDENTITY_TOKEN environment variable
  • STS response credentials are returned as a dictionary with capitalized keys (AccessKeyId, SecretAccessKey, SessionToken)
  • Session name is set to "modal-docs-mcp-upload" for audit trail clarity
  • Maintains the same AWS region configuration and S3 client initialization

https://claude.ai/code/session_013E7ycxMooFL1t9wkgbN7UA

The modal.oidc.assume_role() API doesn't exist. Modal provides OIDC
tokens via the MODAL_IDENTITY_TOKEN environment variable, which must
be exchanged for AWS credentials using boto3's STS client with
assume_role_with_web_identity().

https://claude.ai/code/session_013E7ycxMooFL1t9wkgbN7UA
@vercel
Copy link
Contributor

vercel bot commented Feb 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Feb 2, 2026 9:53am

Request Review

@r33drichards r33drichards merged commit 73f3b54 into claude/add-s3-docs-mcp-upload-Xwis5 Feb 2, 2026
2 checks passed
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.

2 participants