Repository navigation
fix(hermes): mask Kubernetes Secret data and env values (RIG-11725) - #214
Closed
rigel-mintaka wants to merge 4 commits into
Closed
rigel-mintaka wants to merge 4 commits into
rigel-mintaka wants to merge 4 commits into
Conversation
Add a Kubernetes pass to redact_sensitive_text. It masks Secret data and stringData values (YAML and JSON, including truncated JSON), env value entries under a secret-named name (YAML, JSON either order, kubectl describe Environment blocks). Keys, ConfigMap data, valueFrom and non-secret env stay. All scans are linear; a 1 MB test runs under 1 s. Refs RIG-11725 Co-authored-by: Matt Wilkinson <matt@rigel.build>
Move the Kubernetes pass to agent/redact_kubernetes.py, a span-based module. JSON is read in one token pass with an object stack. Each object is decided when it closes or when the text ends, so kubectl key order (data before kind), cut-off output, Lists, SecretList and the last-applied-configuration annotation are masked. YAML is read in one line pass. Helm flow env, Go-map env and describe lines are covered. Secret names add PASS, PWD and AUTH; _TTL, _PATH and _FILE names stay visible. Every review probe row is a test; 1 MB perf rows run under 1 s. Refs RIG-11725 Co-authored-by: Matt Wilkinson <matt@rigel.build>
Run the PEM block pass before the Kubernetes pass, and mask every continuation line of a describe env value. A list item with no kind is decided by its list (SecretList, or unknown at end of text). A kind cut off mid-word counts as unknown. JSON env after a one-word jsonpath prefix is checked again. Setting names (MAX_, _TOKENS, _ENABLED, _MODE, _LENGTH, _DAYS and similar) stay visible through a name allowlist; the _ID exemption is gone. file_read masks with the non-reusable sentinel. JSON nesting is capped at 512. Refs RIG-11725 Co-authored-by: Matt Wilkinson <matt@rigel.build>
…v names Refs RIG-11725 Co-authored-by: Matt Wilkinson <matt@rigel.build>
Contributor
Author
|
Hold: masking gaps at 2d4fc6f (read-only review; code not run). High
Medium
Low
The hold lifts at a new head that fixes the three high findings and the medium one, adds a leak-row test for each, and has an exact-head all-clear. The RIG-11887 bans stay until then. |
rigel-mintaka
marked this pull request as draft
November 22, 2026 04:51
Contributor
Author
|
Hold: RIG-11965 option A first; fallback C after EOD 11-22 ET |
Contributor
Author
|
Superseded: option A chain (includes these commits) ships as a new PR; link follows. |
rigel-mintaka
deleted the
harness/rig-11725-mask-kubernetes-secret-data-and-env
branch
November 22, 2026 05:12
Contributor
Author
|
Superseded by #223, which includes this PR's commits and carries the option A fail-closed masker (RIG-11965). Closing this one as replaced. |
This branch had an error being deployed
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.
What does this do
Hermes tool-output redaction now masks Kubernetes Secret data and secret-named env values in YAML, JSON,
kubectl describeand cut-off output.Why do we need it
A
kubectl get secret -o yaml, a Pod spec or a describe run through Hermes put Secret values in the transcript. The upstream agent extension already masks these, but Hermes did not.Summary
agent/redact_kubernetes.py. It masks Secretdata/stringDataand env values whose names hold a secret word, and it handles cut-off, listed and annotated objects._NOT_SECRET_NAMES).*_FILEvalue is masked unless it is an absolute path._strip_propswalks the line once, so it runs in linear time.Verification
*redact*tests: 1099 passed, 1 xfailed.ruff checkis clean.strip_props_amp_chainwent from 3260 ms to 46 ms.136515fe(4 low).Fix11725r3(implement) ran 13 min over 8 requests with no edits, soimplement-hardtook round 3.Risks
Known lows:
TOKEN_URLwith a secret in the query leaks.JDBC_URL=…?password=leaks; it is pre-existing and belongs to the base redactor.*_FILEvalue that starts with/stays visible.AUTH_TIMEOUT.Spec impact
Spec-impact: none. Redaction only.
Checks skipped:
nebula has no pre-push hook config; GitHub Actions ci.yaml runs its checksRefs RIG-11725
Co-authored-by: Matt Wilkinson matt@rigel.build