Repository navigation
feat: IAM-aware dns-updater handler with verified-account namespacing (#173 step 3 code) - #244
Merged
Merged
Conversation
…#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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
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
NONEURL already delivers), and chooses the account a record is namespaced under by:requestContext.authorizer.iam→ record forced underbase36(verifiedAccountID).<domain>. Unspoofable; no EC2 describe, no embedded cert, no per-region upkeep (closes [audit] Dup: formatDuration and formatDurationForTTL are byte-identical — collapse to one #294).NONE): no authorizer → fall back to the extractedlegacyAuthorize()(old identity-doc +validateInstance), so registration keeps working until the flip. Deny-by-default when neither auth is present. Deleted in [HIGH] dns-updater accepts unsigned identity docs + default-allows cross-account → Route53 spoofing #173 step 4.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,gofmtclean; nogo.modchurn.The cutover only becomes safe once instances send signed requests:
SPORE_DNS_SIGV4=1in the spored unit + self-grant) ships in a spawn release.scripts/deploy-custom-dns.sh) + flip the Function URL toAuthType: AWS_IAM(enable_iam_invoke=true+authorization_typein the tofu module).Merging the code is fine; deploying/flipping is the operator-gated action.