Skip to content

testutil: use RDS-managed password rotation in the Ministack harness - #29

Merged
Kiran01bm merged 2 commits into
mainfrom
kiran01bm/ms9c-rotation-seam
Aug 12, 2026
Merged

testutil: use RDS-managed password rotation in the Ministack harness#29
Kiran01bm merged 2 commits into
mainfrom
kiran01bm/ms9c-rotation-seam

Conversation

@Kiran01bm

@Kiran01bm Kiran01bm commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Replaces the AWS-boundary harness's hand-rolled password-change seam with the RDS-managed master-password flow Ministack v1.4.15 supports end to end. The rotation test now exercises the same control-plane path production credentials take: managed password generation at cluster creation, Secrets Manager resolution, and RotateMasterUserPassword.

Why

The previous seam pushed a caller-invented password through ModifyDBCluster — a shape real operators using managed passwords never exercise. With Ministack v1.4.15 (pinned by the previous image bump), the emulator implements the managed flow faithfully, so the harness can prove the realistic contract: an in-flight session survives rotation, a stale password fails at the next connect, and the refreshed credentials come from Secrets Manager, not from the test.

What

  • CreateDBCluster now sets ManageMasterUserPassword: true instead of passing a fixture password; the harness resolves the generated password by discovering the cluster's MasterUserSecret ARN and reading it through a Secrets Manager client pointed at the same gateway.
  • Rotate drops its caller-chosen password parameter: it issues ModifyDBCluster with RotateMasterUserPassword, then polls boundedly until the managed secret resolves to a password different from the pre-rotation one, then until the database accepts it.
  • Secret resolution is a non-asserting resolveManagedMasterPassword (returns errors so pollers can retry it) behind a bounded polling helper shared by provisioning and rotation, which reports the last resolution error when the deadline expires.
  • Connection URLs are assembled with net/url, so an RDS-generated password containing URL-reserved characters round-trips intact; the cluster-delete cleanup registers before anything fallible touches the cluster.
  • Adds aws-sdk-go-v2/service/secretsmanager; smithy-go moves to indirect.
before:  test invents password ──▶ ModifyDBCluster(MasterUserPassword)

after:   CreateDBCluster(ManageMasterUserPassword)
              │
              ▼
         DescribeDBClusters ──▶ MasterUserSecret.SecretArn
              │
              ▼
         Secrets Manager GetSecretValue ──▶ {username, password}
              │
              ▼
         ModifyDBCluster(RotateMasterUserPassword) ──▶ poll secret ≠ old ──▶ poll DB accepts

This PR was authored by Amp (Claude Opus 4.6).

Replaces the hand-rolled ModifyDBCluster password seam with the real
managed flow Ministack v1.4.15 supports: ManageMasterUserPassword at
cluster creation, master-password resolution through Secrets Manager,
and RotateMasterUserPassword for the rotation itself — the same
control-plane path production credentials take. No fixture password
remains in the source.
RDS-generated passwords are outside the harness's control and may
carry URL-reserved characters, so connection URLs are now assembled
with net/url instead of string interpolation. The cluster-delete
cleanup registers before anything fallible touches the cluster, so a
provisioning failure can no longer leak the sibling container, and
secret resolution polls with the last error reported on deadline.
@Kiran01bm
Kiran01bm marked this pull request as ready for review August 12, 2026 04:38
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morgo morgo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Approved by Morgan's AI agent (low-risk review pass): test-harness-only — switches the Ministack Aurora harness to RDS-managed password rotation with Secrets Manager resolution, and hardens connection-URL building with a round-trip escaping test. Only internal/testutil, docs, and go.mod (official AWS SDK secretsmanager module + patch bumps) are touched; CI green on PG 14–18.

@Kiran01bm
Kiran01bm merged commit 812546c into main Aug 12, 2026
13 checks passed
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