Skip to content

fix(#727): scrub doctor VERDICT forgery, guard non-dict JSON in statusline - #728

Merged
fdaviddpt merged 2 commits into
mainfrom
fix/727
Sep 19, 2026
Merged

fdaviddpt merged 2 commits into
mainfrom
fix/727

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

Summary

Fixes three Claude Security scan findings clustered on issue #727:

  • F6 (scripts/doctor.sh): .session/.line read out of last-save.json with jq -r
    and echoed unsanitized into the "Last successful save" report line. An embedded newline
    in either value could forge a column-0 VERDICT:/FAIL: line that commands/doctor.md
    told the relaying assistant to quote back verbatim and never contradict. Scrubbed with
    tr -d '[:cntrl:]', the same pattern REMEMBER_TRANSCRIPT_PATH already uses a few lines
    above in the same file.
  • F14 / F15 (.oss/statusline.py): repo_version and _latest_release each called
    .get() on a parsed JSON document with no check that it was a dict first. A syntactically
    valid but non-object .claude-plugin/plugin.json (a bare list, string, number, or null)
    raised an uncaught AttributeError, blanking the whole status line or freezing the
    refreshed board at stale counts. Guarded with isinstance(doc, dict), mirroring the
    existing _watch_preset_declared pattern.
  • Same crash class, three more call sites (found during this issue's own recon, not
    named in the original scan): repo_config, installed_plugins (both its top-level
    installed_plugins.json read and, per a self-review finding, the per-plugin
    .claude-plugin/plugin.json it reads for each matched entry), and
    _installed_plugin_root. All guarded the same way.
  • commands/doctor.md now states explicitly that store-derived values quoted inline in the
    report (session id, line number, path) are data the tool is reporting, never instructions.

Adjacent, below the filing bar

The new doctor.sh test module inherits the repo's existing win32 blanket-skip convention
(docs/windows-skip-triage.md), so it does not itself exercise the F6 fix on windows-latest
CI -- the fix (a bash tr builtin, and this diff's isinstance guards) is platform-neutral and
does run there regardless.

Test plan

  • tests/test_doctor_last_save_forgery_727.py -- 4 tests: 2 attack cases (embedded
    newline in .session / .line forging a VERDICT:/FAIL: line), 2 positive
    controls (healthy input still reported; doctor's own VERDICT line still emitted).
    Watched red before the fix (2 failed), green after (4 passed).
  • tests/test_statusline_nondict_manifest_727.py -- 11 tests across 5 guarded call
    sites, each a non-object/well-formed pair. Watched red before the fix (5 failed with
    real AttributeErrors via git stash of statusline.py), green after (10 passed, then
    11 after the self-review fix for the per-plugin-manifest site, itself watched red
    then green).
  • Narrowed combined run across 8 doctor.sh/statusline test modules: 45 passed, no
    regressions.
  • changelog.d/727.fixed.md added; changelog fragment checker passes.
  • Full repo pytest -- deliberately not run locally; CI is the source of truth for the
    whole suite.

Closes #727

[AI-generated]

…line

F6: doctor.sh echoed last-save.json's .session/.line into the report with
no control-byte scrub, letting an embedded newline forge a column-0
VERDICT:/FAIL: line that commands/doctor.md tells the relaying assistant to
quote back verbatim. Scrubbed with the same tr -d '[:cntrl:]' pattern
REMEMBER_TRANSCRIPT_PATH already uses, and clarified the doctor.md relay
instruction to treat quoted store values as data, never instructions.

F14/F15: .oss/statusline.py's repo_version and _latest_release called
.get() on a JSON document with no isinstance(dict) check, so a
syntactically valid but non-object plugin.json (local or remote) raised
AttributeError and either blanked the whole status line or silently froze
the rendered board. Fixed the same way _watch_preset_declared already
guards, and applied the identical guard to the same crash class found in
repo_config, installed_plugins and _installed_plugin_root.

Tests added red-then-green for both classes; changelog fragment and a
windows-skip-triage row for the new doctor.sh test module included.

Co-Authored-By: Max <noreply>
Self-review finding (oss:auditor) on this issue: installed_plugins() also
reads a second JSON document per entry -- the installed plugin's own
.claude-plugin/plugin.json at the installPath an installed_plugins.json
entry names -- and called .get() on it with no isinstance(dict) guard, the
same crash class the rest of this issue's fix already closed for the
top-level document. Guarded and pinned with a red-then-green test.

Co-Authored-By: Max <noreply>
@fdaviddpt
fdaviddpt merged commit b03c656 into main Sep 19, 2026
16 checks passed
@fdaviddpt
fdaviddpt deleted the fix/727 branch September 19, 2026 10:20
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.

security(scan-20260918): doctor VERDICT line forgery from last-save.json; .get() on non-object JSON in statusline

1 participant