Repository navigation
feat(tagging): reach an ACM certificate and a CloudFront distribution (#835) - #920
Merged
Merged
Conversation
…#835) Both ARNs fell to resolveARN's default arm and answered an InternalServiceException FailedResourcesMap entry, while both services tag the resource perfectly well through their own calls -- so a tag was writable through one API and invisible to the other. Two of the eleven rows of #835. Each row is three parts and none substitutes for the others: a resolver arm, a raw-JSON merge arm behind a colon-terminated kind guard, and a scanner. Both resolvers share the key builder the owning service already uses, so neither API can address a resource the other would not. ACM's own tag operations key from the calling request and that is correct, not an instance of the #918 defect: acmCertKey embeds the whole ARN alongside the account and Region the ARN names, so no key exists at which the two disagree. Recorded rather than "fixed". GetResources reports a CloudFront distribution in us-east-1 only. Which Region is AWS's; that the gate exists at all is substrate's reading.
6 tasks
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Sep 16, 2026
Closed
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.
Two of the eleven rows of #835: an ACM certificate and a CloudFront distribution are now reachable through the Resource Groups Tagging API. Nine remain, so this PR carries no closing keyword — part of #835.
Both ARNs fell to
resolveARN'sdefaultarm and answered anInternalServiceExceptionFailedResourcesMapentry, while both services tag the resource perfectly well through their own calls. A tag was therefore writable through one API and invisible to the other, which is the split #765 exists to close.Scope
Both types are on AWS's authoritative list: the tagging guide's welcome page names AWS Certificate Manager and Amazon CloudFront among the services
TagResources/UntagResourcessupport. The same page settles the other half at a stroke — "theGetResources,GetTagKeys, andGetTagValuesoperations support all resource types" — so a missing scanner is a gap in substrate rather than a boundary of AWS's.docs/services.mdpreviously said AWS published no list at all; that is corrected, along with the note that the per-service list truncates alphabetically at IAM, so a type absent from it is unlisted, not refused.Each row is three parts
A resolver arm, so
TagResources/UntagResourcesreach the record; a merge arm throughmergeRecordStringMapTags, so the write edits the tags member of the raw JSON and leaves every other member untouched; and a scanner, soGetResourcesreports it. None substitutes for the others — an arm without a scanner leaves the resource writable and invisible.Both resolvers share the key builder the owning service already uses, so neither API can address a resource the other would not. CloudFront's goes through
cfParseDistributionARN, the parser its own three tagging operations use as of #918, so the account comes from the ARN at the tagging API too and a foreign-account ARN naming the caller's own distribution ID is refused.ACM's own tag operations are not an instance of #918
They key from the calling request, and that is correct.
acmCertKeyembeds the whole certificate ARN alongside the account and Region the ARN itself names, so a lookup keyed by the caller's account can only ever find a record whose ARN names that same account — there is no key at which the two disagree. Changing them to key from the ARN would introduce the cross-account reach the redundancy forecloses. I had planned that change and reversed it before writing any code; the analysis is recorded inemulator/acm_tags.go's preamble and indocs/services.mdrather than acted on.Guards and refusals
Each merge sits behind a kind guard testing a colon-terminated prefix:
certis a prefix ofcert_arnsandcfdistofcfdist_ids, so a bare-prefix test would report an index key taggable and merge a tags member into a JSON array of identifier strings. CloudFront's four key kinds now have one producer each — the two invalidation keys were inline concatenation at five sites — so the guard cannot fall out of step with the keys actually written.An ARN of any other resource type is refused rather than resolved to a reachable one (#910's anchored-segment rule):
certificateresource type" — while the publishedCertificateArnpattern does not restrict the resource portion, so the restriction is the prose's. An ACME endpoint ARN and anything nested under a certificate are refused.streaming-distribution/{the caller's own ID}, which is exactly what an unanchored substring match finds.The CloudFront Region attribution
GetResourcesreports a distribution inus-east-1only. CloudFront is global and its ARNs carry an empty Region segment, butGetResourcesis per-Region, so a global resource has to be attributed to exactly one Region or every Region's call would report it — andTagResourcesstates "you can only tag resources that are located in the specified AWS Region for the AWS account".Provenance split: which Region it is, is AWS's; that the gate exists at all is substrate's reading, since AWS publishes the attribution and not a
GetResourcesrule. CloudFront's ownListDistributionskeeps answering from any Region — that is what a global service does, and the per-Region attribution belongs to the tagging API alone.Tests
Twelve tests in
emulator/tagging_acm_cloudfront_test.go, all over the wire, and every tag written through the tagging API is read back through the owning service's own tag call rather than out of the state store (#765's standing rule — the only thing that distinguishes a tag that landed on the right record from one that landed on a phantom key and answered200).UntagResourcesremoves only the named keys — the damaging direction;cert_arns:index is never reported as a resource with an empty ARN;The Region gate is asserted against a live control rather than an empty response: an ACM certificate requested in
us-west-2is reported there while the distribution is not. Without it, "the distribution is absent from us-west-2" would pass just as well against an endpoint that scanned nothing.Negative control: with the two scanner descriptors removed and the two switch arms renamed, 9 of 12 tests fail. The 3 that still pass are pure-refusal cases, which also refused via the default arm.
Verification
The nine-command gate passes from the repo root:
gofmt/go build/go vetclean,golangci-lint0 issues,make testandGOTOOLCHAIN=go1.26.6 make testgreen,make docs-reference docs-reference-check docs-versions authz-reference-checkclean,npm --prefix docs run buildclean, andgo vet -C test/e2e ./... && go test -C test/e2e ./...green. Coverage holds the baseline exactly: 84.1% emulator / 83.6% total.Also in this PR
docs/services.mdloses a claim the tree no longer had — "The Resource Groups Tagging API cannot reach a CloudFront distribution" — and the ACM operations table gainsRemoveTagsFromCertificate,ListTagsForCertificateandRenewCertificate, which have been dispatched for some time and were missing from it.Filed separately, deliberately not folded in
All three ACM tag operations publish
ResourceNotFoundExceptionat HTTP 400 and substrate answers 404;InvalidArnException/400 is unmodelled. That is a status-code defect independent of reachability and gets its own issue.