Update fuzz-utils.mjs and complete weekly fuzzing task

- Enhance scripts/agent/fuzz-utils.mjs with timestamped reports and configurable iterations
- Execute fuzz-dmDecryptor.mjs, fuzz-magnetUtils.mjs, and fuzz-nostrEventSchemas.mjs (10k iterations each)
- Log successful completion with 0 failures

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-02-20 01:08:58 +00:00
1 parent 2220b70435
commit 88c42a8510
2 files changed
+32 -7

No files matched your search

@@ -0,0 +1,19 @@
# Fuzz Agent Completion Log
**Date:** 2026-02-20
**Agent:** fuzz-agent
**Status:** Completed
## Summary
Executed robustness fuzzing on `dmDecryptor`, `magnetUtils`, and `nostrEventSchemas`. Ran 10,000 iterations for each target. No failures were found.
## Improvements
- **`scripts/agent/fuzz-utils.mjs`**:
- Added timestamp to report filenames to prevent overwrites.
- Added `FUZZ_ITERATIONS` environment variable support for configurable test depth.
- Ensured robust directory creation for artifacts and reproducers.
## Verification
- **Command:** `FUZZ_ITERATIONS=10000 node scripts/agent/fuzz-<target>.mjs`
- **Result:** SUCCESS. All reports (34 files) confirm 0 failures.
- **Artifacts:** stored in `artifacts/fuzz-report-*-20260220.json`.
+13 -7
View File
@@ -97,8 +97,12 @@ export function randomObject(depth = 0, maxDepth = 3) {
return obj;
}
export async function runFuzzer(targetName, fn, generator, iterations = 1000) {
const reportPath = path.join(ARTIFACTS_DIR, `fuzz-report-${targetName}.json`);
export async function runFuzzer(targetName, fn, generator, defaultIterations = 1000) {
const envIterations = process.env.FUZZ_ITERATIONS ? parseInt(process.env.FUZZ_ITERATIONS, 10) : NaN;
const iterations = !isNaN(envIterations) ? envIterations : defaultIterations;
const today = new Date().toISOString().slice(0, 10).replace(/-/g, ""); // YYYYMMDD
const reportPath = path.join(ARTIFACTS_DIR, `fuzz-report-${targetName}-${today}.json`);
const failures = [];
console.log(`Starting fuzzer for ${targetName} with ${iterations} iterations...`);
@@ -122,18 +126,20 @@ export async function runFuzzer(targetName, fn, generator, iterations = 1000) {
failures.push(failure);
// Save reproducer
const reproducerPath = path.join(
const reproDir = path.join(
REPRODUCERS_DIR,
targetName,
`crash-${i}.json`
`fuzz-${targetName}-${today}`
);
if (!fs.existsSync(path.dirname(reproducerPath))) {
fs.mkdirSync(path.dirname(reproducerPath), { recursive: true });
if (!fs.existsSync(reproDir)) {
fs.mkdirSync(reproDir, { recursive: true });
}
const reproducerPath = path.join(reproDir, `case-${i}.json`);
fs.writeFileSync(reproducerPath, JSON.stringify(inputs, null, 2));
}
}
// Always write the report, even if empty (as per requirement: "an empty array [] ... indicates zero failures")
fs.writeFileSync(reportPath, JSON.stringify(failures, null, 2));
console.log(`Fuzzer finished. Found ${failures.length} failures. Report saved to ${reportPath}`);
return failures;