Repository navigation
Description
Summary
When a completed multiscan campaign is resumed, the supervisor checks only whether four required artifact paths exist and are regular files. It does not parse the JSON documents, validate their schemas, or verify the sealed artifact digests.
As a result, a corrupted artifact bundle is still counted as completed and skipped instead of being rescanned.
Affected version and environment
- Released package:
@openai/[email protected] - Originally reproduced at commit
e94d6bef9797a192febfde89a26ec7f831bc09b2 - Confirmed still present on current
mainatf22d4a36f26d16287bcdfd707b369116e02a08c3 - Microsoft Windows NT 10.0.19045.0
- Node.js 24.18.0
Steps to reproduce
I used a source-level test harness modeled on tests-ts/multiscan.test.ts, so the reproduction does not require an API call:
- Create a temporary local Git repository and commit one file.
- Create a one-row inventory CSV containing the repository path and full commit SHA.
- Provide a test
createSecurity()client whoserun()method increments a counter, writes the four required artifact files, and returns complete coverage. - Run
runMultiscan()once and confirm that the security client was called once. - Replace the completed attempt's
scan-manifest.jsonwith invalid JSON while leaving all four files present:
{broken json
- Run
runMultiscan()again with the same inventory and output directory.
Observed result:
{
"first": {
"completed": 1,
"failed": 0,
"skipped": 0
},
"second": {
"completed": 1,
"failed": 0,
"skipped": 1
},
"securityRunCalls": 1,
"corruptedArtifactPreserved": true
}Expected behavior
The resumed campaign should validate the completed artifact bundle. If the contract or seal is invalid, the task should be treated as pending and a new attempt should be created.
Actual behavior
The task is reported as completed and skipped solely because the four paths remain regular files. The corrupted bundle is preserved as the latest successful result.
Impact
Interrupted writes, manual edits, filesystem corruption, or incomplete artifact restoration can leave a bundle that is unusable or no longer sealed. Subsequent bulk scans can still report the repository as completed without repairing or rerunning it.
Relevant code
- Resume decision:
codex-security/sdk/typescript/src/multiscan.ts
Lines 109 to 123 in f22d4a3
const receipts = await readReceipts(ledger); const pending: MultiscanTask[] = []; let completed = 0; for (const task of tasks) { const receipt = receipts.get(task.id.toLowerCase()); if ( receipt?.status === "completed" && receipt.outputDir === join(output, "artifacts", task.id, `attempt-${receipt.attempt}`) && (await hasArtifacts(receipt.outputDir)) ) { completed += 1; } else { pending.push(task); } - Artifact existence check:
codex-security/sdk/typescript/src/multiscan.ts
Lines 338 to 347 in f22d4a3
async function hasArtifacts(path: string): Promise<boolean> { try { if (!(await lstat(path)).isDirectory()) return false; for (const artifact of REQUIRED_ARTIFACTS) { if (!(await lstat(join(path, artifact))).isFile()) return false; } return true; } catch { return false; } - The current test helper also treats four
{}files as a completed bundle:codex-security/sdk/typescript/tests-ts/multiscan.test.ts
Lines 79 to 89 in f22d4a3
async function completedScan( outputDir: string, completeness: "complete" | "partial" = "complete", ): Promise<ScanResult> { await mkdir(outputDir, { recursive: true }); await Promise.all( ["scan-manifest.json", "findings.json", "coverage.json", "report.md"].map( (name) => writeFile(join(outputDir, name), "{}\n"), ), ); return { coverage: { completeness } } as ScanResult;
Suggested direction
Possible approaches:
- Reuse the existing contract/seal validation before accepting a completed receipt.
- Alternatively, record artifact digests in the receipt and verify them during resume.
- If validation fails, preserve the old attempt for inspection and create a new attempt rather than overwriting it.
- Add regression cases for malformed JSON, schema-invalid JSON, and a changed sealed artifact.
Activity
mldangelo-oai commentedon Oct 19, 2026
I reproduced this using saved test results: resume still counted malformed manifest JSON and a result with a broken findings digest as completed and skipped them. The normal contract loader rejected both.
Keeping P1. #97 and #466 propose fixes; resume needs to validate the full saved contract before reusing a result. Both corruption cases should be checked against the chosen fix before this closes.