feat: AWS Iam auth for databases - #23231
Open
bbernays wants to merge 8 commits into
Open
Conversation
erezrokah
approved these changes
Aug 6, 2026
bbernays
commented
Aug 6, 2026
Comment on lines
+377
to
+405
| // withTokenPathSeparator only exists because `rdsauth.BuildAuthToken` signs a URL with | ||
| // an empty path and so omits the `/` that RDS requires. This pins that upstream | ||
| // behaviour: it fails when a dependency bump makes the SDK emit the separator itself, | ||
| // which is the signal to delete withTokenPathSeparator (and this test) rather than keep | ||
| // patching a token that no longer needs it. | ||
| func TestRDSAuthTokenStillOmitsPathSeparator(t *testing.T) { | ||
| setStaticAWSCredentials(t) | ||
|
|
||
| awsCfg, err := loadAWSIAMAuthConfig(context.Background(), &spec.AWSIAMAuthSpec{Region: "us-east-1"}) | ||
| if err != nil { | ||
| t.Fatalf("failed to load aws config: %v", err) | ||
| } | ||
|
|
||
| const endpoint = "mydb.123456789012.us-east-1.rds.amazonaws.com:5432" | ||
| token, err := rdsauth.BuildAuthToken(context.Background(), endpoint, "us-east-1", "cq_user", awsCfg.Credentials) | ||
| if err != nil { | ||
| t.Fatalf("BuildAuthToken returned error: %v", err) | ||
| } | ||
|
|
||
| switch { | ||
| case strings.HasPrefix(token, endpoint+"/?"): | ||
| t.Fatalf("aws-sdk-go-v2 feature/rds/auth now emits the `/` path separator itself: "+ | ||
| "delete withTokenPathSeparator, stop calling it from signRDSAuthToken, and delete this test "+ | ||
| "along with TestWithTokenPathSeparator (token = %q)", token) | ||
| case !strings.HasPrefix(token, endpoint+"?"): | ||
| t.Fatalf("BuildAuthToken returned an unrecognised token shape %q: withTokenPathSeparator "+ | ||
| "assumes `%s[/]?<query>` and needs to be revisited", token, endpoint) | ||
| } | ||
| } |
Collaborator
Author
There was a problem hiding this comment.
This can all be removed in the future when aws/aws-sdk-go-v2#3365 is resolved
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.
This allows the plugin to handle short lived auth tokens