feat(connections): AWS IAM authentication for PostgreSQL and MySQL (#1291)#1401
Merged
Conversation
079a0f0 to
c881741
Compare
…S libmariadb build (#1291)
c881741 to
9c464ca
Compare
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
Adds an AWS IAM authentication mode for PostgreSQL and MySQL connections to RDS and Aurora. Instead of a static password, TablePro resolves AWS credentials and generates a short-lived RDS IAM auth token (a SigV4-presigned
rds-dbconnect URL, valid 15 minutes) to use as the password. Closes #1291.In the connection form, set Authentication to one of:
~/.aws/credentialsaws sso loginfirst)The token is regenerated on every connect and reconnect, so a 15-minute expiry never reaches the user. SSL is forced on for IAM. The AWS Region is auto-derived from the RDS hostname and can be overridden.
Design decisions
TablePro/Core/Database/AWS/). The project has no AWS SDK, and DynamoDB already signs this way;aws-sdk-swiftwould pull in a C runtime (aws-crt) + Smithy, which is disproportionate for token generation and complicates the universal binary. The SSO flow (INI parse → token cache →GetRoleCredentials) is ported from the DynamoDB driver, whose copy is internal to a separate registry binary the host can't link.DatabaseDriverFactory.resolvePasswordand passed as the driver password. The PostgreSQL/MySQL plugins are AWS-agnostic and unchanged; no PluginKit ABI bump.resolvePassword/createDriverFromPluginare nowasync throwsso SSO can do its credential-exchange network call and so credential errors surface with actionable messages. Their only caller,createDriver, was already async.session.cachedPasswordis left nil for IAM connections, so every connect and every health-monitor reconnect regenerates a fresh token rather than replaying a dead one. This is the correctness-critical part.awsAuthdropdown drives all credential-source fields directly, becauseisFieldVisibledoesn't resolve nested visibility.AuthPaneViewModel.hidesPasswordnow hides the password when a dropdown auth field is non-default (DynamoDB's.secure-based hiding is unaffected).Files
New module:
AWSCredentials,AWSAuthError,AWSSSO(+AWSSSOError),AWSSigV4,AWSCredentialResolver,RDSAuthTokenGenerator,RDSEndpoint.Changed:
DatabaseDriver(async IAM branch + SSL floor),DatabaseManager+Sessions/+Health(never cache the token for IAM),DatabaseConnection.usesAWSIAM,AuthPaneViewModel,MySQLPlugin/PostgreSQLPlugin(auth fields), CHANGELOG, both DB docs.Tests
AWSIAMAuthTests: SigV4 primitives against NIST/RFC 4231 vectors, token shape + determinism + session-token inclusion, region derivation, the access-key resolver, and AWS config INI parsing. Profile/SSO file and network paths aren't unit-tested (they need the filesystem/AWS).Verify on real RDS (not unit-testable)
--enable-cleartext-plugin). If MySQL IAM fails with a plugin error, the fix is a smalladditionalFields-driven connector option (no ABI bump). Please test against an RDS MySQL instance with an IAM-enabled user.aws sso login --profile <name>.Not included