Skip to content

fix(ai-slop, testing): quote YAML-indicator branch names in findings frontmatter (0.3.7, 0.7.5) - #3241

Merged
kyle-sexton merged 3 commits into
mainfrom
cursor/3179-yaml-indicator-branch-cfcf
Aug 23, 2026
Merged

kyle-sexton merged 3 commits into
mainfrom
cursor/3179-yaml-indicator-branch-cfcf

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Summary

Two detector-findings producers interpolated the branch name into findings frontmatter as a bare YAML plain scalar. git check-ref-format --branch accepts @foo, !foo, #foo and &foo. Emitted bare, #foo and &foo parse to null and @foo/!foo are YAML parse errors, so the branch: value a consumer reads is not the branch name.

The consumer admits a findings file only when that value equals the current branch exactly (review:fanout fix-pass-mode.md Step 1), so a misparse silently dropped every finding for that branch — with no error, and nothing distinguishing it from "no findings".

Fix

Both producers now route the value through a yaml_scalar() helper, matching the reference already on main in claude-config:audit-instructions. Quoting is conditional: an ordinary branch name stays a byte-identical unquoted scalar. The predicate is duplicated per producer rather than extracted into a shared library (plugins are portable). Tests now iterate the whole reachable indicator class, not a five-name sample.

ai-slop 0.3.5, testing 0.7.5.

Verification

  • plugins/ai-slop/skills/audit/scripts/detect.test.sh — 116/116
  • plugins/testing/skills/audit/scripts/cant-fail-scan.test.sh — 89/89
  • scripts/check-changelog-parity.sh --check-bump origin/main — pass
  • markdownlint on both changelogs — 0 issues

