Skip to content

test(planner): assert hostile requirements are rejected before LLM call#71

Merged
tzone85 merged 1 commit into
mainfrom
test/planner-injection-regression
Jun 11, 2026
Merged

test(planner): assert hostile requirements are rejected before LLM call#71
tzone85 merged 1 commit into
mainfrom
test/planner-injection-regression

Conversation

@tzone85

@tzone85 tzone85 commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Summary

CLAUDE.md ships a six-bullet Prompt Injection Defenses section and SECURITY.md documents the policy, but the runtime enforcement (Planner.Plan) had zero regression coverage. Tomorrow's refactor could quietly drop the check and nothing would fail until a real attacker hit it. The 2026-06-11 audit ranked this P0.

Changes

Two new tests in internal/engine/planner_test.go:

  • TestPlanner_RejectsPromptInjection feeds "ignore previous instructions ..." through Plan, asserts an error AND that the LLM was never called AND that no REQ_SUBMITTED event landed in the event store. A regression that turned the rejection into "warn and continue" would surface here.
  • TestPlanner_RejectsEmbeddedSecret feeds a synthetic Anthropic-key-shaped string and makes the same triple assertion.

Test plan

  • Both new tests pass; LLM CallCount() == 0 after rejection.
  • go build ./..., go vet ./..., go test ./... -count=1 -timeout 240s all green locally.

Audit traceability

Test gap finding TEST-P0-4 (2026-06-11 sweep).

CLAUDE.md ships a six-bullet "Prompt Injection Defenses" section and
SECURITY.md documents the policy, but the runtime enforcement
(Planner.Plan) had ZERO regression coverage. The audit ranked this P0:
a tomorrow refactor could quietly drop the check and nothing would
fail until a real attacker hit it.

Two new tests:
- TestPlanner_RejectsPromptInjection feeds "ignore previous
  instructions" through Plan, asserts an error AND that the LLM was
  never called AND that no REQ_SUBMITTED event landed in the event
  store. Defense-in-depth: a regression that turned the rejection into
  a warn-and-continue would surface here.
- TestPlanner_RejectsEmbeddedSecret feeds a synthetic Anthropic key
  shape and makes the same triple assertion. Operator credential
  leakage is the second failure mode of the same guard.

Surfaced by the 2026-06-11 test audit (TEST-P0-4).
@tzone85 tzone85 merged commit ceac47a into main Jun 11, 2026
9 of 10 checks passed
@tzone85 tzone85 deleted the test/planner-injection-regression branch June 11, 2026 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant