You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(audit): ground evidence paths and reject registry paths that escape 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.
Copy file name to clipboardExpand all lines: docs/audit-report.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,9 @@ Findings must never write secret material in plaintext. A finding about a leaked
50
50
8. Every department listed in the report has exactly one `coverage_matrix` row and at most one `score_dashboard` entry.
51
51
9. A department whose `status` is `assessed` actually moves the health score: it has a non-null `score_dashboard` entry, and its `coverage_matrix` row is not `not_assessed`.
52
52
53
-
The registry itself (`orchestration/audit/departments.v1.json`) has its own invariants, checked by `DepartmentRegistry::validate()`: department ids are unique, every rubric file it points at exists on disk, and every `enabled: true` department's prompt file exists on disk. A disabled department may point at a prompt file that does not exist yet — that file is the department ticket's job, not the kernel's.
53
+
`validate()` is filesystem-free: it can see that a confirmed finding *has* a `path`, not that the path names a real file. Because a department is an agent, an unresolvable or drifted citation is the expected failure mode, so `validate_evidence_grounding(repo_root)` is a second pass that grounds every `file` evidence entry in the tree it claims to cite: the `path` must be portable repo-relative syntax, must resolve to a file under the repository root, and any `line_start`/`line_end` must be ordered and within that file. `code-intel audit --operation validate --repo <root>` runs it — that operation holds the repository the report cites. `--operation render` does not, and does not claim to.
54
+
55
+
The registry itself (`orchestration/audit/departments.v1.json`) has its own invariants. Its path strings are parsed under the same portable repo-relative contract — the registry is read from `--repo`, so a scanned repository must not be able to name rubric files outside the checkout or point a department's `prompt` (the instruction source an audit agent reads) at an arbitrary host file. `DepartmentRegistry::validate()` then checks: department ids are unique, every rubric file it points at exists on disk, and every `enabled: true` department's prompt file exists on disk. A disabled department may point at a prompt file that does not exist yet — that file is the department ticket's job, not the kernel's.
0 commit comments