Repository navigation
fix(security): audit follow-ups: hostile diffs, judge downgrade, symlinks, agent tools - #657
Merged
Merged
Conversation
…inks, agent tools A hostile diff could hide findings: --- / +++ lines inside a hunk were parsed as file headers. A judge issue on the same line could replace a critical scanner finding. Scans followed symlinks out of the project and enclosing-scope reads trusted diff paths. Also: dropped_by_validation, files_fingerprint, should_block/gate on all findings, admit for deleted/renamed files, install --remove keeps edited skills, no clippy for --no-llm, docs/skill/tool-count corrections. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: ajianaz <ajianaz@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Follow-ups from an independent audit (a security review and a code review run as separate agents) of the 7 merged PRs #650–#656. Every item below was reproduced or confirmed in code first; each has a regression test.
Security (two were fail-open, one also affects plain
cora reviewin CI)parse_difftreated---/+++lines inside a hunk as file headers, so a removed SQL/Lua comment (-- x) dropped the rest of the hunk, and an added line++ b/tests/y.pyre-filed it under an excluded path: a hardcoded secret reported as 0 findings, exit 0. Headers are now only accepted when the hunk's counts are used up (diff --gitalso closes a hunk).valid_filescomes from the same parser, and file names are escaped in the prompt.rule_id.cora scan/cora.scan_preparefollowed symlinks out of the project (a hostile repo'sid -> ~/.ssh/id_rsaended up in the agent's context). Symlinks are skipped. Enclosing-scope reads (+++ b/../../x) are confined to the project root.cora install --removeno longer deletes a customized skill without--force.Agent-mode correctness
should_blockand the quality gate now look at all findings (the caller'smin_severityonly trims the list; also fixescora.review_diff).dropped_by_validationreported; severity accepted in any case and shown lowercase;files_fingerprintguardsscan_finalizeagainst a changed project;admitfixes lines for deleted files and the old path of a renamed file;--no-llmandreview_finalizeskip building the LLM prompt (nocargo clippyrun);cora install --agents Xno longer writes the skill when X is not detected.Docs / skill: tool count 18 → 22 (README, docs, AGENT.md); README and getting-started say a key is optional; Claude Code needs
claude mcp add cora -- cora mcp(install only adds the skill there); skill text corrected; CHANGELOG corrected and extended.Why
The agent-mode feature trusts a diff written by the PR author. The audit showed that the parser, not the new code, was the weakest link, and that "a judge can add but never remove" did not hold. Not fixed here (low, noted): the SARIF no-judge marker is a text sentinel;
block_onassumes the multi-thread runtime the server uses.Testing
cargo fmt --check,cargo clippy --all-targets --features tree-sitter -- -D warnings,cargo test --features tree-sitter(1208 passed; 21 new regression tests).scan_prepare.claude -p, cora with no key/HOME, skill in the project): reviewing the previously fail-open diff now returns the CRITICAL secret and ignores the injected comment.