Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(ci): enforce storage bypass history checks for real checkouts

Steven Enamakeld0156cf10b6e
diff --git a/scripts/ci/check-storage-bypass.mjs b/scripts/ci/check-storage-bypass.mjs
index f6382d2122..a10e021cec 100755
--- a/scripts/ci/check-storage-bypass.mjs
+++ b/scripts/ci/check-storage-bypass.mjs
@@ -23,6 +23,7 @@
// node scripts/ci/check-storage-bypass.mjs --write-baseline
// node scripts/ci/check-storage-bypass.mjs --root <dir> (tests)
+import { execFileSync } from "node:child_process";
import { stripRustComments } from "./check-crate-chain.mjs";
import {
validateCoverageDebt,
@@ -43,6 +44,21 @@ const baselinePath = resolve(
"scripts/ci/storage-bypass-baseline.json",
);
const writeBaseline = process.argv.includes("--write-baseline");
+const enforceHistory =
+ rootFlag === -1 ||
+ (() => {
+ try {
+ return (
+ execFileSync("git", ["rev-parse", "--show-toplevel"], {
+ cwd: repoRoot,
+ encoding: "utf8",
+ stdio: ["ignore", "pipe", "pipe"],
+ }).trim() === repoRoot
+ );
+ } catch {
+ return false;
+ }
+ })();
export const CURATED_VENDOR_ROOTS = [
"vendor/tinyagents/crates/tinyagents-session/src/run_ledger",
@@ -265,11 +281,11 @@ async function main() {
}
const raw = await collectFindings(repoRoot, { includeAllowed: true });
let debtErrors = validateCoverageDebt(findings, baseline, extension);
- if (rootFlag === -1)
+ if (enforceHistory)
debtErrors.push(...validateAllowances(raw, auditedReasons));
// Fixture roots without Git history exercise source scanning; CI always checks
// the real checkout against its canonical merge base and retained records.
- if (rootFlag === -1) {
+ if (enforceHistory) {
const history = historicalFindings(repoRoot, {
scan,
withoutAllowed,
diff --git a/scripts/ci/storage-bypass.md b/scripts/ci/storage-bypass.md
index 56f04242bb..658b399022 100644
--- a/scripts/ci/storage-bypass.md
+++ b/scripts/ci/storage-bypass.md
@@ -54,8 +54,8 @@ known indirect host opens. New rules mask Rust comments and quoted fixtures;
original core rule identities retain their existing lexical behavior.
Real CI uses the canonical merge base and fails if the base, original baseline,
-or recorded vendor source is unavailable. `--root` supports isolated source
-fixtures; those tests independently exercise the manifest comparison policy.
+or recorded vendor source is unavailable. `--root` also checks history when it names a real Git checkout; it supports isolated source
+fixtures without Git; those tests independently exercise the manifest comparison policy.
Do not use a synthetic fixture result as proof of actual host storage isolation.
The embed Tokio writer and five additional coverage/regeneration cases genuinely