feat(mysql-mcp-server): restore --secret_arn for custom-secret auth (#3643, #4099) - #4585
Open
warren830 wants to merge 1 commit into
Open
feat(mysql-mcp-server): restore --secret_arn for custom-secret auth (#3643, #4099)#4585warren830 wants to merge 1 commit into
warren830 wants to merge 1 commit into
Conversation
…wslabs#3643, awslabs#4099) 1.0.21 removed the ability to authenticate with an operator-supplied Secrets Manager secret; secret_arn was derived exclusively from the cluster/instance MasterUserSecret, silently forcing connections as the master user (a privilege escalation for setups that previously used a least-privilege secret). The connection layer already accepts an arbitrary secret_arn, but server.py never exposed it. Add a --secret_arn CLI flag (module global configured_secret_arn, wired exactly like --ca_bundle) that overrides the derived MasterUserSecret ARN for the mysqlwire and rdsapi methods, and is ignored for mysqlwire_iam (IAM auth uses no secret). Restores the removed capability (awslabs#3643) and reaches parity with mssql-mcp-server (awslabs#4099). Adds tests asserting the override reaches the connection constructor on both wire and Data-API paths and does not leak into IAM auth; documents the least-privilege use case in the README.
warren830
requested review from
a team,
happycupofjava,
kennthhz and
manaswini1920
as code owners
September 4, 2026 11:52
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.
Issues
Fixes #3643. Closes #4099.
Problem
mysql-mcp-server1.0.21 removed the ability to authenticate with an operator-supplied Secrets Manager secret:secret_arnis now derived exclusively from the cluster/instance's AWS-managedMasterUserSecret. This silently forces connections as the master user — a privilege regression (#3643) for setups that previously connected as a dedicated least-privilege user (e.g. read-only) via a custom secret.mssql-mcp-serverstill supports--secret_arn, so the two servers are also out of parity (#4099).The connection layer (
AsyncmyPoolConnection/RDSDataAPIConnection) already accepts an arbitrarysecret_arn—server.pysimply never exposed a way to set it.Fix
--secret_arnCLI flag, wired exactly like the existing--ca_bundle(module globalconfigured_secret_arn, declared ininternal_connect_to_databaseandmain, set fromargs.secret_arn).MasterUserSecretARN for themysqlwire(non-IAM) andrdsapimethods.mysqlwire_iam, which authenticates via IAM and uses no secret (that path'ssecret_arnstays'').Tests
Added to
tests/test_server.py::TestInternalConnectToDatabaseRouting:--secret_arnoverridesMasterUserSecreton the wire path;--secret_arnoverrides it on the RDS Data API path;--secret_arnis not applied to IAM auth (secret_arn == '').Strict red→green verified: neutralizing the override makes the two override tests fail (connection would use
arn:master-user-secret); the fix makes them pass, and the IAM-ignored test passes both ways. Fulltest_server.py(28 tests) green;ruff check/ruff format --checkclean.Compatibility
No behavior change when
--secret_arnis omitted (the managedMasterUserSecretis still used), so existing deployments are unaffected.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.