Skip to content

Add hardened Inspect-native CodeGuard SecurityEval harness - #119

Merged
thomas-bartlett merged 8 commits into
mainfrom
feat/securityeval-inspect-harness
Sep 8, 2026
Merged

thomas-bartlett merged 8 commits into
mainfrom
feat/securityeval-inspect-harness

Conversation

@thomas-bartlett

Copy link
Copy Markdown
Contributor

Summary

Adds an Inspect-native SecurityEval harness for measuring how CodeGuard affects model-generated Python code across all 121 pinned benchmark cases.

The experiment compares three conditions:

  • the standard task prompt with no skill
  • the same task with a short secure-implementation prompt
  • the standard task with the repository's exact CodeGuard skill available for automatic routing

Codex runs inside a hardened, networkless Docker sandbox. The harness captures a bounded solution.py in Inspect's per-sample store without rewriting the raw model response, validates that the scaffold was meaningfully implemented while preserving its interface, and scores valid non-stub output with Semgrep through Inspect's normal scoring workflow.

Security and reproducibility

  • Installs the repository CodeGuard skill as exact validated bytes and makes it read-only to the agent.
  • Never imports, compiles, or executes captured solutions.
  • Uses a networkless, least-privilege Docker sandbox with bounded resources and temporary filesystems.
  • Exports only a stable, bounded UTF-8 solution.py through a strict wire contract.
  • Validates stored artifacts and Semgrep reports fail-closed before scoring.
  • Pins the dataset revision and hash, runtime dependencies, Codex CLI, Inspect AI, Inspect SWE, and Semgrep versions.
  • Records output validity, implementation status, source size, Semgrep findings, and detected CodeGuard loading separately.
  • Documents that the live p/security-audit registry rules are mutable and fetched for each scanned sample.

Validation

  • uv lock --check
  • uv run --locked pytest — 212 passed; 4 Docker tests deselected
  • uv run --locked pytest -m docker — 4 passed
  • uv run --locked python -m compileall -q codeguard_evals
  • uv run --locked inspect list tasks codeguard_evals/securityeval
  • Docker Compose configuration validation
  • Bounded live Semgrep smoke test
  • Dependency audit — no known vulnerabilities in the evaluation environment
  • git diff --check

The full 1,089-generation provider matrix is intentionally not part of PR validation because it incurs provider cost; the harness and its real Codex-in-Docker path are covered by the integration suite.

Related

Pin the supported Python runtime, bind Semgrep evidence to the complete locked rules tree, simplify output validity to bounded parseable source, and add focused CI and regression coverage.

@aacarter1 aacarter1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, this is a thoughtful and well-hardened foundation. I have two non-blocking concerns before its results are treated as decision-grade:

  1. The Docker integration tests covering the actual sandbox and Semgrep security boundaries are manual rather than part of required CI. Could we consider an enforced integration gate, or document who owns confirming that manual gate before releases?
  2. valid_output currently means bounded, non-empty, parseable Python; it does not establish meaningful implementation or interface preservation, and parse-valid stubs are accepted. The README documents this limitation, but the PR summary still claims meaningful, non-stub, interface-preserving validation. Could those claims be reconciled and future published results clearly framed as conditional on parse-valid output?
    Neither point necessarily needs to block merging this initial harness, but both matter for how confidently its results can be interpreted publicly.

@thomas-bartlett
thomas-bartlett merged commit d6a04cc into main Sep 8, 2026
5 checks passed
@thomas-bartlett
thomas-bartlett deleted the feat/securityeval-inspect-harness branch September 8, 2026 03:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants