fix(logging): build the audit line from a JMESPath allowlist (pack leaks _entry) #64

Merged
sirius merged 1 commit from wt/t_34ddaa83 into master 2026-11-27 05:56:12 +00:00
Owner

Security fix. The first cut used stage.pack, and promtail's pack stage embeds the original line under _entry — so responseObject.data (plaintext secrets) was still written into Loki, just nested.

Replaced with a single JMESPath multi-select hash + stage.output: the stored line contains exactly the allowlisted keys (level, stage, verb, user, resource, apiGroup, ns, name, subresource, code, sourceIP, userAgent, auditID, requestURI) and nothing else, with JSON escaping handled by the library. verb/resource still extracted separately for labels.

Verified end-to-end offline with loki.echo on a synthetic audit record carrying responseObject.data.password:

  • occurrences of the secret value in the emitted entry: 0
  • occurrences of responseObject: 0
  • labels on the entry: {filename, resource="secrets", verb="get"}

Follow-up in the task: the handful of minutes ingested with the leaky config get purged (PVC wiped, audit positions reset) so no copy of those bodies survives anywhere.

**Security fix.** The first cut used `stage.pack`, and promtail's pack stage embeds the original line under `_entry` — so `responseObject.data` (plaintext secrets) was still written into Loki, just nested. Replaced with a single JMESPath *multi-select hash* + `stage.output`: the stored line contains exactly the allowlisted keys (`level, stage, verb, user, resource, apiGroup, ns, name, subresource, code, sourceIP, userAgent, auditID, requestURI`) and nothing else, with JSON escaping handled by the library. `verb`/`resource` still extracted separately for labels. Verified end-to-end offline with `loki.echo` on a synthetic audit record carrying `responseObject.data.password`: * occurrences of the secret value in the emitted entry: **0** * occurrences of `responseObject`: **0** * labels on the entry: `{filename, resource="secrets", verb="get"}` Follow-up in the task: the handful of minutes ingested with the leaky config get purged (PVC wiped, audit positions reset) so no copy of those bodies survives anywhere.
stage.pack embeds the original line under `_entry`, so the first cut wrote
responseObject.data (plaintext secrets) into Loki anyway. Replace pack with a
single JMESPath multi-select hash + stage.output: the emitted line contains
exactly the allowlisted keys and nothing else, with proper JSON escaping.
Verified end-to-end against a synthetic record carrying data.password using
loki.echo: 0 occurrences of the value, labels resource/verb still present.
sirius merged commit 2fbea59ddc into master 2026-11-27 05:56:12 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sirius/homek8s!64
No description provided.