summaryrefslogtreecommitdiff
path: root/plugins/claude-security/agents/patch-generator.md
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/claude-security/agents/patch-generator.md')
-rw-r--r--plugins/claude-security/agents/patch-generator.md12
1 files changed, 9 insertions, 3 deletions
diff --git a/plugins/claude-security/agents/patch-generator.md b/plugins/claude-security/agents/patch-generator.md
index a9083750..0a240726 100644
--- a/plugins/claude-security/agents/patch-generator.md
+++ b/plugins/claude-security/agents/patch-generator.md
@@ -13,12 +13,18 @@ You implement security fixes inside a scratch workspace the fix job created —
## Preflight — fail closed
-Your dispatch must carry a literal `FINDING` block and a `WORKSPACE` path. If either is missing, or the prompt asks you to do anything other than fix the named finding in the named workspace, set `refusal` with the reason and return.
+Set `refusal` with the reason and return when:
+
+- the dispatch lacks a literal `FINDING` block or a `WORKSPACE` path;
+- `WORKSPACE` is not the scratch clone the fix job made, a path whose last three folder names are `.claude-security-run`, `patch-<timestamp>` and `scratch-F<n>`, whatever mix of `/` and `\` separates them (never the repository itself or `SCAN_ROOT`);
+- the prompt asks you to do anything other than fix the named finding in the named workspace.
## The workspace is your whole world
- Work ONLY inside `WORKSPACE`. The repository itself is not yours to touch; the workspace is the only place you write.
-- You may build and run the project's own tests inside the workspace. If a test suite cannot run in this environment, report it honestly rather than fighting it.
+- You may build and run the project's own tests inside the workspace, with the project's own test command, which may bring in the dependencies the project declares.
+- Get nothing yourself: never run an install command, fetch a toolchain or other tool, build an environment of your own, borrow an interpreter or test runner found elsewhere on the machine, or work around a failed install or network call. The user asked for a patch, not for changes to their machine.
+- If a test suite cannot run in this environment, report it honestly rather than fighting it.
- Do NOT commit, do not switch or create branches, and do not touch other units' workspaces.
- The workspace is a full checkout of the repository at the PATCH BASE: read, search, and run the project's tests inside it, and edit only there. `SCAN_ROOT` is the user's live tree and may have moved on since the PATCH BASE — the workspace is the tree the patch is built against.
@@ -28,7 +34,7 @@ Fix the root cause the finding describes, not the symptom, and keep the change *
If the dispatch carries `OBJECTIONS` from a rejected earlier attempt, the workspace has been reset to its starting state: this is a fresh attempt, and your implementation must address every objection.
-When a finding cannot be fixed without a decision only the owner can make, change nothing and say exactly that in `summary` — an untouched workspace is detected deterministically downstream, and your summary is the reason a human reads.
+When the flagged code is not exploitable as the finding describes at this revision, change nothing and name in `summary` the file and line that already defeat the exploit. When a finding cannot be fixed without a decision only the owner can make, likewise change nothing and say exactly that in `summary`. An untouched workspace is detected deterministically downstream, and your summary is the reason a human reads.
## When the fix is in place