feat(webhook): harden captured payload redaction

RedactPayload only redacted values under a fixed set of sensitive key
names, so a sender that names a secret field something else leaked it into
captured_events.body. Harden the heuristic:

- broaden the key-name markers (compound names like access_token,
  client_secret, signing_key, x_api_key, webhook_secret, refresh_token)
  and keep gateway.sensitiveParameterKey identical to preserve the
  documented agreement between the two redaction paths.
- add value-shape detection: a compact JWT or a PEM private-key block is
  redacted under any key, catching the 'sender named the field something
  the heuristic misses' gap.
- keep it conservative so schema-by-example field mapping still works:
  only unambiguous shapes (eyJ-prefixed JWTs, PEM key blocks) are
  redacted by value, never ordinary content.

Best-effort per docs/prds/webhook-intake-security.md point 5.

Refs archie-core-t2db (captured_events.body redaction)
This commit is contained in:
sam committed 2026-09-02 23:59:43 +10:00
1 parent 7ee6ee5554
commit c13ec2f225
4 files changed
+138 -24

No files matched your search

+8 -4
View File
@@ -75,10 +75,14 @@ old material must be retained.
## Non-goals / deferred
- **`captured_events.body` redaction upgrade** is deferred (confirmed with
maintainer). The body redaction is a separate best-effort key-name heuristic
with its own documented limits and its own capture-path surface; it is not
bundled into this store-scoped change.
- **`captured_events.body` redaction hardening** was completed alongside this
work (not deferred): `webhookguard.RedactPayload` now redacts an expanded set
of secret key markers (compound names like `access_token`, `client_secret`,
`signing_key`, `x_api_key`, …) as well as unambiguous value shapes (compact
JWTs, PEM private-key blocks) under any key. `gateway.sensitiveParameterKey`
was broadened identically to preserve the documented agreement. It remains
best-effort per `docs/prds/webhook-intake-security.md` point 5 -- a sender
that picks a name the heuristic misses is still captured.
- **Key re-derivation on config reload** is a startup concern: the store holds
the cipher for its lifetime, so a reload that changes `[bindings]` keys
requires a daemon restart to take effect. Documented, accepted.