feat(mcpsecret): add robust AWS STS credentials handling (GetSessionToken + AssumeRole) for MCP #379
Open
Pnkcaht wants to merge 1 commit intodocker:mainfrom
Open
feat(mcpsecret): add robust AWS STS credentials handling (GetSessionToken + AssumeRole) for MCP #379Pnkcaht wants to merge 1 commit intodocker:mainfrom
Pnkcaht wants to merge 1 commit intodocker:mainfrom
Conversation
Signed-off-by: pnkcaht <samzoovsk19@gmail.com>
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.
What I did
pkg/mcp/mcpsecret/package to handle temporary AWS STS credentials.AWSManagerstruct to manage generation and storage of credentials.SaveTemporaryCredentialswith support forGetSessionTokenandAssumeRole.LoadCredentialsto retrieve and validate credentials from MCP credstore.DescribeSecretto show human-readable summary without exposing secrets.maskStringhelper to partially hide AccessKeyId.serverNameand validation fordurationSeconds(900–129600s).Releated Issue
~/.docker/cli-plugins/docker-mcpplugin? #378 (Equivalent of Docker Engine API for ~/.docker/cli-plugins/docker-mcp plugin)Before / After
Before
No STS credential management in MCP gateway. Only manual secrets or older ad-hoc implementations.
After
Automatic STS credential management with:
Diagram (Mermaid)
flowchart TD A[Request STS Credentials] --> B{roleARN provided?} B -- Yes --> C[AssumeRole via STS] B -- No --> D[GetSessionToken via STS] C --> E[Validate Credentials] D --> E[Validate Credentials] E --> F[Marshal as JSON] F --> G[Store in MCP credstore] G --> H[Success / Return] H --> I[Optional: LoadCredentials / DescribeSecret]Directory Tree (new package)
graph TD A[pkg/mcp] --> B[mcpsecret] B --> C[aws_manager.go] B --> D[helpers.go]:::future B --> E[aws_manager_test.go]:::future classDef future fill:#f9f,stroke:#333,stroke-dasharray: 5 5;Security Considerations
AccessKeyId,SecretAccessKey,SessionToken) are never printed or logged.DescribeSecretonly exposes a masked AccessKeyId and expiration info.Validation / Sanitization
serverNameis sanitized to produce a valid MCP secret key (replaces/,\,:,*,., space with_).durationSecondsdefaults to 3600s if <= 0, and must be within STS limits (900–129600 seconds).Future Work / TODOs
aws_manager_test.go.helpers.goif needed.