The handbook/Claude Code Security Review: Threat Models, CI and AI Agent Controls
SettingsMy workspaceOfficial docs ↗

Advanced • Before higher-risk releases

Review the whole
security boundary.

Plan threat models, automated security checks, limited AI tool access, and recovery exercises. Define evidence before calling a release ready.

STEP-BY-STEP HANDBOOKFor maintainers • Use a test environment
Shared safety instructions included in every copied prompt

Inspect the current repository and its instructions first. Work only on this project in a local or test environment. Explain the risk and propose a small plan before editing. After I approve that plan, implement it and run focused checks. Do not deploy, change production data, spend money, or broaden account access without separate approval.

Prerequisites: Understand server routes, account permissions, automated tests, and deployment. A threat model maps what matters, who can reach it, and how it could be misused. For sensitive production systems, involve a qualified security reviewer.

Quick scan: Map trust boundaries. Check the release pipeline. Limit agents. Practice recovery.

1. Map assets and trust boundaries

List user data, credentials, administrative actions, and paid APIs. A trust boundary is where information crosses between different levels of trust, such as a browser calling your server. Use the OWASP Top 10 as an awareness checklist, not a compliance certificate.

Ask Claude to help

Claude Code conversation, in your own practice project
Map entry points, sensitive assets, trust boundaries, and abuse cases. Prioritize realistic risks with file references. Propose controls for the highest risks, including resource limits on expensive endpoints and protected audit logs. Identify assumptions and checks that require specialist review.

Copy includes the shared safety instructions above.

Check the result: For every priority risk, identify the actual enforcement point and a test that would fail without it. Check that logs omit credentials and private content. Record accepted risks explicitly.

2. Protect the path from code to production

A dependency is code your project relies on. A CI pipeline runs checks on proposed changes. Updates and scanners help, but a passing scan does not prove the absence of vulnerabilities.

Ask Claude to help

Claude Code conversation, in your own practice project
Review dependencies, lockfiles, and CI permissions. Propose dependency and secret scanning using supported project tools. Keep untrusted pull requests away from production secrets and write-capable tokens. Add focused authorization regression checks. Do not auto-upgrade major dependencies or weaken a failing gate.

Copy includes the shared safety instructions above.

Check the result: Verify checks ran on the exact proposed commit. Confirm a harmless failing test blocks the practice change. Review scanner findings and dependency compatibility instead of suppressing errors to obtain a green badge.

3. Constrain AI integrations

An agent can call tools and take actions. An MCP server exposes connected tools or data. Treat connector output as untrusted content and restrict actions independently of the prompt.

Ask Claude to help

Claude Code conversation, in your own practice project
Inventory AI tools and connectors. Propose narrow credentials, allowed destinations, validated tool arguments, and explicit approval for sensitive actions. Prevent retrieved text from authorizing tool calls. Review data sent to providers. Use dummy records for adversarial tests.

Copy includes the shared safety instructions above.

Check the result: Verify denied actions are blocked outside the model. Check that logs and tool errors do not expose secrets. Review behavior when a tool times out or returns misleading instructions; do not test external systems without authorization.

4. Rehearse recovery

An incident plan should be usable when you are stressed. Identify who can revoke credentials, stop access, restore data, and communicate an outage. Practice a restore with fake data in isolation. Write down what was recovered, what was lost, and what was not tested.

Claude Code conversation
Draft an incident and recovery checklist for this project. Include credential revocation, containment, backup restoration in an isolated environment, rollback limits, and evidence to preserve without exposing secrets. Do not perform destructive actions.

Copy includes the shared safety instructions above.

Completion evidence: Record the commit reviewed, controls changed, passing and failing checks, remaining risks, and the person who will decide whether to release.

References

Was this chapter useful?

Report an error

Votes are shared only if you enable optional measurement in Privacy & Preferences.

CONTINUE THE GUIDETroubleshooting

Edit this example

Changes here affect this copy only. Nothing runs from this site. Closing this window discards your edits.

Search the field guide

Search all chapters and FAQ answers. Use Tab to reach a result and Enter to open it.