Skip to content

feat: IAM-aware dns-updater handler with verified-account namespacing (#173 step 3 code) - #244

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/173-dns-iam-handler
Jun 25, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/173-dns-iam-handler

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Summary

Refs #173. The code half of step 3: rewrites the DNS updater to authorize on the SigV4-verified caller account instead of the spoofable instance-identity document. Not deployed and the Function URL is not flipped — those gated actions wait until a signing fleet is fielded.

Dual-path (deploy-safe before the flip)

The entrypoint moves to the Lambda Function URL event shape (which the current NONE URL already delivers), and chooses the account a record is namespaced under by:

Preferring the verified account decouples the handler deploy from the AuthType flip: deploying behaves exactly as today; the flip alone activates the secure path. Route53 upsert/delete/alias logic is unchanged.

Tests

TestLegacyAuthorizeRejectsMissingIdentity (deny-by-default with no credible identity). Existing helper tests unchanged; go test, go vet, gofmt clean; no go.mod churn.

⚠️ Gated — do NOT merge-and-deploy until the fleet signs

The cutover only becomes safe once instances send signed requests:

  1. PR feat: field DNS request signing + spored self-grant for IAM-auth cutover (#173) #243 (enabler: SPORE_DNS_SIGV4=1 in the spored unit + self-grant) ships in a spawn release.
  2. Instances cycle so the fleet signs; old non-signing instances age out under TTL.
  3. Then, in lockstep: deploy this handler (scripts/deploy-custom-dns.sh) + flip the Function URL to AuthType: AWS_IAM (enable_iam_invoke=true + authorization_type in the tofu module).
  4. Verify a signed call registers and an unsigned call now 403s, then [HIGH] dns-updater accepts unsigned identity docs + default-allows cross-account → Route53 spoofing #173 step 4 deletes the legacy code.

Merging the code is fine; deploying/flipping is the operator-gated action.

…#173 step 3 code)

Rewrites the DNS updater entrypoint to the Lambda Function URL event shape and
authorizes on the SigV4-VERIFIED caller account instead of the spoofable
instance-identity document.

Dual-path, so deploying this handler is safe BEFORE the AuthType flip:
- AWS_IAM path (post-flip): read the verified caller account from
  requestContext.authorizer.iam and namespace the record under
  base36(verifiedAccountID).<domain>. Unspoofable; no EC2 describe, no embedded
  cert, no per-region maintenance (#294).
- legacy path (pre-flip, AuthType: NONE): no authorizer present → fall back to
  legacyAuthorize() (the extracted old identity-doc + validateInstance flow) so
  registration keeps working until the flip. Deny-by-default when neither auth is
  present. This branch is deleted in #173 step 4.

Preferring the verified account when present decouples the handler deploy from
the AuthType flip: deploying behaves exactly as today, and the flip alone
activates the secure path — a low-risk cutover.

Handler/response/error types moved APIGatewayProxyRequest/Response →
LambdaFunctionURLRequest/Response (the Function URL event shape, which the
current NONE URL already delivers). Route53 upsert/delete/alias logic unchanged.

Tests: TestLegacyAuthorizeRejectsMissingIdentity (deny-by-default when no
credible identity). Existing helper tests unchanged. NOT YET DEPLOYED and the
Function URL is NOT YET flipped — those gated steps wait until a SigV4-signing
fleet is fielded (PR #243 enabler shipped in a release + old instances aged out).
Refs #173.
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 12a6874 into main Jun 25, 2026
7 checks passed
@scttfrdmn
scttfrdmn deleted the feat/173-dns-iam-handler branch June 25, 2026 05:00
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.

1 participant