codex-security icon indicating copy to clipboard operation
codex-security copied to clipboard

Add versioned end-to-end discovery benchmarks across vulnerability categories

Open sylvesterkaczmarek opened this issue 3 months ago • 8 comments

Summary

Add a small versioned benchmark corpus for end-to-end security finding discovery, so changes to prompts, validation, deduplication, or model/provider settings can be compared across releases.

Existing coverage

The repository already contains secret-discovery, reducer, and triage evaluations. SastBench measures triage of supplied findings rather than repository-wide discovery.

The remaining proposal is broader discovery coverage across multiple vulnerability categories, with repeatable expected-result contracts. It should build on the existing evaluation infrastructure rather than assume no first-party evaluations exist.

Proposed benchmark cases

Use synthetic or intentionally vulnerable toy repositories with versioned expectations for:

  • language/runtime and vulnerability category;
  • expected source/sink or affected file region;
  • required, optional, and explicitly absent findings;
  • relevant evidence, reachability/preconditions, and severity range;
  • duplicate grouping and validation survival;
  • scan mode, model/provider settings, and other relevant evaluation inputs.

Score stable semantic properties rather than exact natural-language wording. Useful outputs include per-case recall, unexpected findings, duplicate rate, evidence quality, and regressions against a recorded baseline. Model variability should be visible in how results are interpreted.

Initial scope

  1. Define the expected-finding schema and scoring rules.
  2. Reuse or extend the existing runner with a handful of cases across distinct categories.
  3. Version fixtures and baselines so release comparisons are reproducible.
  4. Keep fixtures synthetic and free of private source, real credentials, and unpublished findings.
  5. Document which changes the suite can detect and which require a separate evaluation.

Replaying public-safe saved artifacts could later isolate pipeline changes from fresh model discovery. A dedicated benchmark CLI command was suggested in the original proposal; the public interface remains a design decision, not a prerequisite for the initial suite.

sylvesterkaczmarek avatar Aug 31 '26 13:08 sylvesterkaczmarek

Related: merged #1134 adds a synthetic secret-discovery eval with positive cases and negative controls. It covers part of this proposal, but not the broader benchmark across vulnerability categories.

mldangelo-oai avatar Oct 08 '26 00:10 mldangelo-oai

#1679 already adds production discovery evaluation with four vulnerability families and safe controls. Let's build on that work.

A useful next contribution would be one additional synthetic case or category, with versioned expected findings, a negative control, and deterministic grading tests. We should agree on the runner and fixture format first so contributors can add cases without building a second harness.

mldangelo-oai avatar Oct 19 '26 03:10 mldangelo-oai

Agreed. I suggest extending the #1679 runner and fixture schema, not creating a second harness. A fifth synthetic category could be SSRF, with an allowlisted negative control, versioned expected locations, and deterministic grading tests. Would you prefer this in a separate follow-up PR after #1679?

sylvesterkaczmarek avatar Oct 19 '26 15:10 sylvesterkaczmarek

The SSRF case suggested above shipped in #1917, on top of the four categories from #1679. It includes the allowlisted control, and all 12 grading tests pass. A useful next contribution would be a versioned release baseline or a check that an expected finding survives validation. The SSRF fixture itself is covered.

mldangelo-oai avatar Oct 25 '26 05:10 mldangelo-oai

Thanks for the update. Good to see the SSRF case land in #1917. A checked-in release baseline looks like the next useful increment: key it by the existing fixture hash and case IDs, so a new category doesn't make comparisons across corpus revisions misleading. I'd reuse the current runner rather than add another harness. Does that fit what you had in mind?

sylvesterkaczmarek avatar Oct 25 '26 09:10 sylvesterkaczmarek

I'd like to take a focused follow-up for #763, building on the existing evals/standard-time-budget runner and the versioned baseline idea discussed above.

My proposed scope is an offline release-baseline export and comparison for existing saved eval results:

  • Reuse the current fixture/source hashes, stable case IDs, and grading outputs rather than creating a second benchmark harness.
  • Identify comparable cases across corpus revisions by case ID and unchanged case definition; report added, removed, and changed cases separately.
  • Keep run failures, unknown usage, and findings needing adjudication explicit rather than turning them into misleading recall improvements.
  • Add deterministic tests and documentation. No paid model runs, production scan behavior changes, or fabricated release measurements.

I'll keep this separate from #2150's finding-survival integration tests.

Does that fit the intended next increment? I'm happy to keep the change small and adjust the baseline format to match maintainers' preferences.

Muzzy5150 avatar Oct 31 '26 15:10 Muzzy5150

Thanks for picking this up, @Muzzy5150. This sounds like the right focused next increment. I agree with reusing the existing runner and comparing only cases with both a stable ID and unchanged fixture definition, while reporting changed cases, failures and missing results separately. Keeping finding-survival checks in #2150 makes sense. Happy to review a small first PR once the maintainers confirm the baseline format.

sylvesterkaczmarek avatar Nov 01 '26 10:11 sylvesterkaczmarek

Opened #2698 to implement the offline release-baseline export and cross-revision comparison increment discussed above on top of evals/standard-time-budget.

Scope

  • Reuses saved evals/standard-time-budget artifacts (experiment.json, fixture.json, runs.json), SHA-256 digests, stable case IDs, and grading outputs in evals/standard-time-budget/baseline.mts without introducing a second harness or changing public CLI/SDK behavior.
  • Exports portable schemaVersion: 1 baselines without host filesystem paths (scanDir, reportPath, executable paths) or raw fixture source text, while retaining provenance digests and verbatim failure diagnostics.
  • Compares runs or exported baselines per arm (baseline and time-aware) on comparable cases where both ID and case definition (path, line span, canonical CWE set, and cited source-file SHA-256) match, while reporting added, removed, and changed cases, changed sourceFiles, run failures, unattempted missing pairs, unknown token usage, duplicate/safe-control/evidence-error deltas, recall ranges (min/max/mean), and needsAdjudication runs separately.
  • Documents baseline export/comparison and what changes the suite detects versus what requires manual adjudication or separate evaluation suites in evals/standard-time-budget/README.md.

Verification

  • evals/standard-time-budget/test_*.mts: 44/44 passed (including 7 new tests in test_baseline.mts covering portable export round-tripping, corpus expansion, regressions, changed/removed cases, failures/missing runs/unknown usage, variability, mismatch rejection, and CLI export/compare).
  • evals/secret-discovery/test_*.mts: 111/111 passed.
  • evals/workflow-routing/test_*.mts: 13/13 passed.
  • evals/triage-finding: 12 standalone deterministic check scripts and scripts/test-promptfoo-runner.mts (7/7) passed locally (scripts/test-triage-provider.mts copies process.execPath without dynamically linked shared libraries and binds a local viewer port in the sandbox, so full eval-contracts qualification awaits hosted Ubuntu CI).
  • Static checks: pnpm --dir sdk/typescript run build:evals, pnpm --dir sdk/typescript run types, pnpm --dir sdk/typescript run format, MCP Prettier check, node sdk/typescript/scripts/check-plugin-source.mjs, 29 .github/scripts CI-selection and gate tests, and git diff --check all passed (no live paid model run was performed).
  • On #2698, node-release-labels passed and applied skip-release-notes; Validate PR Title and node-ci are awaiting maintainer workflow approval for an external contributor PR.

mshayeb avatar Nov 16 '26 18:11 mshayeb