{"name":"review-fresh-diff-security-prompt","description":"Checks only the lines just added in a code change for injection, XSS, SSRF, hardcoded secrets, unsafe deserialisation, path traversal and missing ownership checks. Use when an agent is writing code and you want those risks caught in the fresh diff before anyone sees the result, or a checklist for this change rather than a whole-app audit.","category":"coding-prompts","tags":["security","secrets"],"models":["any"],"proven":false,"passing_families":0,"model_testing":"Not yet model-tested; testing Jan 2027","url":"https://theskillvault.ai/skills/review-fresh-diff-security-prompt","api_url":"https://theskillvault.ai/api/skills/review-fresh-diff-security-prompt","raw_url":"https://theskillvault.ai/api/skills/review-fresh-diff-security-prompt/raw","body":"# Review a fresh diff for security risks (prompt)\n\nThis pass looks at code as it is written. It checks the lines just added. It does not audit the whole app, and it does not replace a human review.\n\n## When to use\n- An agent just edited files, and you want security bugs caught before the result is shown.\n- You have a unified diff and want a checklist for the added lines only.\n- You suspect injection, XSS, SSRF, a hardcoded secret, unsafe deserialisation, path traversal, or a missing ownership check in this change.\n\n## When not to use\n- You want the whole app walked for leaked keys, database rules, headers and packages. Use audit-app-security.\n- You want a threat model of components and trust boundaries. Use threat-model-your-app.\n- You want bugs, performance and readability as well as security. Use review-code-prompt.\n\n## Steps\n1. Get the working directory with `pwd` and the diff with `git diff` (or the patch the agent just wrote).\n2. Paste the prompt below. Fill in the absolute working directory and the diff.\n3. Read only medium, high and critical findings. Each one must quote an added line.\n4. Fix the real ones, then run the prompt again on the new diff.\n5. Do not post findings anywhere until you say so.\n\n## Prompt\n```text\nYou are checking a fresh code change for concrete security bugs an attacker could use.\nWorking directory: <ABSOLUTE PATH FROM pwd>.\nCite only paths that appear in a diff header, or that you have just read from that directory.\nIf you do not have a path, say so. Do not invent an absolute path.\nUse whatever model is already running. Do not switch to a named vendor model.\n\nReview the unified diff. Lines that start with + were added. A space prefix is old context. A line that starts with - was removed.\nFlag a problem only when the added lines introduce it.\nAlso flag an added line that sends untrusted data into a dangerous sink that was already there (eval, a shell, or SQL built from strings).\nIgnore the same problem if it already existed in the removed lines or in unchanged context.\nIgnore starter code the task did not ask you to change.\n\nFor each finding give: exact file path, category, the added line in quotes, how an attacker would use it, a concrete fix, and severity (critical, high or medium).\nDrop low and best-practice notes. If nothing qualifies, say \"No new security issues in the added lines.\"\n\nChecklist. Look for these in the added lines:\n1. Command and code injection. User data in a shell string, exec, eval, new Function, os.system, or subprocess with a shell. Prefer an argument array. A value that starts with a dash can still be a flag even without a shell.\n2. SQL injection. User data concatenated or interpolated into SQL. Use a parameter or the query builder.\n3. XSS. innerHTML, outerHTML, document.write, dangerouslySetInnerHTML, or a template that does not escape (EJS unescaped output, mark_safe, autoescape off). An escaper that forgets quotes still breaks an attribute.\n4. Unsafe deserialisation. pickle.load, yaml.load or unsafe_load, torch.load without weights_only, marshal, shelve, or PHP unserialize on data you did not produce. Prefer JSON or a schema.\n5. SSRF. A user-influenced URL is fetched. A format check is not enough. After DNS, reject loopback, private ranges and link-local (cloud metadata). Re-check each redirect.\n6. Path traversal. A user path is joined onto a base directory. Join and normalise do not stop .. or symlinks. Resolve the real path, then check it stays under the real base directory.\n7. Ownership and IDOR. A handler loads or changes a row by an id from the request and never checks the caller owns it. Compare with the sibling handler. A token minted from the body alone, with no logged-in user, is the same class of bug.\n8. Secrets. A password, API key or private key written in source. A secret printed to logs or put in a query string. A password stored with a fast hash. A session id or token drawn from a non-crypto random source. A dev fallback such as an env default is not a finding.\n9. Other concrete holes. TLS verification turned off for a non-local host. XML parsed with external entities. An open redirect to a next URL. CSRF protection switched off. A GitHub Actions run step that interpolates an issue title, PR body or client payload. Pass those values through an env block.\n\nDo not flag: denial of service, missing rate limits, missing HTTPS in general, crashes, theoretical races, public analytics keys, or non-secret config such as a port or a table name.\nComments that say \"already safe\" are claims. Check the code.\nA file can have more than one issue. Keep going after the first.\nDo not post comments. Ask me first.\n```\n\n## How to adapt\n- Project-specific rules? Add a short list under the checklist. Keep secrets out of that list.\n- Want a second pass on one finding? Ask it to trace callers of that function only.\n- Not a git repo? Paste the before and after of each file and mark the new lines yourself.\n\n## Gotchas\n- A whole-app audit will bury this change in old issues. Stay on the added lines.\n- A safety comment is not proof. The check has to be in the code you can see.\n- Never paste secrets, tokens or private customer data from the diff into a chat that others can read.\n\n## Portability\nWorks with any AI that can read a diff, and with any language. Without git, paste the change. The checklist is the same on any host.\n\n## Done when\n- The prompt names the working directory you supplied, and every path in the report is real.\n- Each finding quotes an added line, names the category and gives a fix, or the report says there are none.\n- Nothing was posted without your go-ahead.\n\n## Example prompt\n\"Check the diff I just wrote for injection, XSS, SSRF, hardcoded secrets and unsafe deserialisation. Use pwd as the working directory. Do not invent paths. Do not post anything.\"\n\n---\nModified from the original security-guidance plugin in anthropics/claude-plugins-official, by David Dworken (Anthropic). Credit: Anthropic, Apache-2.0. The upstream LICENSE copyright line is the unfilled template. Original: https://github.com/anthropics/claude-plugins-official/tree/1d8db0deb7967d5bfb1ff7a851a255cb87b01a85/plugins/security-guidance. Changes by TheSkillVault are listed in the metadata above and in NOTICE.txt. See LICENSE.txt.","files":["LICENSE.txt","NOTICE.txt"],"license":"Apache-2.0","license_name":"Apache License 2.0","license_url":"https://www.apache.org/licenses/LICENSE-2.0","attribution":"Based on work by David Dworken (Anthropic) (Anthropic, Apache-2.0. Upstream LICENSE keeps the unfilled template line Copyright [yyyy] [name of copyright owner]., Apache License 2.0), https://github.com/anthropics/claude-plugins-official/tree/1d8db0deb7967d5bfb1ff7a851a255cb87b01a85/plugins/security-guidance; adapted by TheSkillVault, https://theskillvault.ai","install":{"claude_code":"curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/review-fresh-diff-security-prompt/raw' -o ~/'.claude/skills/review-fresh-diff-security-prompt/SKILL.md' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/review-fresh-diff-security-prompt/files/LICENSE.txt' -o ~/'.claude/skills/review-fresh-diff-security-prompt/LICENSE.txt' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/review-fresh-diff-security-prompt/files/NOTICE.txt' -o ~/'.claude/skills/review-fresh-diff-security-prompt/NOTICE.txt'","cursor":"curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/review-fresh-diff-security-prompt/raw' -o '.cursor/skills/review-fresh-diff-security-prompt/SKILL.md' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/review-fresh-diff-security-prompt/files/LICENSE.txt' -o '.cursor/skills/review-fresh-diff-security-prompt/LICENSE.txt' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/review-fresh-diff-security-prompt/files/NOTICE.txt' -o '.cursor/skills/review-fresh-diff-security-prompt/NOTICE.txt'","agents":"curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/review-fresh-diff-security-prompt/raw' -o '.agents/skills/review-fresh-diff-security-prompt/SKILL.md' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/review-fresh-diff-security-prompt/files/LICENSE.txt' -o '.agents/skills/review-fresh-diff-security-prompt/LICENSE.txt' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/review-fresh-diff-security-prompt/files/NOTICE.txt' -o '.agents/skills/review-fresh-diff-security-prompt/NOTICE.txt'","mcp_url":"https://theskillvault.ai/mcp","cursor_mcp_deeplink":"cursor://anysphere.cursor-deeplink/mcp/install?name=theskillvault&config=eyJ1cmwiOiJodHRwczovL3RoZXNraWxsdmF1bHQuYWkvbWNwIn0%3D","mcp_config":{"mcpServers":{"theskillvault":{"url":"https://theskillvault.ai/mcp"}}}},"bundles":[],"tested_on":[{"family":"chatgpt","name":"ChatGPT","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"claude","name":"Claude","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"gemini","name":"Gemini","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"grok","name":"Grok","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"llama","name":"Llama","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"deepseek","name":"DeepSeek","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"mistral","name":"Mistral","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"qwen","name":"Qwen","outcome":null,"date":null,"source":null,"counts":false,"stale":false},{"family":"kimi","name":"Kimi K","outcome":null,"date":null,"source":null,"counts":false,"stale":false}],"proven_rule":{"threshold":5,"window_days":365,"computed_at":"2026-11-29T03:42:30.374Z"}}