Repository navigation
fix(dynamodb,eventbridge,lambda,cloudtrail,wafv2): publish the member names AWS publishes (#738) - #754
Merged
Conversation
… names AWS publishes (#738) Nine response members carried a Go json tag no AWS SDK reads. Each was checked against the member name in the official API reference rather than swept mechanically: a tag is only a bug when the plugin's protocol serializes Go tags, the struct reaches a response body, and AWS spells the member differently. Of 158 candidate lines, 24 are cases where AWS really does publish the capitalized form — the bare spelling ARN appears on 16 lines and is correct on 15, and FSx genuinely publishes ResourceARN and DNSName — so a blanket ARN -> Arn rename would have broken six correct fields to fix one. DynamoDB's TableArn, LatestStreamArn and both IndexArn descriptors decoded as nil through a real SDK, so a consumer reading TableArn got "" and no error. StackDeployer's own decode of substrate's CreateTable response changes in the same commit or it stops recording table ARNs. EventBridge's rule Arn, Lambda's ESM FunctionArn and EventSourceArn, and CloudTrail's KmsKeyId plus the LogFileValidationEnabled output member (EnableLogFileValidation is the *input* name, still read as such) are the rest. WAFv2 is a behaviour fix, not a rendering one: the wrong name parsed the request too, so a typed SDK's IPV6 CreateIPSet was read as absent and silently replaced by the IPV4 default — the set was created holding the wrong address family with no error. test/e2e had no DynamoDB or WAFv2 client at all, which is how both defects stayed green: the unit tier asserts on substrate's own spelling, and only a typed SDK can decide whether a member decodes. It gains a journey reading all three ARNs off the SDK's TableDescription and an IPv6 round-trip; emulator gains raw-map pinning tests for CloudTrail, EventBridge and Lambda. All fail against the previous code.
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.
Nine response members were published under a name no AWS SDK reads. Every one was checked against the member name in the official API reference rather than swept mechanically, because a Go
jsontag is only a bug when three things hold at once — the plugin's protocol serializes Go tags, the struct actually reaches a response body, and AWS spells the member differently.Of 158 candidate tag lines, 24 turned out to be cases where AWS really does publish the capitalized form: the bare spelling
ARNappears on 16 lines and is correct on 15 of them (Secrets Manager, SSM, WAFv2's Web ACL, CloudFront and ElastiCache all publishARN), and FSx genuinely publishesResourceARNandDNSName. A blanketARN→Arnrename would have broken six correct fields to fix one, so this is per-service.What was wrong
TableArn,LatestStreamArn,IndexArn(GSI and LSI)TableARN,LatestStreamARN,IndexARNArnARNFunctionArn,EventSourceArnFunctionARN,EventSourceARNKmsKeyId,LogFileValidationEnabledKMSKeyId,EnableLogFileValidationIPAddressVersionIPVersionEnableLogFileValidationisCreateTrail's andUpdateTrail's input name — every response publishes the setting asLogFileValidationEnabled— so the input parsing still reads it.PutRule, which wraps a rule's ARN underRuleArn, was already correct. The lowercaseeventSourceARNinside a Lambda stream-record event payload is a different and correct spelling, and is untouched. A trail's ownTrailARNis correct.StackDeployerdecodes substrate's ownCreateTableresponse with an inline tag, so it changes in the same commit — otherwise the deployer would have stopped recording table ARNs the moment the tag was fixed.WAFv2 is a behaviour fix
The wrong member name was used to parse the request as well as to render the response, so a typed SDK — which can only send
IPAddressVersion— had itsIPV6request read as absent and silently replaced by substrate'sIPV4default. The set was created successfully holding the wrong address family, so a consumer's error branch never ran.Why no test caught this
test/e2ehad no DynamoDB or WAFv2 client at all. The unit tier asserts on substrate's own spelling, and only a typed SDK can decide whether a member decodes — which is exactly how nine wrong names stayed green through every release.test/e2e/journey_wire_names_test.gocreates a table with a stream and a GSI and reads all three ARNs off the SDK'sTableDescription, then round-trips an IPv6 IP set. Against the previous code:TableArn is nil,LatestStreamArn is nil,GSI IndexArn is nil,IPAddressVersion = "" want IPV6.emulator/wire_names_738_test.gopins CloudTrail's, EventBridge's and Lambda's members through a rawmap[string]any, asserting both that the published name is present and that the wrong one is absent. All three fail against the previous code.emulator/wafv2_plugin_test.gogains a table-driven round-trip for the three address-version cases.Verified live through the AWS CLI against a built binary:
dynamodb create-table/describe-tablereturn all three ARNs, andwafv2 get-ip-setreportsIPV6. (cloudtrail create-trailstill answersServiceNotAvailable: service not emulated: comthrough the CLI — that is #739's routing miss, unrelated to this change and confirmed by it.)The e2e module gains the
dynamodbandwafv2clients, which requiresaws-sdk-go-v2v1.43.7 there.Compatibility
DynamoDBTableis both the response shape and the persisted record, so the state key renames too: a stream or exported fixture recorded before this change decodes the ARN as empty. Accepted as a fixture break at a minor version rather than carried as a permanent read alias. A fixture asserting that anIPV6request produced anIPV4set also flips.Also re-adds the
## [Unreleased]heading the previous release PR consumed.Closes #738