Skip to content

chore: remove legacy identity-doc auth from dns-updater (#173 step 4) - #256

Merged
scttfrdmn merged 1 commit into
mainfrom
chore/173-step4-remove-legacy-dns-auth
Jun 25, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
chore/173-step4-remove-legacy-dns-auth

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Summary

Final step of the #173 cutover. The spawn-dns-updater Function URL is now live under AuthType: AWS_IAM (flipped + verified — see #387), so the handler authorizes solely on the SigV4-verified caller account. The old instance-identity-document path is dead code; this removes it.

Removed

  • signature.go — the embedded per-region AWS certs + PKCS#7/RSA identity-doc verification (the [audit] Dup: formatDuration and formatDurationForTTL are byte-identical — collapse to one #294 maintenance burden).
  • legacyAuthorize() + validateInstance() — including the cross-account default-allow that was the core of the vulnerability.
  • instance_identity_document / instance_identity_signature request fields + the InstanceIdentityDocument type.
  • the github.com/fullsailor/pkcs7 dependency and the now-unused ec2 client.

Behavior

The handler now rejects any request lacking a verified IAM authorizer with 403. Under AuthType: AWS_IAM that can't occur (the URL rejects unsigned callers first), but it defends against an accidental revert to NONE silently re-opening the hole. Unknown JSON fields (older clients still sending the identity doc) are ignored.

Tests

TestHandlerRejectsWithoutIAMAuthorizer (replaces the legacy-path test) covers no-authorizer / authorizer-without-IAM / IAM-without-account → all 403. go test, go vet, gofmt clean; go.sum tidied (pkcs7 gone).

Closes the #173 HIGH Route53-spoofing vulnerability and retires #294.

Note: the live function still runs the dual-path build (functionally identical under AWS_IAM — it already prefers the verified path). This cleaned handler should be deployed via scripts/deploy-custom-dns.sh at convenience; no behavior change either way.

The dns-updater Function URL now runs under AuthType: AWS_IAM (the #173 flip is
live + verified), so the handler authorizes solely on the SigV4-verified caller
account. The old spoofable path is now dead code — remove it:

- delete signature.go (embedded per-region AWS certs + PKCS#7/RSA verification)
- delete legacyAuthorize() + validateInstance() (the cross-account default-allow)
- drop the instance_identity_document / instance_identity_signature request fields
  and the InstanceIdentityDocument type
- drop the github.com/fullsailor/pkcs7 dependency and the now-unused ec2 client
- handler now rejects any request without a verified IAM authorizer (403) — can't
  happen under AWS_IAM, but defends against an accidental revert to NONE

Closes the #173 HIGH Route53-spoofing vuln and retires the #294 cert-maintenance
problem for good. Tests: TestHandlerRejectsWithoutIAMAuthorizer (replaces the
legacy-path test). go test + vet + gofmt clean.

Refs #173, #294.
@scttfrdmn
scttfrdmn merged commit ead3abf into main Jun 25, 2026
@scttfrdmn
scttfrdmn deleted the chore/173-step4-remove-legacy-dns-auth branch June 25, 2026 17:46
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