fix(audit): ground evidence paths and reject registry paths that escape the repo - #31
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Warning Review limit reached
Next review available in: 30 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…pe the repo Two holes the audit kernel's own departments found in it, same root cause: a path string was trusted because it was well-formed. - validate() is filesystem-free, so a confirmed finding's `path` was only checked for being non-empty. A department is an agent; a fabricated or drifted citation validated green. validate_evidence_grounding(repo_root) now resolves every file evidence entry under the repository, requires it to exist, and requires any line range to be ordered and within the file. `audit --operation validate --repo <root>` runs it; `render` has no repo and does not claim to. - The department registry is read from --repo — a scanned repository's own file — but its rubric and prompt path strings were joined onto repo_root and only `.is_file()`-checked, so an absolute path replaced the base and `..` escaped it. A target repo could satisfy the "rubric files exist" invariant with host files and redirect a department's prompt, which is the instruction source an audit agent reads. Both are now parsed under the portable repo-relative contract artifact_ref.rs already enforces. Found by the ai-safety (001) and security (002) departments auditing this repository with the T1-T4 kernel.
175d822 to
2c66c17
Compare
The T1–T4 audit kernel, run against this repository, found two path-trust holes in itself.
ai-safety-001 (high) —
validate()is filesystem-free, so astatus: confirmedfinding's evidencepathwas only checked for being non-empty: never resolved, never existence-checked, no line-range sanity. A department is an agent, so a fabricated or drifted citation is the expected failure mode, and it validated green. Newvalidate_evidence_grounding(repo_root)resolves everyfileevidence entry under the repository root, requires it to exist, and requiresline_start/line_endto be ordered and within that file. It is wired intoaudit --operation validate --repo <root>, the operation that holds the cited repository;renderdoes not have one and does not claim to.security-002 (medium) —
DepartmentRegistryis loaded from--repo, i.e. the scanned repository's own file, but its rubric and prompt path strings were joined ontorepo_rootand only.is_file()-checked. An absolute path replaces the base and..escapes it, so a target repo could satisfy the kernel's documented "rubric files exist" invariant with files anywhere on the host, and redirect a department'sprompt— the instruction source an audit agent reads — outside the checkout. Both path classes now parse under the same portable repo-relative contractartifact_ref.rsalready enforces for artifact paths.6 new tests: missing file, escaping evidence path, out-of-range line numbers, absolute department prompt, escaping rubric path, plus the example fixture grounding clean against the real tree.
docs/audit-report.mdupdated — the grounding pass and the registry path contract are now stated rather than implied.