Conversation
The scanner is the whole product here — it resolves a release, verifies it, runs the engine, scales the score, and decides whether the build fails — and until now nothing checked any of it. A regression in the gate logic or in the jq that reads the engine's ScanResult would ship silently. The suite drives the real scan/trustabl-scan.sh. Each test builds an actual gzipped release tarball containing a stub engine and a real checksums.txt over it, then puts a stub curl on PATH that serves that directory by URL basename. The download, sha256 verification, extraction and invocation therefore all run unmodified; only the network and the engine binary are substituted. The fixtures are unmodified output from a real `trustabl scan` (engine v0.1.7), so the assertions pin the scanner against the ScanResult shape the engine actually emits rather than a hand-written approximation of it.
The scanner ran the engine twice over the same source — once for SARIF, once for JSON — so every build paid the parse and analysis cost twice. On openai/openai-agents-python that is 89.4s against 43.8s for a single run. The engine has written both formats from one scan since v0.1.3: --json-out and --sarif-out persist each format to a file independently of --format. Use them when the binary advertises them, and keep the two-run path for older engines. Beyond the time, the two runs were two independent scans. NATIVE_CODE came from the SARIF run while every gate input — score, findings count, max severity — came from the JSON run, so the code that decided whether to fail the build and the data it decided on came from different invocations. One scan removes that. Output is unchanged: on the real engine the SARIF file is byte-identical and the JSON differs in nothing, scan_id included.
|
Thanks @bradAGI. Flagging that this is being read rather than sitting unlooked-at. We are reviewing all 52 open PRs together instead of one at a time. 31 of them edit Reading against #50, which has the same goal. The feature detection for The order we are working to: the test harness in #1 first, since twelve PRs depend on it and nothing is verifiable without it, then the fixes that close fail-open paths, then behaviour changes, then docs. A verdict on this one follows once its cluster is read. Apologies for the wait, and thanks for the contribution. |
sairenchristianbuerano
left a comment
There was a problem hiding this comment.
Thanks @bradAGI — the change looks good, but it needs a rebase.
Several PRs touching scan/trustabl-scan.sh have landed on main since you
opened this, so it no longer merges cleanly. Could you rebase and resolve?
bash test/run-tests.sh will confirm it — 19 passing on main right now.
Ping me when it's up.
Every build scans the source twice
Same target, same rules, walked and analyzed twice. Measured on
openai/openai-agents-pythonwithtrustabl v0.1.7:There is a correctness angle too
NATIVE_CODEcomes from the SARIF run. Every gate input — readiness, findings count, max severity — comes from the JSON run. Two independent scans, so the code deciding whether to fail the build and the data it decides on come from different invocations. One scan removes the possibility of them disagreeing.The fix
The engine has written both formats from a single scan since v0.1.3 —
--json-outand--sarif-outpersist each format to a file independently of--format:Used when the binary advertises them, with the two-run path kept for older engines — the same capability probe
trustabl-actiondoes ininstall.ts.Output is unchanged
Verified against the real engine, not the stub:
And end to end through the actual scanner — real release tarball, real sha256 verification, real extraction, real engine:
Tests
The stub engine now models
--json-out/--sarif-outand ascan --helpthat advertises them, withSTUB_NO_FILE_OUTto present an engine older than v0.1.3. Three tests: the modern path invokesscanexactly once, the fallback path exactly twice, and both produce the same artifacts and the same gate inputs.Before:
not ok — scan invocations: expected '1', got '2'. After:all 18 test(s) passed.