Repository navigation
test(#756): record the four services that already project - #1308
Merged
Merged
Conversation
API Gateway v1 (#529), API Gateway v2, DynamoDB (#1013) and AppSync (#1121) each render every persisted record they answer through a wire struct. None of them had a line in scripts/wire-bookkeeping-projected.txt, so 34 declared fields across 17 records were still counted as reachable. Verified site by site rather than by the presence of a *_wire.go: every response helper call in all four plugins goes through a projection, and the two API Gateway v1 sites that do not — PutMethodResponse and PutIntegrationResponse — echo the caller's own request body and answer no record. The reachability inventory on #756 lists appsync as leaking accountId and region. It predates #1121 and is stale. Two assertions had to be written before the records could be cited, because an ,omitempty member is absent from a body whenever its value is the zero one: - DynamoDBTable.EverTagged. #1013's subset assertion covers all four description sites but never has the flag set, because CreateTable with a Tags list does not set it — taggingEverTagged is reached from TagResource and UntagResource alone. - RestAPIState.EverTagged, the same shape. That is the vacuous assertion #1304 shipped on EFS before it was caught. Both new tests set the flag, anchor on a response proving it is set, and were checked against a deliberately reintroduced leak on every site they cover. The API Gateway one seeds the flag through state rather than through TagResources, because TagResources cannot currently find an API a caller created: the resolver builds the state key from the ARN's account field, and a REST API ARN's account segment is empty by specification. That is #1307, and the test says so. DynamoDBStreamCursor.AccountID and .Region are named in the script header as a third leak-impossible kind. They are marshalled into a response and still cannot leak: the JSON is base64-encoded into the opaque ShardIterator string, which is what a real shard iterator is too. 319 declared, 47 projected across 21 records, 272 still reachable. Refs #756 Refs #1307
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
Oct 1, 2026
#1311) RDS is the first service #756 has reached that was already answering through a separate item struct rather than encoding its records, so its sixteen baseline lines were reachable-by-declaration with nothing pinning them shut — the position ECS's four already-projecting records were in at #1308. The rendering layer moves out of the 1,361-line rds_plugin.go into emulator/rds_wire.go and emulator/rds_wire_test.go asserts it: 239 still reachable -> 223. RDS is also the first query-protocol service on the projected list, so the assertion is a stronger analogue of the JSON one — the body's whole set of element *paths* is compared against the published shape's, which catches a member rendered at the wrong depth as well as one that should not be there. That is how the three adjacent defects below were found; the negative control confirms every one of the seventeen sites fails when a leaked member is added. Deciding the projection's membership settled three published members substrate held the value for and reported wrongly or not at all: the creation time, now reported as InstanceCreateTime, ClusterCreateTime and SnapshotCreateTime; DeleteDBCluster, which reported three of the eleven members it held; and the cluster's DBSubnetGroup, nested where API_DBCluster publishes a flat string. Writing the test surfaced a fourth — Start, Stop and RebootDBInstance answered an unnamed <Result> element, the result field being untagged so the placeholder substitution had nothing to match. Neither AccountID nor Region has a published home on any RDS shape, and API_DBSnapshot.SourceRegion is not one: it carries a value only for a copy substrate does not perform. Refs #756
This was referenced Oct 1, 2026
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.
Four services were already fixed and were still being counted as broken.
API Gateway v1 (#529), API Gateway v2, DynamoDB (#1013) and AppSync (#1121) each render every
persisted record they answer through a wire struct. None of them had a line in
scripts/wire-bookkeeping-projected.txt, so 34 declared fields across 17 records were stillreported as reachable leak surface. Recording them takes the ratchet from 306 still reachable to
272 without touching a plugin — the cheapest work left on #756, and it was invisible because the
ratchet measures declarations and the discharge lives in a hand-maintained companion file.
Verified site by site, not by the presence of a
_wire.goThe existence of
appsync_wire.goproves nothing on its own — a projection that covers four sitesout of five is worse than none, because it reads as done. So every response-helper call in all four
plugins was checked:
appsync_plugin.go— all 21appsyncJSONResponsecalls pass a…ToWireresult or a literal map.apigateway_plugin.go— every record-bearing call passes a…Wire(…). Two sites pass a barebody:PutMethodResponseandPutIntegrationResponse, which echo the caller's own request bodyand answer no stored record.
TestAPIGatewayWire_CallerSuppliedResponsesPassThroughalready pinsthat.
apigatewayv2_plugin.go— same, including the five collection sites, which are typedapigwV2ItemsOut[v2…Out].dynamodb_plugin.go— all four sites that render a table description calldynamodbTableDescriptionWire; no other path marshals the record.The inventory comment on #756 is stale for AppSync. It lists
appsync | 4 ops | 8 obs | leaks accountId, region. The instrumented pass predates #1121.Two tests had to be written first
A citation that cannot fail is worse than no citation, and two records had exactly that problem. An
,omitemptymember is absent from a body whenever its value is the zero one, so an absence assertionon a record that was never tagged passes on a response that could not have carried the member.
EverTaggedis set byTagResource/UntagResourcealone —taggingEverTagged(#938) is neverreached from a create-with-tags path. So:
DynamoDBTable.EverTagged— DynamoDB: DescribeTable and CreateTable report Tags and TTLAttribute, which TableDescription does not have #1013'sTestDynamoDB_TableDescriptionReportsOnlyItsOwnMembersasserts the description's key set is a subset of
API_TableDescription's at all four sites, and itsets
TagsandTTLAttributedeliberately so those two are non-vacuous. It never sets the flag.RestAPIState.EverTagged—agwNoInternalFieldscoversAccountIDandRegionnon-vacuously (neither carries omitempty, so an unprojected record reports both unconditionally),
but nothing set the flag.
This is precisely the vacuous assertion #1304 shipped on EFS before it was caught, so both new tests
set the flag, anchor on a response proving it is set, and were checked against a deliberately
reintroduced leak:
Failing on every site each test covers (3/3 for API Gateway, 3/3 for DynamoDB), and the AppSync
citation was checked the same way — 6 failures when
accountId/regionare put back onappsyncGraphqlAPIOut.CreateTableandCreateRestApiare excluded from the flag assertions andthe tests say why: both answer before anything can have tagged the resource, so the flag is
necessarily false and the site cannot carry the member.
A bug found on the way — #1307
The API Gateway test seeds the flag through the state manager rather than calling
TagResources,because
TagResourcescannot find a REST API a caller created:The tagging resolver builds the state key from
parts[4], the ARN's account field — and a RESTAPI ARN is
arn:aws:apigateway:{region}::/restapis/{id}, whose account segment is empty byspecification. It looks up
api:/us-east-1/{id}; the plugin wroteapi:123456789012/us-east-1/{id}.TestTagging_TagResources_APIGatewaypasses because it hand-writes a record at the empty-accountkey, documenting the divergence as intent. Filed as #1307 with its own acceptance criteria; the
test here points at it so the workaround is not mistaken for the shape of the problem.
A third leak-impossible kind, named
DynamoDBStreamCursor.AccountIDand.Regionstay in the baseline and are now named in the scriptheader alongside
accountRegionRequestandorgPendingAccountOutcome. This one is the interestingcase: it is marshalled into a response and still cannot leak, because the JSON is base64-encoded
into the opaque
ShardIteratorstringGetShardIteratoranswers. A real shard iterator is opaquetoo, so carrying the account and Region inside it is faithful rather than a divergence. It is left in
the baseline because the day it stops being base64-wrapped is the day these become real, and nothing
lexical would notice.
Also
scripts/wire-bookkeeping-projected.txt's header now states what the single test column means whenmore than one test covers a record: it names the one whose assertions are non-vacuous for every
bookkeeping member the record declares, with the omitempty reasoning spelled out.
Verification
make lint(0 issues),make test(race,-count=1, all green), all seven drift gates, and theper-site negative controls above.
Refs #756
Refs #1307