Commit 5a4806f
security: restrict set_config_value to known configuration keys (#353)
Add an allowlist of keys that can be set via the set_config_value
MCP tool. Previously, any key could be set — including internal
keys like clientId, usageStats, and abTest_* flags — because the
ServerConfig interface uses `[key: string]: any`.
This prevents a prompt injection or malicious MCP client from
tampering with internal state. Internal keys are still writable
by the server itself via configManager.setValue() directly; only
the client-facing tool handler is restricted.
Allowed keys: blockedCommands, allowedDirectories, defaultShell,
telemetryEnabled, fileReadLineLimit, fileWriteLineLimit.
Co-authored-by: Peter McDade <pmcdade@pmcdadePersonal.pmcdade.org>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 7090a5d commit 5a4806f
1 file changed
+22
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
58 | 70 | | |
59 | 71 | | |
60 | 72 | | |
| |||
73 | 85 | | |
74 | 86 | | |
75 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
76 | 98 | | |
77 | 99 | | |
78 | 100 | | |
| |||
0 commit comments