You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/SECURITY.md
+15-4Lines changed: 15 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,13 +68,22 @@ API keys are read from environment variables or explicit config. kode never logs
68
68
69
69
## Dangerous Operations Approval
70
70
71
-
When running **without**`--sandbox`, kode's shell tool classifies every command by risk level and can prompt for user approval before executing high-risk operations.
71
+
When running **without**`--sandbox`, kode's shell tool and native tools (read_file, write_file, browser, etc.) classify every operation by risk level and can prompt for user approval before executing high-risk operations.
72
72
73
-
### How it works
73
+
The approval mechanism uses a unified **Approver** interface with two implementations:
74
+
75
+
| Mode | Approver | How it works |
76
+
|------|----------|-------------|
77
+
|**CLI** (`kode run`, `kode repl`) |`TTYApprover`| Opens `/dev/tty` — the same keypress-based prompt described below |
78
+
|**Web UI** (`kode serve`) |`WSApprover`| Sends `approval_request` via WebSocket — the browser shows a modal with Approve / Deny / Trust buttons |
79
+
80
+
Both provide the **same three actions**: approve once, deny, or trust for the session. The experience is identical regardless of how you interact with kode.
81
+
82
+
### How it works (CLI mode)
74
83
75
84
1. The shell tool receives a command from the agent (JSON with `command` and optional `description`)
76
85
2. The command is tokenized and classified into one of 8 risk classes (see [CLI.md](CLI.md#dangerous-operations))
77
-
3. If the class is configured to `prompt` (default for system_write, network_egress, code_execution, install), the tool opens `/dev/tty` and shows:
86
+
3. If the class is configured to `prompt` (default for system_write, network_egress, code_execution, install), the tool shows:
78
87
79
88
```
80
89
⚠️ Risk: system_write
@@ -114,10 +123,12 @@ When you press `T`, the risk class is cached in memory for the lifetime of the k
114
123
115
124
### Non-interactive mode
116
125
117
-
When `/dev/tty` is not available (piped stdin, CI environments), the configured `non_interactive` action is used:
126
+
When `/dev/tty` is not available (piped stdin, CI environments, or when no custom approver is configured), the configured `non_interactive` action is used:
118
127
-`"allow"` (default) — run all commands without prompting
119
128
-`"deny"` — block all prompted operations
120
129
130
+
> **Note:** In `kode serve` (Web UI) mode, this fallback is never hit — a WebSocket-based approver (`WSApprover`) is automatically injected, giving you interactive approval dialogs in the browser. The `non_interactive` setting only matters for CLI sessions without a TTY.
131
+
121
132
### Allowlist vs Denylist
122
133
123
134
-**Allowlist** entries (exact command match) bypass all checks — the command runs without prompt even if it would normally be denied
0 commit comments