Repository navigation
Merged
Conversation
… cache divergence, and eval-pattern gap #886: rewords the four changelog.d fragments that still spelled out eval/curl/wget literally, which would have been folded into the v0.39.0 CHANGELOG.md section as-is and undone #864's own fix; adds a sibling test that scans changelog.d/*.md directly, with a planted-fragment positive control, so a future fragment regresses on its own PR rather than at release time. #887: scripts/log.sh's config-flatten cache encoder never escaped a trailing CR the way it already escapes backslash/newline/tab, so the loader's own line-ending strip silently dropped it on a cache hit while the cache-miss path kept it -- now escaped and accepted by the decode whitelist, pinned by a red-then-green test comparing hit and miss byte length. #891: check_release_tree.py's EVAL_OF_SUBSTITUTION pattern only matched eval fed by a command substitution, missing the two exact bare-variable- expansion lines #864 had to remove by hand from log.sh. Widened with two more alternatives (bare $var, and $var embedded in a quoted argument), pinned by a test planting both pre-#864 shapes plus "must not flag" twins. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…he widened eval pattern Self-review (Explore) caught that EVAL_OF_SUBSTITUTION's widening to also flag a bare/embedded variable expansion left the emitted REVIEW message and the module docstring still saying "fed by a command substitution" only, and changelog.d/866.fixed.md's description of what the check "watches for" undersold the same widening landing in this PR. Also logs an adjacent finding from the same review round to trap.d/: the widened pattern newly flags 5 real eval-of-variable-expansion lines in scripts/lib-lock.sh, which is not in this PR's scope and not yet triaged -- a decision for /oss:curate, not fixed here. Co-Authored-By: Claude Sonnet 5 <[email protected]>
fdaviddpt
added a commit
that referenced
this pull request
Oct 3, 2026
…ing (CodeQL HIGH) CodeQL flagged a HIGH "Clear-text logging of sensitive information" alert on PR #894 at pipeline/haiku.py:497 (_warn's print to stderr), with two taint source nodes labeled "sensitive data (password)". The flow: _accept_token() built its malformed-value warning with `detail = f"{len(value.strip())} chars"` -- a value DERIVED from the configured secret (the userConfig oauth_token, or previously the now-removed REMEMBER_OAUTH_TOKEN/ haiku.oauth_token). CodeQL's taint tracker correctly follows that derivation to the log sink: a length is still information about the secret, even though the secret's own bytes never appear. Fix: _accept_token()'s warning message no longer references `value` in any form -- not the value, not its length, not its type name. It is built entirely from constants and the `source` parameter (a label string the caller passes, never derived from the configured value). This breaks the taint flow at its root rather than suppressing the alert: no lgtm/codeql ignore comments, no cosmetic renaming. Updated: docs/verification.md's example log output and surrounding checklist (the "9 chars" example was the exact shape CodeQL flagged). Red test first (tests/test_haiku.py::test_malformed_userconfig_token_warning_never_logs_the_value): asserts the logged line never contains the configured value, with a positive control that it still names the setting. Confirmed failing against the pre-fix code (logged "...got 9 chars)"), passing after the fix. 183 targeted tests pass; CI is the full-matrix gate. origin/main had not moved (still f6d953b) -- no rebase needed; #895 had not merged either. Co-Authored-By: Max <noreply>
fdaviddpt
added a commit
that referenced
this pull request
Oct 3, 2026
…ing (CodeQL HIGH) CodeQL flagged a HIGH "Clear-text logging of sensitive information" alert on PR #894 at pipeline/haiku.py:497 (_warn's print to stderr), with two taint source nodes labeled "sensitive data (password)". The flow: _accept_token() built its malformed-value warning with `detail = f"{len(value.strip())} chars"` -- a value DERIVED from the configured secret (the userConfig oauth_token, or previously the now-removed REMEMBER_OAUTH_TOKEN/ haiku.oauth_token). CodeQL's taint tracker correctly follows that derivation to the log sink: a length is still information about the secret, even though the secret's own bytes never appear. Fix: _accept_token()'s warning message no longer references `value` in any form -- not the value, not its length, not its type name. It is built entirely from constants and the `source` parameter (a label string the caller passes, never derived from the configured value). This breaks the taint flow at its root rather than suppressing the alert: no lgtm/codeql ignore comments, no cosmetic renaming. Updated: docs/verification.md's example log output and surrounding checklist (the "9 chars" example was the exact shape CodeQL flagged). Red test first (tests/test_haiku.py::test_malformed_userconfig_token_warning_never_logs_the_value): asserts the logged line never contains the configured value, with a positive control that it still names the setting. Confirmed failing against the pre-fix code (logged "...got 9 chars)"), passing after the fix. 183 targeted tests pass; CI is the full-matrix gate. origin/main had not moved (still f6d953b) -- no rebase needed; #895 had not merged either. Co-Authored-By: Max <noreply>
fdaviddpt
added a commit
that referenced
this pull request
Oct 3, 2026
PR #894 (@53e63ab) was still red on the same CodeQL alert (py/clear-text-logging-sensitive-data, haiku.py:497) after round 1's fix removed the value-derived length. The maintainer pulled the SARIF codeFlows: both remaining sources are NAME-based, not value-based -- CodeQL's heuristic treats the return of any function whose name contains "oauth", or any constant/parameter whose identifier contains "TOKEN", as a sensitive source once it reaches a log sink, regardless of what the value actually is. Flow A: `_legacy_oauth_config_present()` returned a string naming which legacy setting was configured (e.g. "REMEMBER_OAUTH_TOKEN"), interpolated into the NOTICE message -- flagged because the FUNCTION'S OWN NAME contains "oauth". Fixed by splitting it into two functions, `_legacy_env_var_present()` / `_legacy_config_key_present()`, that return plain booleans; the caller (`_inject_configured_oauth_token()`) now picks between two complete, hand-written literal messages, each naming the setting as fixed text rather than interpolating anything returned. Flow B: `_accept_token(value, source)` interpolated its `source` parameter into the warning -- flagged because the caller passed the module constant `USER_CONFIG_OAUTH_TOKEN_ENV`, whose own identifier contains "TOKEN". Fixed by dropping the `source` parameter entirely (there is only one caller) and hardcoding the warning as a literal naming "the plugin's userConfig oauth_token option" by hand. Neither fix suppresses the alert or renames an identifier while still interpolating it (both explicitly ruled out) -- each message is now a complete literal string with zero identifiers flowing into it at all, so there is nothing left for CodeQL's name-based heuristic to key on. Also rebased onto origin/main (#895 merged meanwhile): changelog.d/860's pre-#860 upstream text had independently been reworded "evaluated" -> "considered" by #886 to clear an unrelated eval/curl/wget changelog scan; resolved by keeping this branch's own full rewrite of that fragment, which already superseded the conflicting lines in a later commit either way. Existing tests updated to the new literal wording (no new identifiers to assert against, since the whole point is that nothing is interpolated). 219 targeted tests pass; CI is the full-matrix gate. Co-Authored-By: Max <noreply>
fdaviddpt
added a commit
that referenced
this pull request
Oct 3, 2026
…ig (#894) * fix(#860): move the optional recovery OAuth token to a plugin.json userConfig option Anthropic's pre-submission checklist classes MCP_FORWARDS_CREDENTIAL_ENV ("Uses a credential from the user's machine") as "Held for a reviewer", not a warning to be confirmed away at every review -- so #869's "decided against building it" outcome, correct about the host-vendor-credential passthroughs (CLAUDE_CODE_OAUTH_TOKEN / ANTHROPIC_API_KEY / CODEX_API_KEY, which are not ours to move and must keep working with nothing configured), was being used to also justify leaving in place the one part of the pattern that genuinely was ours to move: the plugin's own optional recovery token. - .claude-plugin/plugin.json now declares `oauth_token` as a `userConfig` option with `sensitive: true`, validated with a real `claude plugin validate .` run. - pipeline/haiku.py's _configured_oauth_token() now prefers CLAUDE_PLUGIN_OPTION_OAUTH_TOKEN (the env var Claude Code exports to a hook subprocess for that option, per the plugin manifest reference) over the legacy REMEMBER_OAUTH_TOKEN env var and haiku.oauth_token config key. Both legacy paths keep working -- no existing install loses its recovery token silently -- but now log a loud `DEPRECATED:` line every time either is actually used. - scripts/doctor.sh surfaces that DEPRECATED line instead of leaving it buried in a daily log nobody reads. - README.md's credentials disclosure documents the userConfig route and the migration story; Codex (no userConfig mechanism) is unaffected. - docs/releasing.md records what moved, what could not move and why, and keeps #869's original argument as the record of what was tried first. Red tests first (tests/test_haiku.py, tests/test_doctor_deprecated_oauth_860_notice.py): new assertions failed against the pre-fix code, then passed after the precedence/deprecation logic and the doctor section were added. 225 targeted tests pass; CI is the full-matrix gate. Co-Authored-By: Max <noreply> * fix(#860): de-duplicate the deprecation warning, fix doctor.sh's no-log ambiguity, update docs/configuration.md Self-review findings from the Explore and oss:auditor reviewers against 3bf65d1: - pipeline/haiku.py's _configured_oauth_token() was called twice per save on the legacy-token path (once by _other_credential() just checking existence, once by _inject_configured_oauth_token() actually injecting the token), so one save logged the DEPRECATED line twice. Added a warn=False probe mode for the existence-only caller; the only caller that actually uses the token keeps the default and is the only one that logs. - scripts/doctor.sh's new "Deprecated recovery-token config" section printed the identical "OK" line for "no daily log exists yet" and "logs exist and were genuinely scanned, clean" -- the sibling SessionStart-duration section three blocks above already keeps those two states apart; this section now does too. - docs/configuration.md's haiku.oauth_token and REMEMBER_OAUTH_TOKEN rows were left describing the pre-#860 behavior as current; both now say they are deprecated on Claude Code (unchanged on Codex) and point at the userConfig option. A third finding (the DEPRECATED message's remedy text is Claude-Code-specific and misleading for a Codex host falling back to claude -p with a legacy token configured) is logged to trap.d/860.codex-fallback-deprecation-wording.md rather than fixed here: non-blocking, and a clean fix needs host detection threaded into the warning path, which is more than this diff's blast radius. Red tests first for both fixed findings (duplicate-log test, no-log-vs-clean distinguishing test); both failed against the pre-fix code and pass now. 179 targeted tests pass; CI is the full-matrix gate. Co-Authored-By: Max <noreply> * fix(#860): remove REMEMBER_OAUTH_TOKEN/haiku.oauth_token reads outright (round 2) Maintainer decision (2026-10-03 10:55 CEST): deprecating-while-still-reading (#860 round 1, commit 3bf65d1/432d078) is still "reads a credential from the user's machine" -- compliance has to be genuine, never a workaround that merely hides names from the directory's scanner (no obfuscation, no string-splitting). Evidence gathered from the v0.38.0 release tree (e3cfd5b): scripts/session-start-hook.sh had no literal token read at all (only a comment mentioning "credentials"), .claude-plugin/plugin.json had no credential text either, and pipeline/haiku.py -- far more literal credential references than either -- was not flagged at all. The scanner reads what the TEXT says the plugin does with credentials, not the code paths themselves. - pipeline/haiku.py: `_configured_oauth_token()` now has exactly one source, the plugin's userConfig `oauth_token` option (CLAUDE_PLUGIN_OPTION_OAUTH_TOKEN). REMEMBER_OAUTH_TOKEN and haiku.oauth_token are read nowhere for authentication any more, on any host. A new `_legacy_oauth_config_present()` checks PRESENCE ONLY (never the value) and `_inject_configured_oauth_token()` -- the single call site that actually uses a token -- logs a `NOTICE:` line once per save naming the still-configured legacy source, never its content. - `_other_credential()`'s own CLAUDE_CODE_OAUTH_TOKEN presence check (for the unrelated ANTHROPIC_API_KEY auto-strip decision, #703) is unchanged: it is a presence check, not a credential read, and removing it would silently strip the operator's only working credential whenever an inert legacy value made it look like a backup existed. - scripts/doctor.sh's section renamed/reworded (DEPRECATED: -> NOTICE:) to match; scripts/session-start-hook.sh's one flagged comment (~L2487, "audit credentials and network") reworded without that word. - README.md's credentials section rewritten in plain language per the maintainer's own suggested wording -- no environment-variable recipes, no literal CLAUDE_CODE_OAUTH_TOKEN naming (tests/test_readme_discloses_854.py's required-name list updated with a comment recording why #854's disclosure rule is superseded for that one name). - docs/configuration.md, docs/verification.md, config.example.json, docs/releasing.md updated from "deprecated" to "removed" framing throughout, including a full rewrite of docs/verification.md's manual procedure for the new userConfig-only mechanism. - Grep sweep for token|credential|api_key|oauth (case-insensitive) across shipped file types: 51 files, 542 lines: reported in docs/releasing.md. Red tests first for every behavioral change (negative assertions paired with positive controls: userConfig still authenticates, legacy sources no longer do; legacy presence logs a value-free notice once per save, empty legacy config logs nothing). 275 targeted tests pass; CI is the full-matrix gate. origin/main had not moved at the time of this commit (still f6d953b) -- no rebase was needed. Co-Authored-By: Max <noreply> * fix(#860): self-review round 2 -- fix stale comments, false Codex claims, stale remedy strings Self-review findings from the Explore and oss:auditor reviewers against e97553c: - pipeline/haiku.py:460-471's own comment still described REMEMBER_OAUTH_TOKEN/ haiku.oauth_token as the live fallback mechanism, 150 lines above the function that no longer reads either. Reworded to point at _configured_oauth_token() instead of re-describing behavior that changed. - README.md, docs/configuration.md and docs/releasing.md all claimed Codex "keeps using REMEMBER_OAUTH_TOKEN/haiku.oauth_token unchanged" -- false: the recovery -token code has never branched by host, so Codex's one path that ever used those vars (REMEMBER_SUMMARIZER_FALLBACK=claude, falling through to the shared claude -p code) no longer authenticates via them either, same as Claude Code. Codex's native codex exec route never read them at all. All three docs corrected; the maintainer's own round-2 instruction ("Codex: no recovery-token path any more... document that plainly") is what round 2's code already did -- only the prose was wrong. New red-then-green tests in tests/test_summarizer_routing_460.py close the gap a reviewer found (zero "codex" references in the token-precedence test file): a legacy token does NOT authenticate the Codex-fallback claude -p call; a userConfig token does (positive control). - Two stale "set REMEMBER_OAUTH_TOKEN" remedy strings (pipeline/haiku.py's #870 isolation-retry warning, scripts/doctor.sh's expired-login hint) told operators to use a mechanism round 2 just turned off. Both reworded to point at the userConfig option; both pinning tests (#870) updated to the new marker. - trap.d/860.codex-fallback-deprecation-wording.md (round 1) had a premise round 2 made false ("REMEMBER_OAUTH_TOKEN itself keeps working on this path") -- appended an addendum rather than rewriting, since the file is meant as a historical trace for /oss:curate. - A new non-blocking finding (several shell scripts outside this diff's scope still describe haiku.oauth_token as "a live credential, rotate if leaked") logged to trap.d/860.stale-live-credential-wording-outside-diff.md rather than fixed here -- five files across three subsystems, wording-only, out of blast radius. 292 targeted tests pass; CI is the full-matrix gate. Co-Authored-By: Max <noreply> * fix(#860): remove value-derived content from the malformed-token warning (CodeQL HIGH) CodeQL flagged a HIGH "Clear-text logging of sensitive information" alert on PR #894 at pipeline/haiku.py:497 (_warn's print to stderr), with two taint source nodes labeled "sensitive data (password)". The flow: _accept_token() built its malformed-value warning with `detail = f"{len(value.strip())} chars"` -- a value DERIVED from the configured secret (the userConfig oauth_token, or previously the now-removed REMEMBER_OAUTH_TOKEN/ haiku.oauth_token). CodeQL's taint tracker correctly follows that derivation to the log sink: a length is still information about the secret, even though the secret's own bytes never appear. Fix: _accept_token()'s warning message no longer references `value` in any form -- not the value, not its length, not its type name. It is built entirely from constants and the `source` parameter (a label string the caller passes, never derived from the configured value). This breaks the taint flow at its root rather than suppressing the alert: no lgtm/codeql ignore comments, no cosmetic renaming. Updated: docs/verification.md's example log output and surrounding checklist (the "9 chars" example was the exact shape CodeQL flagged). Red test first (tests/test_haiku.py::test_malformed_userconfig_token_warning_never_logs_the_value): asserts the logged line never contains the configured value, with a positive control that it still names the setting. Confirmed failing against the pre-fix code (logged "...got 9 chars)"), passing after the fix. 183 targeted tests pass; CI is the full-matrix gate. origin/main had not moved (still f6d953b) -- no rebase needed; #895 had not merged either. Co-Authored-By: Max <noreply> * fix(#860): drop every name-based source CodeQL still flagged (round 3) PR #894 (@53e63ab) was still red on the same CodeQL alert (py/clear-text-logging-sensitive-data, haiku.py:497) after round 1's fix removed the value-derived length. The maintainer pulled the SARIF codeFlows: both remaining sources are NAME-based, not value-based -- CodeQL's heuristic treats the return of any function whose name contains "oauth", or any constant/parameter whose identifier contains "TOKEN", as a sensitive source once it reaches a log sink, regardless of what the value actually is. Flow A: `_legacy_oauth_config_present()` returned a string naming which legacy setting was configured (e.g. "REMEMBER_OAUTH_TOKEN"), interpolated into the NOTICE message -- flagged because the FUNCTION'S OWN NAME contains "oauth". Fixed by splitting it into two functions, `_legacy_env_var_present()` / `_legacy_config_key_present()`, that return plain booleans; the caller (`_inject_configured_oauth_token()`) now picks between two complete, hand-written literal messages, each naming the setting as fixed text rather than interpolating anything returned. Flow B: `_accept_token(value, source)` interpolated its `source` parameter into the warning -- flagged because the caller passed the module constant `USER_CONFIG_OAUTH_TOKEN_ENV`, whose own identifier contains "TOKEN". Fixed by dropping the `source` parameter entirely (there is only one caller) and hardcoding the warning as a literal naming "the plugin's userConfig oauth_token option" by hand. Neither fix suppresses the alert or renames an identifier while still interpolating it (both explicitly ruled out) -- each message is now a complete literal string with zero identifiers flowing into it at all, so there is nothing left for CodeQL's name-based heuristic to key on. Also rebased onto origin/main (#895 merged meanwhile): changelog.d/860's pre-#860 upstream text had independently been reworded "evaluated" -> "considered" by #886 to clear an unrelated eval/curl/wget changelog scan; resolved by keeping this branch's own full rewrite of that fragment, which already superseded the conflicting lines in a later commit either way. Existing tests updated to the new literal wording (no new identifiers to assert against, since the whole point is that nothing is interpolated). 219 targeted tests pass; CI is the full-matrix gate. Co-Authored-By: Max <noreply> * fix(#860): triage the new Windows-skipped doctor notice test Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.
Closes #886.
Closes #887.
Closes #891.
What changed
#886 -- changelog.d/.md fragments on main carried the literal words eval/curl/wget, which would have been folded verbatim into the shipped CHANGELOG.md v0.39.0 section at release time, undoing #864's earlier rewording (done to stop the Anthropic plugin directory's scanner flagging a RUNTIME_FETCH_EXEC finding). Reworded changelog.d/864.fixed.md, 864.changed.md, 866.fixed.md and 860.changed.md to describe the same facts without the literal trigger words, recovering phrasing from the paused release commit on branch release/0.39.0-paused which had already reworded these once for the shipped section. Added a new test scanning changelog.d/.md directly (plus a positive-control twin with a planted bad fragment) so a future regression is caught on its own PR rather than at release-fold time. The three new fragments this PR itself adds (886.fixed.md, 887.fixed.md, 891.fixed.md) were verified free of the same substrings.
Heads up for the maintainer: changelog.d/860.changed.md is also touched (same content, unmodified before this PR's edit) by a concurrently-running sibling lane's branch fix/860. Both branches currently carry byte-identical content for that file pre-edit, so this file's rewording may need manual conflict resolution whichever of the two pull requests merges second.
#887 -- scripts/log.sh's config-flatten cache: a config value ending in a literal CR byte decoded one byte shorter on a cache hit than on a cache miss, because the encoder escaped only backslash/newline/tab and never CR, while the loader's own trailing-CR strip (meant for CRLF cache files) wrongly ate a CR that was the value's own last byte on decode. Fixed by also escaping CR in the encoder and widening the cache-valid-value whitelist to accept it; the existing %b decode already handles the new escape with no change. New test publishes+loads a CR-terminated value through the real cache functions and asserts hit/miss byte-length match.
#891 -- .github/scripts/check_release_tree.py's EVAL_OF_SUBSTITUTION pattern (a REVIEW-only, non-blocking release-gate heuristic) only matched eval fed a command substitution, missing the exact two eval-of-bare-variable-expansion lines #864 itself had to remove by hand from scripts/log.sh. Widened the pattern to three alternatives covering the command-substitution shape (unchanged), a bare eval-of-variable shape, and an eval of a quoted string containing a variable. New test file pins both pre-#864 shapes as must-flag, the original shape as must-still-flag, and several must-not-flag twins (an "evaluate" substring, the renamed assign_kv helper, an unrelated dollar-amount literal).
Deliberate deviation from the brief: #891's dispatch mentioned a "safe_eval heredoc" shape as one that must be flagged. Not implemented: safe_eval was renamed to assign_kv by #864 and no longer exists in the codebase, the word-boundary regex correctly excludes it as a substring match, and the actual issue #891 body (read in full) never mentions this shape -- only the two real #864 lines and the classic controls, all of which are implemented and verified. This looks like an inaccurate paraphrase in the dispatch rather than something grounded in the issue itself.
Test-first evidence
RED/GREEN, both demonstrated directly:
All new/targeted tests green together: 93 passed in the final combined run across the two new/changed test files plus the pre-existing check_release_tree.py regression suite (243 passed, 1 pre-existing unrelated skip). python3 .oss/assemble_changelog.py --check also passes with all 16 fragments, including this PR's own 3. Full repo pytest was not run locally; CI (3 OSes x 4 interpreters) is this repo's matrix gate per its own doctrine.
Self-review
Explore and oss:auditor reviewed the first commit in parallel, told not to mutate the tree; tree snapshot before/after came back clean both times, including after a second, lightweight re-review of a follow-up commit.
oss:auditor returned no findings, having checked silent-absence, guard-not-run, untrusted-input and platform classes (CI matrix confirmed ubuntu/macos/windows x python 3.9-3.12; bash 3.2 compatibility of the new CR escape and the new bash-level test's expected-to-run-not-skip behavior on Windows/Git-for-Windows bash.exe are both reasoned rather than observed, since this run only exercised macOS/homebrew-bash).
Explore returned two findings:
Docs
README.md (this repo's only docs_targets entry) was opened and checked against all three issues -- no-change-needed: these are internal bug fixes and a test/CI-only widening with no user-facing CLI, config or behavior change to document.
🤖 Generated with Claude Code
[AI-generated]