Skip to content

fix(feature/rds/auth): include trailing slash in BuildAuthToken URL path#3367

Open
mangomaker5 wants to merge 1 commit intoaws:mainfrom
mangomaker5:fix/rds-auth-token-trailing-slash
Open

fix(feature/rds/auth): include trailing slash in BuildAuthToken URL path#3367
mangomaker5 wants to merge 1 commit intoaws:mainfrom
mangomaker5:fix/rds-auth-token-trailing-slash

Conversation

@mangomaker5
Copy link
Copy Markdown

Description

Fixes #3365

BuildAuthToken generates an IAM authentication token missing the / path separator between host:port and the query string:

  • Before (bug): host:5432?Action=connect&DBUser=postgres&...
  • After (fix): host:5432/?Action=connect&DBUser=postgres&...

This aligns the Go SDK output with aws rds generate-db-auth-token (AWS CLI), which includes the trailing slash.

Root Cause

In connect.go, When the endpoint host:5432 is prefixed with https:// and passed to http.NewRequest, Go's net/url parses it as a URL with an empty path. The resulting presigned URL from PresignHTTP omits the / between the authority and query string. Aurora Express Configuration clusters (with InternetAccessGatewayEnabled: true) strictly validate this format and reject the token with FATAL: PAM authentication failed.

Fix

A single line addition in connect.go (line 72):

req.URL.Path = "/"

BuildAuthToken generates a token missing the '/' path separator between
host:port and the query string (host:5432?Action=...), causing PAM
authentication failures on Aurora Express Configuration clusters.

This aligns the SDK output with the AWS CLI (aws rds generate-db-auth-token)
which produces host:5432/?Action=...

Fixes aws#3365
@mangomaker5 mangomaker5 requested a review from a team as a code owner March 27, 2026 19:10
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.

feature/rds/auth.BuildAuthToken generates a token rejected by Aurora Express

1 participant