carlos / platform Public

AWS stall bounds: follow-ups after the scoped check open

On branch audit-aws-timeouts

LLM

Follow-ups from Astra's scoped check of branch audit-aws-timeouts (after round 2; CHECK PASSED, no P1). These were left out of the branch on purpose: stopping rule 2 had triggered, Paul chose central enforcement, and the check is not a new review round. None is a regression against main, which had no body bound before. All three in the root-worker liveness family unless noted.

  1. Credential clients don't get the body bound. internal/rootaws/stall.go (loadingClient) leaves the STS, SSO and web-identity clients the SDK builds while loading credentials (aws-sdk-go-v2/config resolve_credentials.go:244-254, 527, 582) on the loading client: header bound and HTTP/1.1, but no body bound. An STS response that stalls mid-body can hold a credential refresh, and the credentials cache does not cancel a shared retrieval. Boxes use IMDS, which keeps its own short timeouts, so this mostly affects assume-role and web-identity paths. Fix: apply the body bound to the loader's clients too, keeping CA bundles and IMDS's timeouts, and test a stalled credential response through the real loader.
  2. An explicit BuildableClient override is replaced (configuration compatibility). boundConfig tells owned clients from caller clients by concrete type, so WithHTTPClient(awshttp.NewBuildableClient()...) becomes the bounded HTTP/1 client. Track whether the client came from our default or from the caller, and test both override kinds. No root-binary caller does this today; the guard bans WithHTTPClient there.
  3. The guard test misses ordinary bypasses. TestAWSClientsAreBounded (internal/rootaws/guard_test.go:206) does not see cfg.HTTPClient = &http.Client{}, a zero-value aws.Config filled in field by field, or a service option callback that sets o.HTTPClient. Use type information, or allow construction only through approved factories, with negative fixtures for each form. Also narrow the file-wide allowlist entries to the specific constructions, and fix the hostenv/awsssm.go comment ("non-root" is wrong: host-env write needs root).

Also from the implementer: about 12 host-agent loops are still unbounded where they wait on systemctl or journalctl with no timeout (adoptLoop, fastConvergeLoop, statusLoop, configSync/configGen behind their mutexes). See the branch's build report; it's a separate follow-up from the AWS work.

LLM

Follow-ups from Astra's review of aws-followups-1143 (P3s, not built there): (1) the AWS client guard exempts every directly returned aws.Config{} without checking it comes with an error, and a zero-valued config or Options held as a struct field still escapes; add fixtures and enforcement. (2) go.mod marks github.com/aws/aws-sdk-go-v2/service/sso and ssooidc as indirect though internal/rootaws now imports them directly; fix with go mod tidy in its own small change. (3) The root host-env worry raised during the build (credential_process read by root on the non-group path) is not real: main.go scrubs the environment before dispatch, including both shared-file paths.

LLM

Found while fixing aws-followups-1143: a race between the AWS SDK and Go's HTTP client. For a POST, the SDK closes the request body as soon as response headers arrive; if Go is still finishing the request write at that moment it treats the SDK's end-of-body signal as a write error and closes the connection under the response (use of closed network connection). It showed about one run in five against loopback STS fixtures; the tests work around it with a test-only middleware (withoutWriterTo). Production can hit it when a server answers very fast, mostly on loopback. Worth a minimal reproduction and an upstream look, or the same middleware in production if it reproduces against real endpoints.