Skip to content

feat(config): configuration recorder and delivery channel (#580) - #650

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/config-recorder-580
Aug 15, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/config-recorder-580

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

First of seven PRs for #580 (AWS Config, milestone v0.101.0 "detective controls"). This one is the plan's Lane 0 + Lane 1 + Lane 2.

Why the channel ships with the recorder

The plan had these as PRs 1 and 2. StartConfigurationRecorder refuses without a delivery channel, so a recorder-only PR could never reach recording: true — the release's headline behaviour — leaving it untestable. They land together.

What this does

Two operations that look like they answer the same question now disagree. DescribeConfigurationRecorders reporting a recorder says nothing about whether it is recording; that is DescribeConfigurationRecorderStatus.recording. A recorder created and never started is the most common real Config misconfiguration, and a consumer checking only the first call reports an account as covered when nothing is recorded. A Put leaves recording: false; only Start flips it.

The ordering refusals make a sequencing bug observable: NoAvailableDeliveryChannelException on Start without a channel, NoAvailableConfigurationRecorderException on PutDeliveryChannel without a recorder (checked before the bucket, per the operation's own ordering), and LastDeliveryChannelDeleteFailedException on a delete while recording — which is what makes a teardown-and-rebuild fixture express an ordering requirement rather than pass on a sequence AWS rejects.

PutDeliveryChannel computes its S3 refusals from real S3 state, permissively. Missing bucket → NoSuchBucketException; bucket with no policy at all → InsufficientDeliveryPolicyException; a policy passes if any Allow statement's principal covers config.amazonaws.com or * and its action covers s3:PutObject (including s3:Put*, s3:*, *); the resource ARN is not matched, and a shape substrate's parser cannot decode passes. The two failure directions are not symmetric: always accepting hides a bucket-policy bug that is fatal at AWS, while demanding the documented policy verbatim refuses policies AWS accepts — and a wrong refusal breaks working code.

Three seed families (/v1/config/recorder-status, /v1/config/delivery-status, /v1/config/delivery-policy) cover what no API call can reach: substrate delivers nothing to S3, so no sequence of calls produces a failed delivery, and a consumer's delivery-failure branch exists precisely for one. Applied at read time, scoped by account and Region with * wildcards, and validated against the model's enum — NotApplicable is refused in favour of the Not_Applicable AWS actually spells, and an error code on a non-Failure status is refused rather than half-applied.

The routing alias is the hard prerequisite

Config's X-Amz-Target prefix is StarlingDoveService — an internal code name, as TrentService is KMS's — and starlingdoveservice was absent from targetServiceAliases, so it reduced to nothing and every SDK call fell through to service not emulated: starlingdoveservice. Without the alias this plugin would be registered and unit-tested green while unreachable, exactly what #561, #610 and #636 were. A unit test asserts resolution by target prefix, host and SigV4 signing name.

Two defects the live CLI caught, which unit tests did not

Both were fixed against the botocore model, not recall:

  1. configStreamDeliveryInfo is ConfigStreamDeliveryInfo, which carries lastStatusChangeTime and neither of the export shape's lastSuccessfulTime/lastAttemptTime. I had emitted three clones of one shape, putting members in the response an SDK decoding the stream shape cannot read. It also reports Not_Applicable when no SNS topic is configured, per the shape's own note — reporting Success would tell a consumer its alerting works when no topic exists.
  2. The default recording group expressed "not the global IAM types" by synthesizing an exclusionByResourceTypes list of the four types. AWS returns no such list for an allSupported group, and an exclusion list alongside ALL_SUPPORTED_RESOURCE_TYPES is the combination InvalidRecordingGroupException refuses — substrate would have answered with a group it rejects on input. It is now includeGlobalResourceTypes: false, the bundle AWS uses.

Verification

  • gofmt -l, go build ./..., go vet ./..., golangci-lint run ./... → 0 issues
  • make test (race) green; coverage 82.6%
  • make docs-reference docs-reference-check docs-versions, npm --prefix docs run build green
  • Live AWS CLI against substrate server --address :4678 with AWS_MAX_ATTEMPTS=1: reachability, the full bucket-policy progression, recording: false → true, regional isolation, InvalidRoleException, the reserved name prefix, InvalidRecordingGroupException, both status seeds, and the whole teardown ordering sequence. This tier is what catches an unroutable operation.
  • Mutation testing, 10 mutants, no survivors: alias removed (40 failures), Recording: true on Put (8), the Start channel guard dropped, the channel-delete guard dropped, the policy matcher forced permissive and forced strict, tags overwritten on a second Put, the Region dropped from a state key, the stream shape replaced with the export shape, and Not_Applicable collapsed to Success.

Not Closes #580 — that goes on PR 7, once the rules, packs, tagging, CFN stubs and e2e journey have landed.

AWS Config is the detective half of the control loop a consumer builds after
its stacks deploy, and substrate had no plugin for it: none of the 66 services
could answer "is this account being recorded, and is delivery working?".

The headline behaviour is that two operations which look like they answer the
same question must disagree. DescribeConfigurationRecorders reporting a
recorder says nothing about whether it is recording — that is
DescribeConfigurationRecorderStatus.recording — and a recorder created and
never started is the most common real Config misconfiguration. A Put leaves
recording false; only Start flips it.

The ordering refusals make a consumer's sequencing bug observable rather than
silently tolerated: Start without a channel is
NoAvailableDeliveryChannelException, PutDeliveryChannel without a recorder is
NoAvailableConfigurationRecorderException (checked before the bucket, so the
first thing a consumer is told to fix is the first thing it must fix), and
DeleteDeliveryChannel while recording is LastDeliveryChannelDeleteFailed-
Exception — which is what makes a teardown-and-rebuild fixture express an
ordering requirement instead of passing on a sequence AWS rejects.

PutDeliveryChannel computes its S3 refusals from real S3 state, permissively:
a missing bucket is NoSuchBucketException, a bucket with no policy at all is
InsufficientDeliveryPolicyException, and a policy passes if any Allow
statement plausibly admits Config. A shape substrate's parser cannot decode
passes too — the two failure directions are not symmetric, and a wrong
refusal breaks working consumer code.

Three seed families cover the statuses no API call can reach, since substrate
delivers nothing to S3 and so cannot produce a failed delivery. Each is
applied at read time, scoped by account and Region, and validated against the
model's own enum.

The routing alias is the hard prerequisite: Config's target prefix is
StarlingDoveService, absent from targetServiceAliases, so every SDK call fell
through to "service not emulated". Without it the plugin would have been
registered and unit-tested green while unreachable — what #561, #610 and #636
were — so a test asserts resolution by target prefix, host and signing name.

Verified against the model rather than recalled: ConfigStreamDeliveryInfo
carries lastStatusChangeTime and not the export shape's time members, and is
Not_Applicable when no SNS topic is configured; the default recording group
says "not the global IAM types" through includeGlobalResourceTypes false, not
by synthesizing an exclusion list that Put would itself refuse. Both were
caught by driving the real AWS CLI against the server.

Refs #580.
@codecov

codecov Bot commented Aug 15, 2026

Copy link
Copy Markdown

@scttfrdmn
scttfrdmn merged commit 2663652 into main Aug 15, 2026
16 checks passed
@scttfrdmn
scttfrdmn deleted the feat/config-recorder-580 branch August 15, 2026 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant