Guardrails and Safe Deployment
Official scope (Exam Guide v1.0): content policy, guardrail layering, secure-by-design (privacy, identity and access management, least privilege).
Prompts advise, code enforces
A rule in a prompt or CLAUDE.md shapes behaviour but is not a gate. Enforcement lives in permissions, hooks, sandboxes and server-side checks.
Four placements (design guidance)
Before the model (input screening) → around tools (permission rules, hooks, approvals) → after the model (output validation) → in the environment (sandbox, network and file limits). Log at every hand-off.
Claude Code enforcement
- Permission rules: deny, then ask, then allow; a deny at any settings scope wins; an allow cannot carve an exception out of a deny.
- Hooks: a
PreToolUsehook can deny or ask (exit code 2 or a JSON decision). A hook that stays silent approves nothing. Admins can restrict to managed hooks only. - Permission modes:
dontAskdenies anything that would prompt (locked-down CI);bypassPermissionsonly in isolated containers or VMs;autouses a classifier and reduces prompts but is not a guarantee. - Managed settings put technical policy (deny rules, sandbox on, allowed marketplaces) above every other scope; behavioural guidance goes in a managed CLAUDE.md.
Content policy (design guidance, verified refusal handling)
Follow the provider's usage policy; handle stop_reason: refusal explicitly (a 200, not an error); screen content against your own policy too.
Secure by design (design guidance)
Privacy by default; identity and access management for every actor (users, services, agents); least privilege everywhere; sandbox code execution.
Safe rollout (design guidance)
Start read-only; add write access gradually; human approval for destructive or irreversible actions; small group first; monitor; keep a kill switch; review logs and refine.
Exam traps
- CLAUDE.md "never push to main" as the control.
- A hook as the only security layer.
bypassPermissionson a developer laptop or shared host.- Treating a refusal as an HTTP error.
References
- Permissions — checked Oct 16, 2026
- Permission modes — checked Oct 16, 2026
- Hooks — checked Oct 16, 2026
- Settings — checked Oct 16, 2026
- Mitigate jailbreaks and prompt injections — checked Oct 16, 2026
- Handling stop reasons — checked Oct 16, 2026
Check your understanding
User allows
Bash(aws s3 ls), project denies `Bash(awsShow answerHide answerAnswer
)`. Result? *Denied.Why layer controls?Show answerHide answer
Answer
Any single control can fail or be bypassed.CI job must never stop to ask. Mode?Show answerHide answer
Answer
dontAskwith pre-approved tools.An agent will delete records. Safeguards?Show answerHide answer
Answer
Approval, least privilege, staged rollout, audit logging.