SETTINGS · deterministic-policy

Cautious permission profile for a Java/AWS team

A reviewed .claude/settings.json: acceptEdits with narrow allows, deny rules for credential paths and destructive git/AWS operations, and sandbox denyRead as the second wall.

✓ verified 2026-06-10 · stack: claude-code, java, aws · source

A committed, team-shared profile for a Java-on-AWS codebase that needs tight controls over credentials and destructive operations. Design intent: the everyday loop (build, test, format, commit, scoped AWS reads) runs without prompts; anything credential-shaped or destructive is denied at two independent layers.

.claude/settings.json
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"permissions": {
"defaultMode": "acceptEdits",
"allow": [
"Bash(./gradlew *)",
"Bash(mvn *)",
"Bash(npm run *)",
"Bash(git status)",
"Bash(git diff *)",
"Bash(git log *)",
"Bash(git add *)",
"Bash(git commit *)",
"Bash(git checkout *)",
"Bash(git branch *)",
"Bash(aws sts get-caller-identity)",
"Bash(aws s3 ls *)",
"Bash(aws logs *)",
"Bash(docker build *)",
"Bash(docker run --rm *)",
"Read(**)"
],
"deny": [
"Bash(git push --force *)",
"Bash(git push * main)",
"Bash(git push * master)",
"Bash(rm -rf *)",
"Bash(aws iam *)",
"Bash(aws organizations *)",
"Bash(aws sts assume-role *)",
"Bash(curl *)",
"Bash(wget *)",
"Read(./.env*)",
"Read(./secrets/**)",
"Read(~/.aws/**)",
"Read(~/.ssh/**)"
]
},
"sandbox": {
"enabled": true,
"filesystem": {
"denyRead": ["~/.aws/", "~/.ssh/", "~/.gnupg/"]
}
}
}

What it does

  • acceptEdits mode: file edits in the working directory proceed without prompts; review happens after the fact with git diff. Commands outside the allow list still prompt.
  • Narrow allows: build tools, local git, and read-shaped AWS CLI calls. Deliberately absent: git push (prompts every time: pushing is a decision), aws s3 cp, and anything that mutates cloud state. Compound commands are parsed per subcommand, so ./gradlew build && curl ... is not covered by the Gradle allow.
  • Deny rules win everywhere: because deny rules from any scope beat allow rules from every scope, committing this file means no developer’s ~/.claude/settings.json or settings.local.json can re-allow these patterns.
  • Credential paths blocked twice: Read deny rules stop Claude’s file tools; the sandbox denyRead stops any subprocess Bash spawns from opening ~/.aws/ or ~/.ssh/ at the OS level. The second layer matters because the sandbox’s default read policy is the entire filesystem, credentials included. denyRead entries are not optional on an AWS workstation.

Teams without those constraints usually start from the day-one baseline instead.

Failure modes

  • Argument-pattern denies are friction, not enforcement. Bash(aws iam *) can be dodged with flag tricks or by invoking the binary unusually; the security docs document this fragility. The denies here are tripwires for honest mistakes; the sandbox and the narrow allow list are the enforcement.
  • Sandbox availability. Sandboxing needs macOS Seatbelt or Linux/WSL2 bubblewrap + socat; on native Windows the sandbox block does nothing and you are left with the permission layer only. Fleets that require the sandbox should set failIfUnavailable: true in managed settings, but only on platforms that can satisfy it.
  • Read(**) is broad by design so the agent can navigate the repo; the deny rules carve out the secrets. If your repo vendors credentials anywhere outside ./.env* and ./secrets/, extend the deny list before adopting.
  • Network isolation still prompts. With the sandbox enabled, no domains are pre-allowed; the first outbound connection from a sandboxed command prompts. Add allowedDomains for your artifact repositories (Maven Central, your Nexus/Artifactory) to keep builds prompt-free.
  • This file is policy: gate changes to it. Put .claude/ behind CODEOWNERS so edits to this profile get owner review; see CI as the outer gate.

Verified against the permission rule syntax, settings precedence, and sandboxing docs, 2026-06-10.