Multi-Source Policy Resolution
Permission policies are loaded and merged from multiple sources, with defined priority:| Priority | Source | File | Scope |
|---|---|---|---|
| 1 (highest) | CLI flags | Command-line arguments | Current session |
| 2 | Project | .chatcli/coder_policy.json | Current workspace |
| 3 | User | ~/.chatcli/coder_policy.json | User-wide |
| 4 (lowest) | Defaults | Rules embedded in the binary | All |
Higher-priority sources override lower-priority ones. If a project rule says
allow for @coder exec, but the user rule says deny, the project rule takes precedence.Policy File Format
Available Actions
| Action | Behavior |
|---|---|
allow | Automatic execution without asking |
deny | Automatic blocking without asking |
ask | Prompts for interactive user approval |
Denial Tracking
The Denial Tracker monitors when the user denies permission to prevent infinite prompts:- Per-Tool Blocking
- Session Escalation
When the user denies the same tool 3 consecutive times, it is auto-blocked for the rest of the session.
The consecutive counter is reset when the user approves an execution of the tool.
Denial Tracker Configuration
| Environment Variable | Description | Default |
|---|---|---|
CHATCLI_MAX_CONSECUTIVE_DENIALS | Consecutive denials before blocking the tool | 3 |
CHATCLI_MAX_TOTAL_DENIALS | Total denials before escalating the session | 20 |
Safety Immunity (Safety Bypass)
There are 40+ operation patterns that ALWAYS require user approval, regardless of anyallow rule in the policy. These patterns protect against catastrophic errors:
Destructive Filesystem Operations
Destructive Filesystem Operations
rm -rf/rm -frand variantsmkfs(format filesystem)ddwriting to devices (of=/dev/)shred(secure deletion)
System Directories
System Directories
- Writing to
/etc/,/boot/,/sys/,/proc/ - Output redirection to
/etc/
Privilege Escalation
Privilege Escalation
sudoany commandsu -(user switch)chmod 777(world-writable)chmod +s(setuid/setgid)chown root
Kernel/System Manipulation
Kernel/System Manipulation
insmod,rmmod,modprobe(kernel modules)sysctl -w(sysctl write)iptables -F(firewall flush)systemctl stop/disable/mask
Network Exfiltration
Network Exfiltration
/dev/tcp/(bash reverse shell)nc -l/ncat -l(netcat in listen mode)
Credential Access
Credential Access
.ssh/(SSH keys).gnupg/(GPG keys).aws/credentials.kube/config
Database Destruction
Database Destruction
DROP DATABASE/TABLE/SCHEMATRUNCATE TABLEDELETE FROM ... WHERE 1=1
Git Force and Processes
Git Force and Processes
git push --force/git push -fgit reset --hardgit clean -fkill -9,killall,pkill -9shutdown,reboot,poweroff,halt
Read-Only Command Allowlist
ChatCLI maintains an allowlist of 90+ commands that are automatically approved because they are read-only:- Filesystem
- Text Processing
- Git (Read-Only)
- Dev Tools
- System and Containers
- Package Managers
ls, ll, cat, head, tail, less, more, wc, file, stat, du, df, find (without -delete/-exec), tree, realpath, readlink, basename, dirname, md5sum, sha256sumAdditional Protections
Even for allowlisted commands, certain flags and patterns are not auto-approved:| Command | Unsafe Flags |
|---|---|
tail | -f (follow = long-running) |
find | -delete, -exec, -execdir |
sed | -i, --in-place |
sort | -o (writes to file) |
git config | --global, --system |
| rm, | sudo, | xargs, | sh) or output redirection (>, >>) are never auto-approved.
Decision Flow
Next Steps
Coder Security
Details on coder mode security.
Hooks System
PreToolUse hooks for additional guardrails.
Security
General ChatCLI security model.
Plugin @coder
Reference for the tools protected by the permissions system.