test(planner): assert hostile requirements are rejected before LLM call#71
Merged
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_RejectsPromptInjectionfeeds"ignore previous instructions ..."throughPlan, asserts an error AND that the LLM was never called AND that noREQ_SUBMITTEDevent landed in the event store. A regression that turned the rejection into "warn and continue" would surface here.TestPlanner_RejectsEmbeddedSecretfeeds a synthetic Anthropic-key-shaped string and makes the same triple assertion.Test plan
CallCount() == 0after rejection.go build ./...,go vet ./...,go test ./... -count=1 -timeout 240sall green locally.Audit traceability
Test gap finding TEST-P0-4 (2026-06-11 sweep).