Protocol

Add one adversarial case the coding agent did not propose

Agreement between generator and verifier can share the same blind spot.

When it fits

  • AI-generated code and AI-generated tests agree perfectly on the happy path.

When to avoid it

  • One adversarial test is not a security assessment; scale independent testing to risk.

Why it matters

For consequential changes, add or select at least one negative, boundary or adversarial case independently: malformed input, missing permission, expired token, concurrency edge, partial failure or hostile data. Choose the case from the specification or threat model, not from the generated implementation.

Steps

  1. What input should be rejected?
  2. What permission should fail?
  3. What boundary value can break it?
  4. What partial dependency failure matters?
  5. Which case came from the spec rather than the implementation?

An example

For a new authorization endpoint, a reviewer manually adds the test for a user with the right object but wrong tenant.

Check your result

At least one meaningful test challenges the change from an independent failure model.

Keep this limit in mind

  • One adversarial test is not a security assessment; scale independent testing to risk.

Connected ideas

Useful with
Write acceptance criteria before asking AI to generate

Evidence and sources

Supports

OWASP recommends independent scrutiny of AI-generated test changes because an agent can make a suite pass by weakening, deleting or misdirecting tests.

This is a threat model and practice recommendation, not evidence that every agent routinely corrupts tests.

Secure Coding with AI Cheat Sheet · Test Fabrication and Test Deletion

Supports

NIST SSDF recommends integrating secure development practices into the software lifecycle rather than treating security as a separate late-stage review.

The framework is high-level and must be tailored to the organization's development model and risk.

Secure Software Development Framework (SSDF) Version 1.1 · SSDF overview

All sources (2)