The leading-single-quote case ('foo) that hung the first widening on Windows Git Bash does not hang here. Stdin is closed on emit/grep so a missing-file grep cannot fall through to stdin.

Related

Closes #3179

@claude

claude Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 1m 39s —— View job


Security review — no issues found

  • Gather context (PR diff, changed files, CLAUDE.md)
  • Understand request (run /review:security-review per custom instructions)
  • Skip-gate check
  • Review changed files for security-relevant issues
  • Adversarial validation of candidate findings
  • Post final findings

Scope reviewed: the full diff (git diff origin/main...HEAD) — emit-findings.sh (ai-slop), cant-fail-scan.sh (testing), their test suites, and the two CHANGELOG.md/plugin.json version bumps.

Summary: This PR only changes how a branch: YAML frontmatter value is escaped/quoted when composing findings files — it does not introduce any new input sources, shell execution paths, or trust-boundary crossings. I checked specifically for the classes this lane hunts:

  • Command/shell injection — the yaml_scalar() value is always passed as a printf argument (%s), never as the format string itself, in both:

    A branch name that happens to contain %, backticks, $(), etc. cannot break out of either call — no eval, no sh -c, no unescaped interpolation into a command line.

  • YAML/frontmatter injection — the fix is the hardening itself: both escape backslash before quote (gsub(/\\/, "\\\\", s) then gsub(/"/, "\\\"", s) / s="${s//\\/\\\\}" then s="${s//\"/\\\"}"), so a branch name containing " can't terminate the quoted scalar early. Verified the bash predicate at cant-fail-scan.sh#L340-L349 is byte-identical in character coverage to the awk predicate at emit-findings.sh#L131 and to the existing main reference in plugins/claude-config/skills/audit-instructions/scripts/emit-findings.sh — no drift between the three producers of this shared contract.

  • GitHub Actions / CI surface — no workflow files touched.

  • Secrets/credentials — none handled by this code path; $BRANCH comes only from git branch --show-current or an explicit --branch CLI flag, both local/trusted inputs, never a network-sourced or attacker-controlled value in this flow.

  • Version/changelog bumps — plugin.json and CHANGELOG.md diffs are consistent with the fix described; nothing anomalous.

No vulnerabilities identified. This change is itself a reliability/integrity fix for the findings pipeline (a misparsed branch: field was silently dropping findings — including security findings — for affected branch names), not a source of new risk.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5e188b2e9f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

github-actions Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Last security-reviewed head: 0e76d1d86870604d3f49f500e3af021e5e31f47d. On the next push, the relevance gate compares only the commits since this SHA; delete this comment to force a full re-review.

@cursor
cursor Bot force-pushed the cursor/3179-yaml-indicator-branch-cfcf branch 2 times, most recently from 44d204d to 181b868 Compare August 23, 2026 22:33
@kyle-sexton
kyle-sexton enabled auto-merge (squash) August 23, 2026 22:34
@claude

claude Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @cursor[bot]'s task in 5m 3s —— View job


Code review — 1 finding

  • Gather context (PR diff, changed files, CLAUDE.md)
  • Understand request (run /review:code-review per custom instructions)
  • Skip-gate check (open, non-draft, meaningful review surface — proceeding; security is out of scope here, claude-security-review.yml already covers it and posted a clean review on this head)
  • Review changed files for correctness/maintainability issues
  • Adversarial validation of candidate findings
  • Post final findings

Scope: plugins/ai-slop/skills/audit/scripts/emit-findings.sh, plugins/testing/skills/audit/scripts/cant-fail-scan.sh, and their two test suites (the code surface of the diff — version bumps and changelogs are consistent with the fix and not separately flagged).

Finding (posted inline on cant-fail-scan.sh:367-369)

The PR's own stated invariant — "predicate deliberately IDENTICAL to the two sibling producers" (comment in both edited files) — doesn't hold between the two files this PR touches. emit-findings.sh's yaml_implicit_typed() quotes a hex/octal/binary-looking branch name (^0[xXoObB][0-9a-fA-F_]+$, e.g. 0x1A); cant-fail-scan.sh's yaml_scalar() has no equivalent check, so it leaves such a name bare. 0x1A is a legal git branch name, and under the YAML 1.2 Core Schema int regex it parses as the integer 26, not the string — reopening, for this one input class in one of the two producers, the exact silent-finding-drop bug this PR fixes. Neither test suite has a 0x/0o/0b case, so the drift shipped untested. Suggested one-line fix included inline.

Secondary note (not filed as a separate finding — informational)

Independent of the above, the "three producers... must agree" claim in both new comment blocks is already inaccurate as written even setting the 0x1A case aside: the third, unchanged reference — plugins/claude-config/skills/audit-instructions/scripts/emit-findings.sh#L176-L180 — has no implicit-type quoting at all (no yaml_implicit_typed equivalent), so it doesn't quote true/123/dates the way both edited files now do. Worth a follow-up if that third producer is meant to track the other two, but it's outside this PR's diff so not blocking here.

@github-actions

github-actions Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Claude has reviewed this PR 2 times. The lane skips further automatic reviews after 5; deleting this comment resets the count.

kyle-sexton and others added 3 commits August 23, 2026 23:31
…frontmatter (0.3.5, 0.7.5)

Both `detector-findings` producers interpolated the branch name into their
findings frontmatter as a bare YAML plain scalar. `git check-ref-format
--branch` accepts `@foo`, `!foo`, `#foo` and `&foo`; emitted bare, `#foo` and
`&foo` parse to null and `@foo`/`!foo` are outright YAML parse errors, so the
`branch:` value a consumer reads is not the branch name.

The consumer admits a findings file only when that value equals the current
branch exactly (review/fanout fix-pass-mode.md, "Step 1"), so a misparse left
the whole file unmatched — every finding for that branch dropped with no
error, and nothing distinguishing it from "no findings".

Both producers now route the value through a `yaml_scalar()` helper. Quoting
is conditional, matching the reference implementation already on main in
claude-config's emitter: an ordinary branch name stays a byte-identical
unquoted scalar, so the wire format for the common path does not move. The
predicate is duplicated per producer rather than extracted into a shared
cross-plugin library, which would be a structural invention binding surfaces
beyond this fix; a differential harness over 34 inputs confirmed the awk and
bash implementations agree byte-for-byte.

Regression coverage asserts both directions in each producer and was proven
non-vacuous by mutation: reverting the helper call turns the indicator cases
red, and making the predicate unconditional turns the ordinary-branch cases
red.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_014QH5jtNyrDCYYsDgxMxkHk
(cherry picked from commit cecd44a)
…sample

A five-name sample stayed green after |, >, %, backtick, " and ' were
dropped from a sibling predicate — the drift acceptance criterion 3
forbids. Both suites now iterate every indicator the producer can
actually reach. Stdin is closed on emit/grep so a missing-file grep
cannot hang the suite.

Closes #3179

Co-authored-by: Kyle Sexton <[email protected]>
true/null/123 and the other implicit types type-coerce as bare scalars
and silently drop findings. Also unparsable spelling for typos.

Co-authored-by: Kyle Sexton <[email protected]>
@kyle-sexton
kyle-sexton force-pushed the cursor/3179-yaml-indicator-branch-cfcf branch from 181b868 to 0e76d1d Compare August 23, 2026 23:32
@kyle-sexton kyle-sexton changed the title fix(ai-slop, testing): quote YAML-indicator branch names in findings frontmatter (0.3.5, 0.7.5) fix(ai-slop, testing): quote YAML-indicator branch names in findings frontmatter (0.3.7, 0.7.5) Aug 23, 2026
@claude

claude Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 1m 47s —— View job


Security review — no issues found

  • Gather context (PR diff, changed files, CLAUDE.md)
  • Understand request (run /review:security-review per custom instructions)
  • Skip-gate check
  • Review changed files for security-relevant issues
  • Adversarial validation of candidate findings
  • Post final findings

Scope reviewed: full diff (git diff origin/main...HEAD) at head 0e76d1d, focused on what changed since the prior clean security review — the follow-up fix commit closing the 0x1A/hex-octal-binary drift flagged in code review.

What changed since the last security-reviewed head: both yaml_scalar() predicates gained matching yaml_implicit_typed() (ai-slop, awk) / inline case+regex (testing, bash) checks that quote true/false/yes/no/on/off/null/~, integers, floats, dates, and 0x/0o/0b-prefixed hex/octal/binary-looking branch names. This closes the exact gap the earlier code review found (0x1A previously left bare in cant-fail-scan.sh, parseable as YAML int 26).

  • Command/shell injection — unchanged from the prior review: the value is still only ever passed as a printf argument (%s), never as the format string, in both emit-findings.sh (awk) and cant-fail-scan.sh (bash). No eval/exec anywhere in either script. The new regex/case arms only add more conditions for whether to quote — they don't touch how the value is emitted.
  • YAML/frontmatter injection — the new predicates are pure classification (regex/case match against the already-safe yaml_scalar/yaml_implicit_typed quoting path); the existing backslash-then-quote escaping is untouched, so no new injection vector opens here.
  • ReDoS — the added regexes (^0[xXoObB][0-9a-fA-F_]+$, date/float patterns) are all linear, no nested quantifiers or catastrophic-backtracking shapes.
  • GitHub Actions / secrets — no workflow files touched; $BRANCH/$branch still comes only from local git branch --show-current or an explicit CLI flag, never network-sourced.
  • Version/changelog bumps — plugin.json and CHANGELOG.md diffs match the fix described, nothing anomalous.

No vulnerabilities identified. This follow-up commit is scope-correct — it hardens the YAML-quoting predicate further (a correctness/integrity fix for the findings pipeline) without introducing new input sources or trust-boundary changes.

@kyle-sexton
kyle-sexton merged commit df4e045 into main Aug 23, 2026
1 check passed
@kyle-sexton
kyle-sexton deleted the cursor/3179-yaml-indicator-branch-cfcf branch August 23, 2026 23:43
@claude

claude Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 40s —— View job


Code review — skipped

  • Gather context (PR diff, changed files, CLAUDE.md)
  • Understand request (run /review:code-review per custom instructions)
  • Skip-gate check

Per /review:code-review's skip gate, this PR is already merged (not open), so no review was performed and no findings were posted. If this needs re-review, please reopen or point me at the relevant open PR.

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.

fix(ai-slop, testing): quote YAML-indicator branch names in emitted findings frontmatter

1 participant