Skip to content

feat: cross-account RDS IAM auth via server_iam_assume_role - #1525

Open
lyupan-cb wants to merge 1 commit into
pgdogdev:mainfrom
lyupan-cb:feat/cross-account-rds-iam
Open

feat: cross-account RDS IAM auth via server_iam_assume_role#1525
lyupan-cb wants to merge 1 commit into
pgdogdev:mainfrom
lyupan-cb:feat/cross-account-rds-iam

Conversation

@lyupan-cb

@lyupan-cb lyupan-cb commented Sep 11, 2026

Copy link
Copy Markdown

RDS IAM tokens are signed with PgDog's single ambient identity, and RDS IAM auth is evaluated in the database's own AWS account, so a backend in a different account can't be reached today (region can be overridden, but not account).

Add an optional per-user server_iam_assume_role (an IAM role ARN). When it is set and server_auth = "rds_iam", PgDog assumes that role via STS and signs the auth token with the assumed credentials instead of the ambient identity.

  • new server_iam_assume_role field on the user config
  • rds_iam::token assumes the role (aws-config AssumeRoleProvider) when set; otherwise the path is unchanged (ambient identity)
  • warn when the field is set without server_auth = "rds_iam"
  • backward compatible: unset = current behavior; TokenCache/monitor refresh are unchanged
  • unit tests for config parsing, Address plumbing, and the assume-role decision (pure, no AWS required)

RDS IAM tokens are signed with PgDog's single ambient identity, and RDS IAM
auth is evaluated in the database's own AWS account, so a backend in a
different account can't be reached today (region can be overridden, but not
account).

Add an optional per-user `server_iam_assume_role` (an IAM role ARN). When it
is set and `server_auth = "rds_iam"`, PgDog assumes that role via STS and
signs the auth token with the assumed credentials instead of the ambient
identity.

- new `server_iam_assume_role` field on the user config, carried onto Address
- rds_iam::token assumes the role (aws-config AssumeRoleProvider) when set;
  otherwise the path is unchanged (ambient identity)
- warn when the field is set without `server_auth = "rds_iam"`
- backward compatible: unset = current behavior; TokenCache/monitor refresh
  are unchanged
- unit tests for config parsing, Address plumbing, and the assume-role
  decision (pure, no AWS required)
@CLAassistant

CLAassistant commented Sep 11, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@lyupan-cb
lyupan-cb marked this pull request as ready for review September 11, 2026 00:51
@codecov

codecov Bot commented Sep 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.93103% with 14 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pgdog/src/backend/auth/rds_iam.rs 72.91% 13 Missing ⚠️
pgdog/src/backend/auth/azure_workload_identity.rs 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

2 participants