From 88c42a8510654b36871dc94227763ec068ab1bb0 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 20 Feb 2026 01:08:58 +0000 Subject: [PATCH] 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 <53631862+PR0M3TH3AN@users.noreply.github.com> --- ...026-02-20_01-08-10_fuzz-agent_completed.md | 19 ++++++++++++++++++ scripts/agent/fuzz-utils.mjs | 20 ++++++++++++------- 2 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 docs/agents/task-logs/weekly/2026-02-20_01-08-10_fuzz-agent_completed.md diff --git a/docs/agents/task-logs/weekly/2026-02-20_01-08-10_fuzz-agent_completed.md b/docs/agents/task-logs/weekly/2026-02-20_01-08-10_fuzz-agent_completed.md new file mode 100644 index 00000000..fa35cd89 --- /dev/null +++ b/docs/agents/task-logs/weekly/2026-02-20_01-08-10_fuzz-agent_completed.md @@ -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-.mjs` +- **Result:** SUCCESS. All reports (34 files) confirm 0 failures. +- **Artifacts:** stored in `artifacts/fuzz-report-*-20260220.json`. diff --git a/scripts/agent/fuzz-utils.mjs b/scripts/agent/fuzz-utils.mjs index 442975fb..08a041be 100644 --- a/scripts/agent/fuzz-utils.mjs +++ b/scripts/agent/fuzz-utils.mjs @@ -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;