Skip to content

fix(audit): ground evidence paths and reject registry paths that escape the repo - #31

Merged
2233admin merged 1 commit into
mainfrom
fix/audit-registry-path-escape
Jul 25, 2026
Merged

fix(audit): ground evidence paths and reject registry paths that escape the repo#31
2233admin merged 1 commit into
mainfrom
fix/audit-registry-path-escape

Conversation

@2233admin

Copy link
Copy Markdown
Owner

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 a status: confirmed finding's evidence path was 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. New validate_evidence_grounding(repo_root) resolves every file evidence entry under the repository root, requires it to exist, and requires line_start/line_end to be ordered and within that file. It is wired into audit --operation validate --repo <root>, the operation that holds the cited repository; render does not have one and does not claim to.

security-002 (medium)DepartmentRegistry is loaded from --repo, i.e. the scanned repository's own file, but its rubric and prompt path strings were joined onto repo_root and 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's prompt — the instruction source an audit agent reads — outside the checkout. Both path classes now parse under the same portable repo-relative contract artifact_ref.rs already 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.md updated — the grounding pass and the registry path contract are now stated rather than implied.

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@2233admin, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 30 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8f804f88-9fcc-48de-bca2-e73620249ddd

📥 Commits

Reviewing files that changed from the base of the PR and between d5b3394 and 2c66c17.

📒 Files selected for processing (6)
  • crates/code-intel-cli/src/audit_report/cli.rs
  • crates/code-intel-cli/src/audit_report/registry.rs
  • crates/code-intel-cli/src/audit_report/registry_tests.rs
  • crates/code-intel-cli/src/audit_report/validate.rs
  • crates/code-intel-cli/src/audit_report/validate_tests.rs
  • docs/audit-report.md

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…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.
@2233admin
2233admin force-pushed the fix/audit-registry-path-escape branch from 175d822 to 2c66c17 Compare July 25, 2026 15:48
@2233admin
2233admin merged commit ab4e1a8 into main Jul 25, 2026
6 checks passed
@2233admin
2233admin deleted the fix/audit-registry-path-escape branch July 25, 2026 16:04
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.

1 participant