Skip to content

markdown-format's opt-in gate opens on a HOME-level config for files in no repository #4246

Closed

Description

@kyle-sexton

Observed in .claude/plugins/data/plugin-quality-melodic-software/evidence/c7ff503b-19e2-40d2-b99e-38c747f7fc0f/markdown-format-hook/20260919T205610Z/audit-notes.md, finding F1 (auditor severity: high; the only finding graded high in that packet). Reproduced this session, so the gate-opening half is measured (E1-equivalent).

The manifest description promises the hook runs "only in repos that carry their own markdownlint config"; the script header explains why: without a config, --fix rewrites and default-rule findings would impose a style the repo never chose.

Where: hooks/markdown-format.sh, resolve_repo_root_to (the CLAUDE_PROJECT_DIR last resort) and markdownlint_config_discoverable. When the edited file sits under no git working tree, resolve_repo_root_to falls through the .git walk to CLAUDE_PROJECT_DIR, and config discovery walks from the file's directory up to that root. On this fleet the primary working directory is the user's home, and C:/Users/KyleSexton/.markdownlint-cli2.jsonc exists.

Reproduction: a fresh C:/Users/KyleSexton/.audit-scratch-mdfmt/deep/dir/note.md with no .git above it and CLAUDE_PROJECT_DIR=C:/Users/KyleSexton produced a 2,502-byte missing-binary notice. That notice is emitted only after the opt-in gate passes, so the gate opened. The scratch tree was removed. The second guard cannot compensate: with no repository, file_is_gitignored returns not-ignored and the script's own # FAILS TOWARD LINTING comment applies.

Not observed: an actual rewrite. markdownlint-cli2 is absent on this host, so the consequence, that a home-level personal config would --fix every .md under the home tree including evidence packets and ~/.claude notes, is inferred from the code path rather than measured.

Scope correction from the packet's evidence-2.md (C1): this finding asserts no harness behavior, so the plugins-reference.md L721 citation in the audit notes is background, not the finding's basis. The reproduction establishes the finding. It is not retracted.

Cheapest fix: document it in the README under Requirements or a scope subsection, stating that a markdownlint config at or above CLAUDE_PROJECT_DIR opts in every .md below it, repository or not. Fuller fix: when the root came from the CLAUDE_PROJECT_DIR last resort rather than a .git walk, anchor config discovery at the edited file's own directory, the behaviour the README already describes for the git-less case. Strongest: require the discovered config to sit inside a working tree before opening the gate.

Verification: re-run the repro. A fixed build must emit no post-gate notice. Ideally re-run on a host where markdownlint-cli2 is on PATH, to close the unverified rewrite consequence.

🤖 Generated with Claude Code

https://claude.ai/code/session_01F7GFS5autRMSaea6kSoXzx

Activity

  1. added
    area: security
    agent-ready
    on Sep 19, 2026
  2. added a commit that references this issue on Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyarea: security

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions