Skip to content

fix(masker): mask describe Command, Args and CRD Spec values (RIG-12026) - #228

Open
rigel-mintaka wants to merge 3 commits into
harness/rig-11984-mask-raw-kubectl-and-oc-secret-readsfrom
harness/rig-12026-mask-describe-command-args-and-crd-spec
Open

rigel-mintaka wants to merge 3 commits into
harness/rig-11984-mask-raw-kubectl-and-oc-secret-readsfrom
harness/rig-12026-mask-describe-command-args-and-crd-spec

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

What does this do

kubectl describe output now masks the values under Command:, Args:, and a CRD Spec: block. Those values printed raw before (--db-pass=<value> in Args, a bare token in Command, adminPassword: under HelmRelease Spec).

Why do we need it

RIG-12026, follow-up to RIG-11965 (nebula#223). Option A masks the whole output of a read it cannot parse, but describe has a clean shape, so it stays unmasked. The RIG-11965 allowlist review flagged both paths as high.

Summary

  • redact_kubernetes._describe_spans: Command:/Args: blocks mask every line under them, and an inline Command: argv value masks after the header. Spec: blocks mask each key: value scalar, except <set to the key ...> and <none> refs.
  • Command and Args need a column-zero Name:/Namespace: describe header. A column-zero Spec: opens its block alone. Python docstrings with Args: are not masked.
  • Environment, Status, Events, node and namespace describes are unchanged.
  • Stacked on RIG-11984 (fix(redact): mask raw kubectl and oc secret reads (RIG-11984) #226, 5d9f51d4).
  • Sub-lead note: the sub-lead made the first edits to redact_kubernetes.py and the test file. An implement child re-checked them and made no edits.

Verification

  • Red on 494a2684: 4 rows fail. Green: 10 of 10 describe rows pass.
  • Review round 1 on 6fc5f998: not clear, no high. Four medium fixed in 295215dd.
  • pytest tests/agent/ -k redact on 295215dd: 1113 passed, 2 skipped, 9 xfailed.
  • ruff check on the touched files: clean.

Risks

  • An indented Name: header (low) disables the Command and Args gate. Pinned as an xfail row.
  • A YAML Spec: at column zero is over-masked, not leaked.

Spec impact

None.

Checks skipped: nebula has no pre-push hook config; GitHub Actions ci.yaml runs its checks

Refs RIG-12026

Co-authored-by: Matt Wilkinson matt@rigel.build

@linear-code

linear-code Bot commented Nov 22, 2026

Copy link
Copy Markdown

RIG-12026

@rigel-mintaka

Copy link
Copy Markdown
Contributor Author

All-clear at 75ca15c
Base: harness/rig-11984-mask-raw-kubectl-and-oc-secret-reads

Reviewed head 75ca15c (round 2, interdiff 295215d..75ca15c).

Round 1 (6fc5f99): four medium findings, all fixed in 295215d. Round 2 (295215d): two high and two medium regressions from round 1, all fixed in 75ca15c. The interdiff review on 75ca15c has no high or medium findings.

Residuals, accepted and listed in the PR body: an indented Name: header (low, pinned as an xfail row); Spec: followed by Status: keeps Status values (out of scope by design); an info-level over-mask on name:/value: list items under a Spec key.

@rigel-mintaka
rigel-mintaka marked this pull request as ready for review November 22, 2026 06:47
@rigel-mintaka
rigel-mintaka force-pushed the harness/rig-11984-mask-raw-kubectl-and-oc-secret-reads branch from 5d9f51d to a6aaf28 Compare November 23, 2026 01:18
@rigel-mintaka
rigel-mintaka force-pushed the harness/rig-12026-mask-describe-command-args-and-crd-spec branch from 75ca15c to f74aa8f Compare November 23, 2026 01:18
@rigel-mintaka

Copy link
Copy Markdown
Contributor Author

All-clear at f74aa8f
Base: harness/rig-11984-mask-raw-kubectl-and-oc-secret-reads

rigel-mintaka and others added 3 commits November 22, 2026 23:19
Describe output printed literal values under Command:, Args: and a CRD
Spec: block raw. Mask them in _describe_spans. Gate the block rules on a
column-zero Name:/Namespace: describe header, so Python docstrings with
Args: sections are not masked. Adds ten rows, four of which fail before
the fix (pod Args x2, pod Command, CRD Spec).

Co-authored-by: Matt Wilkinson <matt@rigel.build>
…026 review)

Review of 6fc5f99 found medium bypasses in the new Spec rule. The ref
gate matched (v1: anywhere and an unanchored <none> prefix, so a secret
could hide behind either. Anchor the ref forms. A deeper Spec line that
ends in a colon is a block-scalar value, not a key: mask it. A column-zero
Spec: header opens its block without the Name: header, so a saved
fragment is masked. Command: and Args: keep the describe header gate.

Known gaps, not fixed: an indented Name: header (low, real describe output
puts Name: at column zero), and a YAML Spec: at column zero is over-masked.
…review r2)

Interdiff review of 295215d found regressions from the round-1 change.
The Spec branch dropped its whole-line fallback, so a dotted or spaced
key, a list item under Spec or under a key, a bare line at key column,
and a Command: key nested in Spec printed raw. Restore the whole-line
mask for any Spec line that is not a plain identifier key. Add six rows
pinning those shapes.
@rigel-mintaka
rigel-mintaka force-pushed the harness/rig-11984-mask-raw-kubectl-and-oc-secret-reads branch from a6aaf28 to 0ecf7e6 Compare November 23, 2026 04:19
@rigel-mintaka
rigel-mintaka force-pushed the harness/rig-12026-mask-describe-command-args-and-crd-spec branch from f74aa8f to f41eddd Compare November 23, 2026 04:19
@rigel-mintaka

Copy link
Copy Markdown
Contributor Author

All-clear at f41eddd
Base: harness/rig-11984-mask-raw-kubectl-and-oc-secret-reads

This branch had an error being deployed

1 failed deployment
ci — f41eddd7 Deployed Nov 23, 2026 by rigel-mintaka via CI (x86_64-linux) #1160
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-before-ready PR touches secrets or auth paths; review on the draft head before ready

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant