Skip to content

fix(hermes): mask kubectl cp and oc rsync read-backs (RIG-12066) - #244

Open
rigel-mintaka wants to merge 1 commit into
harness/rig-11984-close-kuberc-env-vmodule-and-describefrom
harness/rig-12066-mask-kubectl-cp-and-oc-rsync-read-backs
Open

rigel-mintaka wants to merge 1 commit into
harness/rig-11984-close-kuberc-env-vmodule-and-describefrom
harness/rig-12066-mask-kubectl-cp-and-oc-rsync-read-backs

Conversation

@rigel-mintaka

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

Copy link
Copy Markdown
Contributor

What does this do

Masks secret values that come back through a terminal read after kubectl cp or oc rsync copies a file out of a pod.

  • Each copy registers the copied file's values for that terminal session, so any later read of them is masked. That covers indirect reads like cat $(ls), xargs and git diff.
  • A value is registered when it has at least 8 characters, no whitespace, and a digit or symbol, or is 20+ characters. YAML keys, comments and list markers are skipped; list items, # text and padded base64 are registered.
  • When a size or count bound is hit, it falls back to masking reads of the copied path. Non-local backends keep path tracking only.

Why do we need it

Matt ruled (RIG-12066) to mask copied values rather than block the commands.

Summary

  • tools/terminal_tool*.py: records copy destinations and values per session; masks read-backs; writes an audit line without the value.

Verification

  • 102 targeted tests pass on macpro2013.
  • Review rounds 1 to 7; round 7 (a5ea3da1) is clean. Its probes mask every round-3, 5 and 6 leak on direct and indirect reads, and echo hello stays clear.

Risks

Over-masking of short structured values, e.g. kube-system after copying a Deployment. Known limits: all-letter values under 20 characters, values with whitespace, files over 64 KiB, and the full value cap. The read_file tool and background output are out of scope.

Rollback: revert this commit.

Spec impact

Spec-impact: none.

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

Refs RIG-12066

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

Track copied pod paths and bounded local values per terminal session; limits fall back to destination path tracking.
Registered values have at least eight characters, no whitespace, and a digit or symbol unless at least 20 characters. Over-masking of short structured values is accepted; a leak is not.
Known limits: all-letter secrets under 20 characters and values containing whitespace are not registered; indirect reads can leak values from skipped files or after the value cap is reached.
Non-local backends retain path tracking because their files are not host accessible. The read_file tool and background output are out of scope.

Co-Authored-By: Matt Wilkinson <matt@rigel.build>

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@linear-code

linear-code Bot commented Nov 23, 2026

Copy link
Copy Markdown

RIG-12066

@rigel-mintaka

Copy link
Copy Markdown
Contributor Author

All-clear at 67fec22
Base: harness/rig-11984-close-kuberc-env-vmodule-and-describe

@rigel-mintaka

Copy link
Copy Markdown
Contributor Author

Review rounds 1-7 (RIG-12066)

  • Rounds 1 to 6 found leaks through indirect reads (cat $(ls), xargs, git diff), bounds that failed open, and over-masking of YAML keys. Each round was fixed and re-reviewed.
  • Round 7 at a5ea3da1 was clean: 0 high, 0 medium, 0 low. Probes r3, r5 and r6 mask every earlier leak, and echo hello stays clear.
  • Known limits are listed in the body and the commit message. They are not findings.
  • The pushed head 67fec228 differs from a5ea3da1 only in the commit message.
  • Step-up recorded: Impl12066 spent 26 min, needed two nudges and produced only tests, so the slice moved to Hard12066.

This branch had an error being deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant