Repository navigation
feat(elb): the listener and rule ARN shape AWS publishes (#774) - #823
Merged
Merged
Conversation
A listener and a listener rule are siblings of their load balancer's ARN, not children of it. Substrate nested them, so `…:listener/*` — the wildcard every AWS example writes — matched nothing, and the load balancer's own ARN was a prefix of both.
Codecov Report❌ Patch coverage is
📢 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.
A listener and a listener rule are siblings of their load balancer's ARN, not children of
it. Substrate nested them, so
…:listener/*— the wildcard every AWS policy example writes —matched nothing at all: a
Denywritten the documented way silently failed to deny, and anAllowon…:loadbalancer/*was a prefix of every listener and rule ARN and reached them both.AWS's shape, from its Service Reference Information document for
elasticloadbalancing(Version
v1.4):The child repeats the load balancer's name and id inside its own resource type. That document is
now vendored at
emulator/authzref/elasticloadbalancing.jsonbeside the EC2 and IAM snapshots(
elasticloadbalancingadded tocmd/gen-authz-reference'sservices, the only gate), so thetests substitute the placeholders in AWS's own templates and compare against the minted ARN —
a drift on either side fails, where a template copied into a test can only agree with the
implementation it was copied from. The generated tables are read by
ec2_authz.goand by testsonly, so vendoring a third service is inert for behaviour.
A second divergence, found by that join and fixed here because it is the same defect: a load
balancer's ARN carried
LoadBalancerTypeEnum's value (application) where AWS's ARN carries theabbreviation (
app/net/gwy). A listener ARN repeats its load balancer's subtype, so leavingthe long form would have minted
listener/application/…and leftlistener/app/*matchingnothing — the very failure being fixed.
CreateListenerandCreateRulenow answerValidationError/400 when the parent ARN cannotyield a child (malformed, or the classic-ELB
…:loadbalancer/<name>form, which has too fewsegments). Minting a child of the wrong arity would reproduce the defect from the other side.
The old nested spelling stays recognised on the tagging path: an event log or exported fixture
recorded by an earlier version carries those ARNs, and a replay whose tagging calls named no
resource would defeat the property the event store exists to provide. Nothing mints it any more.
Fail-before
With the nesting builders and the long subtype restored, 4 tests fail (6 subtests):
TestELB_AListenerAndRuleARNMatchTheFormatAWSPublishes,TestELB_AnARNCarriesAWSsTypeAbbreviation(all three arms),TestELB_AMalformedParentARNIsRefusedRatherThanMintingAMalformedChild. Restored: green.Tests
New
emulator/elb_arn_shapes_test.go— the minted ARNs against AWS's published formats with theplaceholders substituted; the subtype abbreviation looked up in the snapshot rather than asserted
as a literal; a malformed and a classic-ELB parent refused; a policy scoped to
…:listener/*allowing
ModifyListenerand one scoped to…:listener-rule/*allowingDeleteRule, arule-scoped
Denythat now actually denies without spilling onto listeners, and aloadbalancer/*grant that no longer reaches either child;DescribeListeners' andDescribeRules' filters pinned (they compare the child's stored parent ARN and never dependedon the nesting);
AddTags/DescribeTagsround-tripping a new-shape ARN while both spellingsstill resolve.
Compatibility
ELBv2 listener, listener-rule and load-balancer ARNs change shape. A consumer asserting one
verbatim sees it change, and a policy scoped to
loadbalancer/*that used to catch listeners nolonger does — which is what AWS does. Recorded state and exported fixtures carrying the old ARNs
still resolve on the tagging path.
Closes #774