Skip to content

docs(#860): decide against moving the oauth recovery token to userConfig - #869

Merged
fdaviddpt merged 2 commits into
mainfrom
fix/860
Oct 2, 2026
Merged

fdaviddpt merged 2 commits into
mainfrom
fix/860

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

#860 asked whether to move the optional REMEMBER_OAUTH_TOKEN / haiku.oauth_token recovery token into a plugin.json userConfig entry (sensitive: true) to try to clear the directory scan's non-blocking MCP_FORWARDS_CREDENTIAL_ENV warning. The issue itself offered two valid closes: build it, or keep the current design and record the outcome in docs/releasing.md.

This decides against building it and records the reasoning in docs/releasing.md's existing portal-scan section:

  • It would not clear the finding: CLAUDE_CODE_OAUTH_TOKEN, ANTHROPIC_API_KEY and CODEX_API_KEY are the host CLI's own credentials, read from the environment regardless of this change, and are not ours to move into userConfig. They keep reading a credential in README.md's disclosure and scripts/session-start-hook.sh either way -- two of the three files the scan named.
  • The portal's own text already accepts this case as-is (host-vendor credential, confirmed by a reviewer each scan).
  • Building it would cost an unverified delivery mechanism, a migration period for existing token users, and a parallel non-userConfig path for Codex/other hosts -- for a warning that would still remain on two of the three flagged files regardless.

No runtime or behavioral code changed; README.md's existing Credentials disclosure needed no edit. A changelog fragment (changelog.d/860.changed.md) is included.

Self-reviewed by two concurrent spawns (Explore, oss:auditor); both findings from Explore (two prose-precision points in the new docs paragraph) were fixed in a second commit.

Closes #860

[AI-generated]

The directory's MCP_FORWARDS_CREDENTIAL_ENV warning on README.md,
scripts/session-start-hook.sh and .claude-plugin/plugin.json was already
accepted by the portal's own text ("a reviewer confirms that" for a
host-vendor credential). #860 asked whether moving the optional
REMEMBER_OAUTH_TOKEN / haiku.oauth_token recovery value into a plugin.json
userConfig entry would clear it.

It would not: CLAUDE_CODE_OAUTH_TOKEN, ANTHROPIC_API_KEY and CODEX_API_KEY
are the host CLI's own credentials, read from the environment regardless,
so the finding's own condition persists on the same files either way. The
RUNTIME_FETCH_EXEC precedent (#859) already showed a partial, cosmetic
change to scanner-matched text is not evidence it moves the verdict.
Building the userConfig path would also add a migration period and a
parallel path for hosts with no userConfig mechanism (Codex), for a
warning that would still remain on the other three vars.

Record the decision and reasoning in docs/releasing.md per the issue's
own "either way, record the outcome" instruction. No runtime behaviour
changes.

Closes #860

Co-Authored-By: Max <noreply>
Self-review (Explore) flagged two minor precision issues in the new
MCP_FORWARDS_CREDENTIAL_ENV paragraph:

- "the same files the scan already named" overgeneralized: the doc
  itself already notes .claude-plugin/plugin.json has no credential
  text at all, so the three env passthroughs can only keep the
  finding's condition true on README.md and
  scripts/session-start-hook.sh, not on plugin.json.
- "the other four sub-questions ... would add" counted the README
  disclosure sub-question as an added cost when it is a pre-existing,
  already-settled constraint, not something building userConfig would
  cost. Narrowed the cost list to sub-questions 1, 3 and 4 and called
  out 5 separately.

Co-Authored-By: Max <noreply>
@fdaviddpt
fdaviddpt merged commit f1a4796 into main Oct 2, 2026
16 checks passed
@fdaviddpt
fdaviddpt deleted the fix/860 branch October 2, 2026 17:26
fdaviddpt added a commit that referenced this pull request Oct 3, 2026
…erConfig 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>
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]>
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.

Take the optional OAuth token through plugin.json userConfig (sensitive) to clear the directory's MCP_FORWARDS_CREDENTIAL_ENV warning

1 participant