Repository navigation
feat: field DNS request signing + spored self-grant for IAM-auth cutover (#173) - #243
Merged
Merged
Conversation
…ver (#173) Two additive, non-breaking pieces that ready the fleet for the DNS Function URL AuthType: AWS_IAM flip (the destructive infra step stays gated): - spored's systemd unit now sets SPORE_DNS_SIGV4=1, so launched instances SigV4-sign their DNS-registration requests (the client signing path shipped in PR #242, dormant until now). Harmless while the Function URL is still AuthType: NONE (the signature is ignored); this fields a signing fleet so the later flip doesn't break in-flight registration. Non-signing instances age out under their TTLs. - the spored instance role grants ITSELF lambda:InvokeFunctionUrl on the spawn-dns-updater function (pkg/aws/iam.go buildInlinePolicy). This is the scalable alternative to enumerating launch accounts in the Lambda's resource policy — accounts are unbounded and spored role names are dynamic (spawn-instance-<hash>), so each role self-authorizes and the Lambda enforces that a caller may only write records under its own SigV4-verified account subdomain. Scoped to the single dns-updater ARN, account-pinned. Tests: TestSporedDNSInvokeGrant (grant present + scoped, not '*'); updated TestBuildInlinePolicy counts (3 -> 4 spored base statements). Full pkg/aws suite green. Does NOT close the vuln — the AuthType flip + verified-account handler are the remaining gated infra steps. Refs #173.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
scttfrdmn
added a commit
that referenced
this pull request
Jun 25, 2026
…#173 step 3 code) (#244) 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.
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 (does not close it). Two additive, non-breaking pieces that ready the fleet for the DNS Function URL
AuthType: AWS_IAMflip — the destructive infra step stays gated.This is the redesigned step 1 + the enabler. After discussion, we are NOT enumerating launch accounts in the Lambda's resource policy: spawn launches in unbounded accounts whose spored roles are dynamically named (
spawn-instance-<hash>), so an allow-list means per-account enrollment and a ~20KB policy ceiling. Instead, security comes from SigV4 + the Lambda's verified-account namespacing, which needs zero allow-list upkeep and no per-region certs.Changes
SPORE_DNS_SIGV4=1, so launched instances SigV4-sign DNS requests (client path shipped dormant in feat: opt-in SigV4 signing for DNS registration (#173 client half) #242). Harmless while the URL is stillAuthType: NONE(signature ignored); this fields a signing fleet so the later flip doesn't break in-flight registration. Old instances age out under their TTLs.lambda:InvokeFunctionUrlonspawn-dns-updater(pkg/aws/iam.go). Each role self-authorizes; the Lambda enforces that a caller may only write records under its own SigV4-verified account subdomain. Scoped to the single dns-updater ARN, account-pinned.Tests
TestSporedDNSInvokeGrant(grant present + scoped to the dns-updater ARN, not*); updatedTestBuildInlinePolicystatement counts (3 → 4 spored base statements). Fullpkg/awssuite green;make checkclean.What remains (gated, infra-side — tracked in #173)
tofu planclean (committed separately in the spore-host umbrella).AuthType: AWS_IAM+ deploy the verified-account-namespacing handler. DESTRUCTIVE; do only once a signing fleet is fielded (this PR shipped + old instances aged out).signature.go/ embedded certs / cross-account default-allow.