Repository navigation
skills(running-in-ci): close the env-filter loophole for ALL_INPUTS secrets - #599
Conversation
…ecrets The Secrets rule already forbids `env`/`printenv`/etc., but a name-only filter like `env | cut -d= -f1` reads as a safe escape hatch — it isn't. claude-code-action injects ALL_INPUTS as a multi-line JSON env value embedding claude_code_oauth_token and github_token; newlines defeat the filter and the secrets leak verbatim into the session log. Run 26358181381 hit exactly this path. The rule is now absolute and names the leak path so future runs don't re-derive the bypass.
tend-agent
left a comment
There was a problem hiding this comment.
The rule itself reads well — making the prohibition absolute and re-grounding "expose secrets" → "introspect the process env" closes the door on the workaround. One concern on the second example, inline.
| ## Restrictions | ||
|
|
||
| - **Secrets**: Never run commands that expose secrets (`env`, `printenv`, `set`, `export`, `cat`/`echo` on credential files). Never include tokens or credentials in responses or comments. | ||
| - **Secrets**: Never run commands that introspect the process env (`env`, `printenv`, `set`, `export`) or `cat`/`echo` credential files. The rule is absolute — names-only filters like `env | cut -d= -f1` or `env | grep -E '^[A-Z]+='` do not make these commands safe, because `claude-code-action` injects `ALL_INPUTS` as a multi-line JSON env value embedding `claude_code_oauth_token` and `github_token` in cleartext. The JSON's newlines turn each token-bearing line into its own `env` output line, where the value sits *before* the `=` and a name-stripping filter leaks it verbatim into the session log. Never include tokens or credentials in responses or comments. |
There was a problem hiding this comment.
The env | grep -E '^[A-Z]+=' example doesn't fit the explanation that follows. The regex requires names of only uppercase letters — ALL_INPUTS (with an underscore) doesn't match it, so the multi-line-JSON leak path described in the bullet wouldn't fire on this filter at all. And the grep keeps full NAME=VALUE lines for any matching variable — it isn't a name-stripping filter, so the surrounding "value sits before the =" reasoning doesn't apply either. The single cut -d= -f1 example is enough to anchor the rule; suggesting we drop the second one (or replace it with another genuine name-stripper like env | sed 's/=.*//' that fails for the same reason as cut).
| - **Secrets**: Never run commands that introspect the process env (`env`, `printenv`, `set`, `export`) or `cat`/`echo` credential files. The rule is absolute — names-only filters like `env | cut -d= -f1` or `env | grep -E '^[A-Z]+='` do not make these commands safe, because `claude-code-action` injects `ALL_INPUTS` as a multi-line JSON env value embedding `claude_code_oauth_token` and `github_token` in cleartext. The JSON's newlines turn each token-bearing line into its own `env` output line, where the value sits *before* the `=` and a name-stripping filter leaks it verbatim into the session log. Never include tokens or credentials in responses or comments. | |
| - **Secrets**: Never run commands that introspect the process env (`env`, `printenv`, `set`, `export`) or `cat`/`echo` credential files. The rule is absolute — name-stripping filters like `env | cut -d= -f1` do not make these commands safe, because `claude-code-action` injects `ALL_INPUTS` as a multi-line JSON env value embedding `claude_code_oauth_token` and `github_token` in cleartext. The JSON's newlines turn each token-bearing line into its own `env` output line, where the value sits *before* the `=` and a name-stripping filter leaks it verbatim into the session log. Never include tokens or credentials in responses or comments. |
There was a problem hiding this comment.
Agreed — the ^[A-Z]+= regex skips ALL_INPUTS outright (the underscore breaks [A-Z]+), and grep keeps full NAME=VALUE lines so it isn't a name-stripper anyway. Dropped the second example in f4b6ae3.
Why: env | grep -E '^[A-Z]+=' doesn't match ALL_INPUTS (the underscore breaks [A-Z]+), and grep keeps full NAME=VALUE lines anyway — it isn't a name-stripper, so the surrounding "value sits before the =" reasoning doesn't apply to it. The cut -d= -f1 example is enough to anchor the rule. Co-Authored-By: Claude Opus 4.7 <[email protected]>
## Why Cut the 0.1.2 release so consumer repos (and tend's own nightly regen) pick up the new `claude-interactive` harness and per-workflow `harness`/`model` overrides. ## What's new since 0.1.1 **New `claude-interactive` harness** (`max-sixty/tend/[email protected]`) — opt-in alternative to the released `claude` harness. PTY-supervised interactive `claude` via `script(1)`, end-of-turn detected through Stop/StopFailure hooks. Built as the trial path ahead of Anthropic's June 15 billing split between Agent-SDK metering and the flat Claude Code subscription. Smoke tested end-to-end on tend itself. PRs: #609, #611, #613, #614, #615, #616. **Per-workflow `harness` / `model` override** — adopters can flip a single workflow to a different harness or model without changing `.config/tend.yaml` defaults. #612. **Skill refinements** — nightly upstream-bot rebases (#605), running-in-ci PR bar (#604) and recheck (#573), env-filter loophole fix (#599), authorAssociation warning (#600), review-gates Gate 1 (#602). **Bug fix** — mention queue-delay now uses `comment.updated_at` so edit events report accurately (#595). ## Compatibility Released `claude` harness path is byte-identical; `claude-interactive` is strictly additive and opt-in. Consumer repos that don't touch `harness:` see no change beyond the new skill text and the mention-edit fix.
Summary
Tighten the
Secretsrule inrunning-in-cito head off a specific leak path that triggered during the 2026-05-24 weekly run on this repo. The current rule listsenv/printenvas forbidden but is silent on names-only filters likeenv | cut -d= -f1, which the agent treats as a safe escape hatch when investigating the workflow environment.What happened
During the weekly integration-test recipe (§1 troubleshooting), the agent ran:
The intent was "names only, no values." The actual output included the
CLAUDE_CODE_OAUTH_TOKENandgithub_tokenvalues in cleartext — they landed in the session-log artifact for that run. (Filed separately as #598 with rotation guidance.)Why the filter doesn't work
claude-code-actionexposesALL_INPUTSto the agent process as a multi-line JSON blob:envemits the value verbatim, including its embedded newlines. Fromcut's perspective, each continuation line of the JSON looks like its own variable: the secret string is before the first=on that line (often there's no=at all), socut -d= -f1keeps the entire line. The downstreamgrep -iE 'claude|...|token'then matches the credential lines exactly and prints them.action.yaml:229pinsCLAUDE_CODE_SUBPROCESS_ENV_SCRUB: "0"to dodge a different Linux bash bug (anthropics/claude-code#35701), so the agent's subprocess inheritsALL_INPUTSdirectly — there is no upstream scrub catching this.Change
One paragraph in
plugins/tend-ci-runner/skills/running-in-ci/SKILL.md:ALL_INPUTS)Classification
Test plan
🤖 Generated with Claude Code