Skip to content
Hands-on Coding Assistants

Part 4 — Build the Harness Chapter 23

AI-First Security & Governance

In this chapter

The registration reviewer needed a spec, a contract, and a patch. The fact that you can connect a tool to issue trackers or provide a token says little about whether this review needs it. List the actual inputs before you decide what the agent can reach.

Check an effective permission

Use a disposable exercise branch at lab-start. Open opencode.jsonc and add this final rule to permissions.

{ "action": "edit", "resource": "contracts/*", "effect": "deny" }

In a fresh Build session, try one harmless action.

Try the edit tool once to add an empty comment to
contracts/registration.test.ts. Report the tool status.

Look for the denied action and confirm git diff -- contracts/ is empty. Repeat with a scratch file inside the repository that the rule does not cover and check the resulting diff. This exercises the boundary in one tool. Restore the scratch change yourself and end the exercise session.

The repository’s outside-directory rule applies to tools that check it. An allowed shell script runs with the process’s privileges and can do more than its name suggests. Inspect the script and the environment you give it before allowing the command. For a boundary the process must respect, use a restricted account or an isolated execution environment with credentials and files scoped to the task.

Review the inputs as well as the patch

An issue, a README, and a retrieved tool response can carry instructions. If a response asks the agent to run an unrelated command or supply a credential, check where the text came from and use the configured permissions to limit reachable actions. For this exercise, use the lab’s fictional records. A hosted model can receive prompts, excerpts, and tool output. A local model can still be paired with network-capable tools. Pick the exposure that matches the task.

Open the verification record you saved in the prompt chapter. Check that it identifies each source and that the redaction marker is absent from the shareable copy. Review dependency and lockfile changes, plugin or server code, and the origin and licensing of contributed material. In a shared project, have the people who own the rules review changes to the rules themselves.

Write down the scope of the agent and the outcome of the two tool probes in the review record. If you can point to the permission rule, the tool result and the diff, a teammate can reproduce the decision without access to your original session.

References