Repository navigation
fix(#756): render EFS responses from the published shape - #1304
Merged
Merged
Conversation
All three EFS records were handed to the JSON writer directly at each of the ten sites that answer a resource, so every one of those bodies carried AccountID and Region unconditionally, ever_tagged on a tagged record, and CreatedAt as an RFC3339 string on a file system. AWS publishes none of the four. EFS is taken first because its leak is not merely an extra member but a near-miss of a real one: API_FileSystemDescription publishes CreationTime, in epoch seconds, Required: Yes. emulator/efs_wire.go projects the records onto the published shapes, which also closes CreationTime and SizeInBytes on a file system and OwnerId on an access point and a mount target — the last two from the AccountID that was leaking, so the value reaches the caller under its published name rather than being deleted. The records keep AccountID, Region and EverTagged: removing a persisted member changes the format of every recorded run, and TaggingPlugin.scanEFSFileSystems reads EverTagged besides. EFS therefore keeps its nine baseline lines and earns three entries in scripts/wire-bookkeeping-projected.txt — 330 declared, 13 projected, 317 still reachable. Refs #756
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Sep 30, 2026
scttfrdmn
added a commit
that referenced
this pull request
Sep 30, 2026
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
This was referenced Sep 30, 2026
scttfrdmn
added a commit
that referenced
this pull request
Oct 1, 2026
All six Glue records were answered to the caller as stored, so each of the twelve operations that reports a database, table, connection, crawler, job or job run carried AccountID and Region unconditionally and ever_tagged once the resource had been tagged. API_Database, API_Table, API_Connection, API_Crawler, API_Job and API_JobRun publish none of the three. emulator/glue_wire.go projects each record onto its published shape, on the pattern ecr_wire.go established (#1090). Twenty-one baseline lines discharged: 260 still reachable to 239. Glue is where the leak is worst, because it is not merely an extra member. Substrate stores one creation timestamp field on every record, and Glue publishes that timestamp under four different names — CreateTime on API_Database and API_Table, CreationTime on API_Connection and API_Crawler, CreatedOn on API_Job — so on five records out of six the stored name was a near-miss of a real member, and a caller reading CreateTime found nothing while the value sat beside it. Only API_JobRun's StartedOn/CompletedOn were already spelled right. The same five rendered as RFC3339 strings where Glue's JSON protocol publishes an epoch-seconds number; API_GetDatabase's Response Syntax is literally "CreateTime": number. That closes Glue's instance of #1305, which still stands for ACM, Redshift Data and Firehose. Every member is Required: No and is a *EpochSeconds rather than a bare one, since `,omitempty` is inert on a struct type and a zero EpochSeconds marshals as null. Deciding a response's membership surfaced two members AWS publishes on no Glue shape at all: Arn, on five of the six records, and Tags, on four. Glue's tag surface is GetTags/TagResource/UntagResource, and an ARN is built from the account, the Region and the name, which is what the real API requires of a consumer. Where the leaked account legitimately goes is CatalogId, which API_Database and API_Table publish and the other four shapes do not — the move #1304 made for EFS's OwnerId. The twenty-one fields stay on the records: a projection changes the response and leaves the state a replay reads back alone. A new test reads all six records out of state to pin that, since scanGlueDatabases reads Arn, Tags and EverTagged across the service boundary. No per-site exclusion is needed in check-wire-bookkeeping.sh — every projected timestamp is renamed to its published name, so no wire field collides with the five names the awk matches. docs/services.md also corrects the GetJobRun row, which claimed a transition to SUCCEEDED after describe. StartJobRun stores the run SUCCEEDED with both timestamps set, and getJobRun mutates nothing, so a wait loop passes on its first observation. Refs #756
This was referenced Oct 1, 2026
scttfrdmn
added a commit
that referenced
this pull request
Oct 2, 2026
* test(#756): pin the Step Functions projections and record them `StateMachineState`, `ExecutionState` and `ActivityState` declare `AccountID` and `Region` under wire-visible `json` tags, and the two taggable ones also declare `EverTagged` as `ever_tagged` — eight of the wire-bookkeeping inventory's lines. None of the eight can reach a body. All eighteen routed operations answer through `statesJSONResponse` with a hand-built map, one of the two named projections `smToMap` and `execToMap`, or a list entry struct declared inside its own handler; `listTagsForResource` decodes the stored record into a one-member struct and answers only its tags; and every `json.Marshal` of a record in the plugin is in a `save*` helper writing to state. So the projection already existed in code and what was missing was the citation the projected inventory requires. `emulator/stepfunctions_wire_test.go` holds one test per record, each driving every operation that answers it and walking the decoded document for a member named for any of the three at any depth. The comparison is case-insensitive: the records spell their tags with the Go identifier while every published member of every shape here is lowerCamelCase, so nothing in a correct body folds to any of them. It is on the member *name* because the account and the Region appear legitimately in every body as segments of a `states` ARN. `ever_tagged` is the part that needed care. It carries `,omitempty` and is set by `TagResource` alone — never by create-with-tags (#938) — so the state-machine and activity tests tag the resource and require the flag on the stored record before requiring its absence from a response. Without that step the absence would hold of a record that never carried the member, which is the vacuous form #1304 shipped on EFS. A control confirms it: removing the stamp fails both tests at the record anchor rather than at an assertion on a body. Deliberately not the stronger form `emulator/rds_wire_test.go` uses, which requires a record's members to be exactly the published ones. `smToMap` answers seven of `DescribeStateMachine`'s fourteen published members and `describeActivity` three of five; an expectation keyed on that would have to be rewritten by the PR that closes the gap, and the absence walk is indifferent to it. That is also the form Config, Glue, EFS and Redshift already use. Six of the eighteen carry nothing a projection could leak — `UpdateStateMachine` answers only `updateDate`, `StopExecution` only `stopDate`, and the two deletes and the two tag writes an empty object — and are driven anyway, so the set reads as complete rather than as a sample. A control injecting a leak at each of the twenty-one assertion sites confirms every subtest fails at its own site and at no other, so none of them is decoration. `make wire-bookkeeping-check` moves to 159 projected across 62 records, 160 still reachable of the same 319 declared. * test(#756): correct DescribeActivity's published member count to four API_DescribeActivity publishes activityArn, creationDate, encryptionConfiguration and name — four members, not the five the first reading recorded. The claim is load-bearing twice over: it is the stated reason this file asserts absence rather than exact membership, and it is the count the follow-up issue on the member gap will cite.
scttfrdmn
added a commit
that referenced
this pull request
Oct 2, 2026
Six baseline lines, two per record: BackupVault, BackupPlan and BackupSelection each declare AccountID and Region under wire-visible json tags. None reaches a response — the vault answers through backupVaultOut since #1325, and every plan and selection response is a map built member by member — but the projected inventory refuses a record until a named test asserts it on the raw bytes. emulator/backup_wire_test.go drives all twelve routed operations across three parallel tests and walks each decoded document, failing on a member named for either at any depth and reporting the $.a.b[0].c path. The walk covers the whole document rather than a record's subtree, which matters here: GetBackupPlan and GetBackupSelection nest the record's published members under BackupPlan and BackupSelection while answering others flat, so "the record's subtree" is not one place, and a member rendered on the envelope would pass a subtree walk. Absence rather than exact membership, which is the weaker of the two forms in the suite: DescribeBackupVault answers 5 of API_DescribeBackupVault's 17 published members and ListBackupVaults 5 of API_BackupVaultListMember's 13, so an exact expectation would pin that gap (#1199) and have to be rewritten by the PR closing it. Nothing here is vacuous for free. Neither member carries ,omitempty on any of the three records, and Backup routes no tag operation, so no record declares EverTagged and #1304's trap cannot arise; the records are read back as raw JSON as the presence anchor regardless. Each case also asserts a published member is present before asserting a bookkeeping one is absent, so a body that failed to render the record fails as a missing anchor rather than passing as an absence. The three deletes answer {} and read nothing off the record. They are driven anyway, so the set of twelve reads as complete rather than as a sample, and a control confirms all three subtests fail if a member is added to the empty object. Four more controls were run: a leak reintroduced on backupVaultOut, on one plan map and on one selection map each failed exactly the one test citing that record and no other, and a misspelt citation was refused by check-wire-bookkeeping. 159 projected across 62 records to 165 across 65; 160 still reachable to 154. No assertion equates a timestamp — TimeController.Now advances from its baseline by elapsed wall time, and pinning a Backup date's rendering is emulator/backup_dates_test.go's job (#1324).
scttfrdmn
added a commit
that referenced
this pull request
Oct 2, 2026
Three records — CodeDeployApp, CodeDeployGroup and CodeDeployDeployment — each declare AccountID and Region under wire-visible json tags, six of the inventory's lines. #1327 projected all three through emulator/codedeploy_wire.go; this records that the projection holds, which is what scripts/wire-bookkeeping-projected.txt asks for before it will discharge a line. emulator/codedeploy_wire_test.go holds one test per record, together driving all nine routed operations and walking each decoded document for a member named for either at any depth, reporting the $.a.b[0].c path. Absence rather than exact membership, because GetApplication answers 4 of 6 published members, GetDeploymentGroup 4 of 23 and GetDeployment 6 of 31 (#1199), so an exact expectation would pin that gap and have to be rewritten by the PR closing it. The comparison folds case, so one entry covers both the record's spelling and the AccountID a projection in the house style of the other services might introduce, and it is an equality rather than a substring test, so the account inside a serviceRoleArn value is not a collision. Each case asserts a published member is present before asserting a bookkeeping one is absent, and the stored record is read back as raw JSON, so neither half can pass vacuously. Neither member carries ,omitempty on any of the three records and CodeDeploy routes none of the three tag operations, so no record declares EverTagged and #1304's trap does not arise. check-wire-bookkeeping goes from 165 projected across 65 records to 171 across 68, and from 154 still reachable to 148, of the same 319 declared. #756 stays open: EC2's 30 lines and a long tail remain in AC3.
scttfrdmn
added a commit
that referenced
this pull request
Oct 2, 2026
EC2Instance, EC2KeyPair, EC2LaunchTemplate and EC2PlacementGroup are the last four EC2 records, ten of the inventory's lines. Four tests extend emulator/ec2_wire_test.go and drive twenty-four routed operations, CreateFleet among them since a fleet's instances are EC2Instance records too. Two of the four carry a third bookkeeping member under omitempty, and each is read back from the record before any absence is asserted. EverTagged is set only by a tag write (#938), so the instance test calls CreateTags first; a control without it fails at the read-back rather than passing vacuously, which is the trap #1304 fell into on EFS. CreatedAt is written on both key-pair create paths and DescribeKeyPairs is anchored on the published createTime it feeds. check-wire-bookkeeping goes from 191 projected across 78 records to 201 across 82, and from 128 still reachable to 118, of the same 319 declared. All thirty of EC2's baseline lines are now cited. #756 stays open: 118 lines remain in AC3's tail.
scttfrdmn
added a commit
that referenced
this pull request
Oct 2, 2026
…d inventory (#1337) Some records declare a bookkeeping field but never reach an AWS response at all, so no raw-bytes test can say anything about them: a test that an unrelated response omits their members would pass whatever they held, #1304's vacuous assertion applied to a whole record. scripts/wire-bookkeeping-internal.txt records each as a reviewed decision: a kind (request, state or substrate) and an anchor naming the decoder, the reader or the /v1 route that keeps it off every AWS response. check-wire-bookkeeping refuses a line whose type has no baseline entry, whose kind is unknown, whose record the projected file also claims, or whose anchor no longer occurs in a non-test file, and subtracts the rest from still-reachable. Six records, read reader by reader: accountRegionOpt (read only by loadRegionOpt; responses render its Status), accountRegionRequest (decoded by regionInput), orgPendingAccountOutcome (stored and read by pendingCreateOutcome; the response renders the published CreateAccountStatus), Event (rendered by the debug export; Cost Explorer only aggregates it), debugEventSummary (/v1/debug/events) and SESv2CapturedEmail (/v1/emails). Five records that looked internal are not, and stay in the baseline for a projected test: STSSessionCredentials (xmlCreds), CFNStackState (cfnStackItem), CFNChangeSet (CreationTime in DescribeChangeSet and ListChangeSets), and the two stream cursors base64-encoded into ShardIterator. 319 declared, 219 projected, 9 internal, 91 still reachable. #756 stays open.
This was referenced Oct 3, 2026
Merged
scttfrdmn
added a commit
that referenced
this pull request
Oct 3, 2026
…ord them (#1359) LambdaFunction and SQSQueue declare only ever_tagged, and Route53HostedZone only its AccountID; none reaches a response. Lambda and SQS answer configurations and maps built member by member, and Route 53 answers XML structs declared per operation. Three new tests walk every operation that answers the record. The Lambda and SQS tests tag first and read the flag back, since an unset omitempty member is absent for free (#1304). Lambda's TagResource answers 204 with no body, so it has nothing to walk. wireRecordByPrefix joins emulator/wire_members_test.go for SQS, which keys a queue by its URL. check-wire-bookkeeping goes from 281 projected across 118 records to 284 across 121, and from 29 still reachable to 26. #756 stays open.
scttfrdmn
added a commit
that referenced
this pull request
Oct 3, 2026
…cords' bookkeeping and record them (#1361) EC2CapacityReservation and EC2Fleet declare an account and a Region, and CloudFrontDistribution its AccountID and ever_tagged. None reaches a response: each is rendered through XML structs declared per operation. Two tests join emulator/ec2_wire_test.go. The new emulator/cloudfront_wire_test.go tags the distribution first and reads the flag back, since an unset omitempty member is absent for free (#1304). Writing the CloudFront test found that CreateInvalidation answers an Invalidation without its required InvalidationBatch. That is filed as #1360, and the test anchors on what does render. check-wire-bookkeeping goes from 284 projected across 121 records to 290 across 124, and from 26 still reachable to 20. #756 stays open.
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.
Refs #756— the first service projected after #1090's ECR, on the measurement PR #1303 justlanded.
The defect
All three EFS records —
EFSFileSystem,EFSAccessPoint,EFSMountTarget— were handed toefsJSONResponsedirectly at each of the ten sites that answer a resource. Every one of thosebodies carried
AccountIDandRegionunconditionally (neither hasomitempty),ever_taggedona record that had been tagged, and, on a file system,
CreatedAtas an RFC3339 string. AWSpublishes none of the four.
EFS is taken first because its leak is not merely an extra member but a near-miss of a real
one.
API_FileSystemDescriptionpublishesCreationTime, "the time that the file system wascreated, in seconds (since 1970-01-01T00:00:00Z)", Required: Yes. A consumer reading
CreationTimeoff a substrate response got nothing, while a member one letter-group away held the value under the
wrong name and the wrong type.
What the projection closes
emulator/efs_wire.gorenders the three published shapes from the persisted records, onecr_wire.go's pattern. That also fills in three members substrate reported nowhere, each named bythe reference:
CreationTime, as epoch secondsAPI_FileSystemDescription, Required: YesSizeInBytesAPI_FileSystemSize:ValueLong, minimum 0, Required: YesOwnerIdon the access point and the mount targetAPI_AccessPointDescription,API_MountTargetDescriptionSizeInBytes.Valueis0— substrate stores no file data, so that is the metered size of a filesystem nothing has written to, within the published range and inventing nothing — with the file
system's own creation time as its
Timestamp, because that is when the 0 was determined. Anadvancing timestamp would claim a re-measurement that never happened.
ValueInIA,ValueInStandardandValueInArchivestay absent rather than present and zero, per #1013: nostorage class is modelled, so a zero there would read as a measurement.
Tagsis always an array,never
null, since it is Required: Yes.OwnerIdis where the leakedAccountIDgoes. Same value, published name — the same fix ratherthan a second one.
What stays, and why
AccountID,RegionandEverTaggedstay on the records inemulator/efs_types.go, untouched.ecr_wire.gostates the rule: removing a persisted member, or retyping one in place, changes theformat of every recorded run, because
MemoryStateManagersnapshots those bytes and a replay readsthem back.
EverTaggedcrosses a service boundary besides —TaggingPlugin.scanEFSFileSystemsreports it onGetResources.So EFS keeps its nine lines in
scripts/wire-bookkeeping-baseline.txtand earns three entries inscripts/wire-bookkeeping-projected.txt:No baseline line added or removed, which is the whole point of splitting the two files.
A provenance note worth keeping
AWS's own
API_CreateFileSystempage disagrees with itself. Its Response Syntax publishes"OwnerId","FileSystemId","NumberOfMountTargets"and"CreationTime": number; both of itssample responses render
"ownerId","fileSystemId","numberOfMountTargets"and"CreationTime":"1403301078"— lower camel, and the timestamp quoted. The Response Syntax is whatthe SDK decoder follows, so it is what these types match. Recorded in the file's preamble so
someone comparing substrate against the example does not read the match as the defect.
Tests
emulator/efs_wire_test.go, on a frozen clock (FreezethenSetTime, in that order —TimeController.Freezesays why; an unfrozen controller advances with real elapsed time andEpochSecondsrenders three decimals, so half a millisecond on a loaded machine would move theasserted value).
TestEFS_ResourceResponsesCarryNoBookkeepingMember— the test the projected file cites, over allten sites, each with a presence anchor so an absence assertion cannot pass vacuously. The file
system and access point are tagged through the API before being described, because only
TagResourcesetsEverTagged— creating with tags does not — andever_taggedcarriesomitempty, so without that the assertion would have passed for free.TestEFS_FileSystemPublishesCreationTimeAndSizeInBytes—CreationTimeis the bare number1709251200.000and not a quoted string;SizeInBytes.Valueis 0; the three breakdowns are nil.TestEFS_AccessPointAndMountTargetPublishOwnerId.TestEFS_UntaggedFileSystemReportsAnEmptyTagArray—[]and notnull, standing in for thethree nil-slice guards the projection replaced.
TestEFS_ProjectionLeavesTheRecordIntact— the other half of the claim: the record read back outof state still carries
AccountID,Region, atime.TimeCreatedAtand a trueEverTagged.100% coverage on every function in
emulator/efs_wire.go.Verification
make lint(0 issues),make test(race,-count=1) green, anddocs-reference-check docs-versions version-check discarded-unmarshal-check wire-bookkeeping-check operation-catalog-check operation-docs-checkall pass.Deviations from the plan
SizeInBytes.Timestampwould come from the simulated clock. Itcomes from the record's own
CreatedAtinstead: truthful for the reason above, and it keeps theclock out of the projection.
efsJSONResponsesites. There are ten — the single-resource filtered armsof
DescribeAccessPointsandDescribeMountTargetsare separate returns. All ten project and allten are asserted.
#756 stays open: 24 services remain, and the per-service decision table is AC2.