Claude Certified Architect – Foundations Practice Question 52: Least Privilege Tool Scoping

Claude Certified Architect, Foundations · Test 6 · question 2 of 10

Agent Architecture & Orchestrationmedium

A team runs a code-review agent with the Claude Agent SDK in a CI job, using permission_mode="bypassPermissions" so it never stalls waiting for a person. Its only job is to read the checked-out code and report findings; it must never modify files or run shell commands. An engineer proposes setting allowed_tools=["Read", "Grep"] and nothing else. A reviewer says this does not enforce the requirement. What is the best way to scope the agent to its job?

Select one answer
Show answer and explanation

Answer:

  • D. Keep allowed_tools for Read and Grep, and add Bash, Write, and Edit to disallowed_tools so those tools are removed from the request

D is correct. allowed_tools only pre-approves the tools it lists; it does not remove anything. Under bypassPermissions, every unlisted tool falls through to the permission mode and is approved, so Bash, Write, and Edit would still run. Adding a bare tool name to disallowed_tools removes that tool's definition from the request, so Claude cannot see or attempt it. That removes the shell and file-write tools the job does not need, which is least privilege.

A is wrong because unlisted tools are still available to Claude, and bypassPermissions approves them. B is wrong because a prompt sentence is guidance, not enforcement, and a crafted input can override it. C is wrong because acceptEdits auto-approves file edits, which is the opposite of the requirement, and it does nothing about shell commands.

Reference: Configure permissions (Agent SDK)

Practice Test 6 ›

Study guides for Claude Certified Architect, Foundations