Repository navigation
Production hardening: audit remediation phases 1–3 - #46
Merged
Merged
Conversation
Phase 1 of the production-hardening audit (2026-08-11):
- Panic recovery at every site where one panic ended the process: the
middleware dispatch path (routeSafe mints a generic -32603 and still
exits through audit), fan-out/health workers, background loops (which
resume after a recovered tick), reload/telemetry goroutines,
SDK-invoked bridge/notification handlers, and the audit delivery
worker (via audit.WithPanicHook so its recoveries alert like the
rest). Counted in fold_panics_total{site}; FoldPanicRecovered alert
in both rule files.
- server.sessionIdleTimeoutMs (default 30 min): downstream sessions
expire when idle, so abandoned clients no longer pin gateway state
and upstream subscriptions forever. Construction-wired.
- Public listener: IdleTimeout 120s + explicit MaxHeaderBytes;
embedding docs note the embedder's responsibility.
- fold_downstream_sessions / fold_upstream_bridged_sessions gauges and
a Sessions dashboard panel, so session population is watchable.
Gate: make check green, bench added p50 171µs (< 5ms gate).
Co-Authored-By: Claude Fable 5 <[email protected]>
Phase 2 of the production-hardening audit (2026-08-11): - Release images (fold, fold-discovery, fold-stdio) now ship BuildKit provenance + SBOM in-registry and a sigstore attestation on each digest; the Helm chart's OCI artifact is attested the same way. The images were the one deployment artifact without supply-chain evidence — binaries already had it. - Every workflow `uses:` is pinned to a full commit SHA (a moved tag on a dependency action is code execution inside jobs holding release-signing permissions); golangci-lint binary pinned to v2.12.2. Dependabot maintains the SHA pins. - Base images pinned by digest in deploy/docker; a new Dependabot docker ecosystem keeps the digests moving. - Release workflow default permissions dropped to contents: read; each job declares exactly what it needs. - docs/deploy.md: "Verifying what you deploy" — gh attestation verify for images, chart, and binaries. Co-Authored-By: Claude Fable 5 <[email protected]>
…edges
Phase 3 of the production-hardening audit (2026-08-11):
- /oauth/token now obeys the single-exit-door rule: every terminal
response (mint, invalid assertion, rate-limited 429, and above all a
detected ID-JAG replay) emits one audit event under
method="oauth/token", with the exchange outcome verbatim in the
decision field so a replay is alertable structurally. Wired via
auth.EMA.OnExchange so auth stays decoupled from audit.
- Fold-minted -32041 messages are generic ("details in gateway logs"):
raw transport errors name internal endpoints and can name secret
env vars — the same strings /health already redacts. Details stay on
the gateway's warn lines.
- timeouts.streamIdleMs is implemented (it was schema-validated and
documented but read nowhere): opt-in idle bound on the standalone
upstream SSE stream, cutting a wedged stream so the SDK client
retries it. Deliberately not defaulted on — the client's reconnect
budget only replenishes when events arrive, so a default cut against
a legitimately quiet upstream would eventually kill its session.
defaults.md corrects the never-true "120 s" claim.
- One connect attempt walks at most 3 endpoint candidates instead of
every replica (K x connectTimeout per caller while all are down).
- Negative timeout/breaker values are rejected (the schema always said
minimum 0); static health-probe and discovery poll intervals are
clamped to the same floors the discovery path already enforced.
- MemOnce (jti single-use records) moved onto internal/bounded (100k
cap), closing the one identifier-keyed store that was unbounded and
removing an O(n) scan per exchange.
Reviewed by the security-auditor agent; its streamIdle-default finding
(SDK no-progress retry budget) is why the knob ships opt-in.
Gate: make check green, bench added p50 within gate.
Co-Authored-By: Claude Fable 5 <[email protected]>
This was referenced Aug 12, 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.
Remediates the high- and medium-severity findings from the 2026-08-11 production-hardening audit (three parallel review lanes: security model, runtime robustness, deploy & supply chain), in three commits:
Phase 1 — survive panics, expire idle sessions, bound the listener (
65d4981)routeSafemints a generic-32603and still exits through audit — the single-exit-door rule holds), fan-out/health workers (degrade to partial failure), background loops (resume after a recovered tick), reload/telemetry goroutines, SDK-invoked bridge/notification handlers, and the audit delivery worker (viaaudit.WithPanicHookso its recoveries alert like the rest). Counted infold_panics_total{site};FoldPanicRecoveredalert ships in both rule files.server.sessionIdleTimeoutMs(default 30 min, construction-wired): abandoned downstream sessions no longer pin gateway state and upstream subscriptions forever, andreapSubscribersactually releases what they held.IdleTimeout120s + explicitMaxHeaderBytes; embedding docs note the embedder's responsibility (and warn offWriteTimeout, which would sever SSE).fold_downstream_sessions/fold_upstream_bridged_sessionsgauges + dashboard panel.Phase 2 — supply chain (
c5a70be)gh attestation verify oci://…documented in docs/deploy.md). Images were the one deployment artifact without supply-chain evidence.uses:SHA-pinned with version comments (Dependabot maintains the pins); golangci-lint pinned; base images digest-pinned with a new Docker Dependabot ecosystem; release-workflow default permissions dropped tocontents: read.Phase 3 — audit-trail and config-contract integrity (
ba6d62a)/oauth/tokenjoins the audit trail: every terminal response — mint, invalid assertion, rate-limited 429, and detected ID-JAG replay — emits one event undermethod="oauth/token", with the exchange outcome verbatim in thedecisionfield so replays are alertable structurally.-32041messages redacted (raw transport errors named internal endpoints and secret env-var names); details stay on gateway log lines.timeouts.streamIdleMsimplemented as opt-in — it was schema-validated and documented but read nowhere. Not defaulted on: the SDK client's reconnect budget only replenishes when events arrive, so a default idle cut against a legitimately quiet upstream would eventually kill its session (security-auditor finding on the first cut of this fix).defaults.mdcorrects the never-true "120 s" claim.Validatewith the schema'sminimum: 0); poll intervals floored at 1s;MemOncebounded at 100k oninternal/bounded.Verification
make checkgreen at each phase (gofmt, tidy, vet, build,go test -race, golangci-lint 0 issues)🤖 Generated with Claude Code