Repository navigation
fix(audit): reduce false positives in Markdown examples - #475
Conversation
Avoid blocking legitimate Markdown SDK parameters and ambiguous disclosure advice by default while retaining visible HIGH findings and strict-policy gating. Preserve explicit concealment, custom severity overrides, and shell dataflow coverage in HTML and comments. Add regression coverage and document rule-ID compatibility.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8dee3108f3
ℹ️ 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".
| } | ||
| blocks = append(blocks, markdownCodeBlock{ | ||
| start: line, end: line + len(lines), | ||
| language: strings.ToLower(string(block.Language(source))), lines: lines, inHTML: inHTML, |
There was a problem hiding this comment.
Normalize whitespace in fenced-block language identifiers
A fence such as bash<TAB>title=example is no longer recognized as shell: Goldmark 1.7.8's Language stops only at an ASCII space, so this stores bash<TAB>title=example, which fails the shellLangs lookup. The previous strings.Fields implementation accepted tabs, and now a cross-line flow such as X=$API_KEY followed by curl ... $X in this block receives no dataflow-taint-var finding and can pass strict audit. Split the info string on whitespace before storing its first language token.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in e55ec29. Fence languages now use strings.Fields before case normalization, preserving shell recognition for tab-separated metadata. TestMarkdownShellBlocksUseSameContext covers an uppercase BASH fence with tab-separated metadata; the E2E runbook also verifies that it blocks under strict policy. make check and all 4 E2E steps passed.
Parse complete Markdown source without HTML blocks for shell analysis so blank lines inside raw HTML cannot split taint flows. Retain rendered context separately for SDK severity decisions. Normalize tab-separated fence metadata with strings.Fields so shell blocks remain auditable. Cover both regressions in unit tests and the CLI runbook.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e55ec290b7
ℹ️ 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".
| if r.ID == "prompt-injection-5" { | ||
| // Exclude explicit-concealment phrases, not separate generic directives. | ||
| return r.Regex.MatchString(r.Exclude.ReplaceAllString(line, " ")) |
There was a problem hiding this comment.
Honor custom excludes when replacing rule 5
When audit-rules.yaml fully replaces prompt-injection-5 with a custom regex and exclude, this ID-based special case no longer applies the documented line-suppression semantics used by every other rule. For example, a replacement with regex: '(?i)secret' and exclude: '(?i)safe' still reports safe secret, because only safe is removed before the regex is retried; under a strict threshold this can incorrectly block an audit despite the user's explicit exclusion. Restrict this behavior to the built-in rule semantics or otherwise preserve normal excludes for full custom replacements.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 2922026. Phrase exclusion is now metadata attached only to the built-in rule, rather than behavior selected by rule ID. A full custom regex replacement therefore retains the normal whole-line exclude semantics, while severity/enabled overlays preserve the built-in behavior. TestOutputSuppressionCustomRuleExclude covers both raw content and Markdown, and TestOutputSuppressionMixedRuleOverrides retains coverage of independent directives. Validation: make check, 4/4 isolated CLI E2E steps, the website build for all five locales, and the context-router check passed.
Track phrase exclusions as built-in rule metadata so a full custom regex replacement retains normal whole-line exclusion behavior. Keep phrase exclusions when only severity or enabled state is overridden. Add raw-content and Markdown regression coverage. Verified with make check, four CLI E2E steps, the five-locale website build, and the context-router check.
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
prompt-injection-1 reports lowercase root: object properties inside Markdown code fences as CRITICAL prompt overrides. This blocks skills with ordinary DOM examples such as IntersectionObserver options in GoogleChrome/modern-web-guidance. Non-Markdown files already restrict prompt-injection-1 to uppercase labels (#923), and Markdown fences already downgrade SDK-style system: / System: parameters from CRITICAL to HIGH (#475). Extend markdownFindingSeverity with a strict RE2 whitelist grammar (mdRootPropertyRe) that downgrades lowercase root: lines in parsed non-HTML fenced code blocks only when the value is a comma-terminated identifier or member expression, or a single-line call whose arguments are limited to quoted strings, identifiers or members, or plain numbers. Quoted-string arguments and trailing // comments are not inspected by this exception; other audit rules still scan them. Keep findings visible at HIGH so default policy warns without blocking while strict policy still blocks. Uppercase ROOT:, prose outside fences, raw HTML comments, bare words or members without commas, unquoted commands or prose inside calls, regex or template literals, unquoted brackets or braces, comments inside parens, unclosed calls, bare quoted prose, un-commented trailing prose, and explicit rule overrides stay CRITICAL. Update English and translated docs to match.
Legitimate SDK
system:parameters in Markdown examples currently produce CRITICAL findings and block anthropics/skills installs and updates. Report recognized parameter shapes as HIGH so default policy warns and strict policy blocks, while explicit concealment remains CRITICAL.Share fenced-code parsing across static, command-tier, and dataflow analysis using the existing Goldmark dependency. Preserve shell analysis across HTML/comment boundaries, blank lines, tab-separated fence metadata, and unclosed blocks, honor explicit global/project severity overrides, keep independent disclosure findings on the same line, and preserve whole-line exclusions for full custom rule replacements. Add regression tests, an isolated CLI runbook, and matching English/Japanese/Korean/Chinese documentation.
Generic disclosure restrictions now use the HIGH rule
prompt-injection-5; existing overrides or accepted findings forprompt-injection-4do not apply to it. Some malicious wording can match only HIGH, so strict policy remains the option for blocking that ambiguity. Findings remain visible.Type
proposals/only — see CONTRIBUTING.md)Linked Issue
Closes #468
Validation
make check(formatting, vet, unit and integration tests).audit_disclosure_policy_runbook.md: 4/4 E2E steps passed, covering default/strict audit, install/update rollback, remembered acceptance, hidden shell flows, and severity overrides.npm run buildpassed for all five locales.python3 scripts/ai-context.py checkandgit diff --checkpassed.683bc88e56f3e09ba94f7055977f3d3aa499f202: claude-api has 0 CRITICAL and 44 HIGH findings, and default policy does not block it.Checklist
make check) — for code changes