Skip to content

Commit 2c71ca7

Browse files
committed
feat: strengthen safety confirmations and security model
- Rewrite core/confirm.py with centralized confirmation mechanism - Risk levels: low (auto-approve), medium/high (y/n prompt required) - Non-interactive sessions reject medium/high unless --confirm flag - All decisions logged to activity log (approved/rejected/cancelled) - ConfirmationError exception for programmatic rejection - Add allowlist validation: unknown apps and unknown actions rejected - Add parameter validation: type checking, range bounds, coordinate validation - Add blocked applications list (BLOCKED_APPS) - Update deskbridge.py to use core.confirm for all desktop and wrapper actions - Fix wrapper cli.py relative imports to absolute imports - Add 9 security tests (confirmation, allowlist, parameter validation, blocked apps) - Update README with complete security model documentation - All 18 tests pass (9 original + 9 security)
1 parent 9ee3900 commit 2c71ca7

9 files changed

Lines changed: 716 additions & 73 deletions

File tree

‎README.md‎

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,66 @@ Add to `claude_desktop_config.json`:
155155

156156
Replace `path/to/DeskBridge/mcp_server.py` with the actual path to your DeskBridge installation.
157157

158-
## Completed
158+
## Security Model
159+
160+
DeskBridge is designed to be safe, auditable, and transparent. Every action
161+
passes through centralized security checks before execution.
162+
163+
### Safety confirmations
164+
165+
| Risk level | Behavior |
166+
|------------|----------|
167+
| **low** | Auto-approved, no prompt |
168+
| **medium** | Requires explicit y/n confirmation (or `--confirm` flag) |
169+
| **high** | Requires explicit y/n confirmation (or `--confirm` flag) |
170+
171+
**How confirmation works:**
172+
1. User runs a medium/high-risk action (e.g. `click`, `type`, `key`, `drag`).
173+
2. DeskBridge prints the action description and asks `Proceed? (y/n):`.
174+
3. Only `y` approves; anything else cancels.
175+
4. The `--confirm` flag skips the prompt (for automation/CI).
176+
5. In non-interactive sessions (no TTY, e.g. CI/CD, MCP server), medium/high-risk actions are **rejected** unless `--confirm` is passed.
177+
6. Every decision (approved/rejected/cancelled) is recorded to `logs/activity.log`.
178+
179+
### Allowlist (command restriction)
180+
181+
Only apps with an installed wrapper under `wrappers/<app>/manifest.json` can be executed.
182+
Only actions declared in that manifest's `actions` field are permitted.
183+
Unknown apps and unknown actions are **rejected before execution** with a clear error.
184+
185+
### Parameter validation
186+
187+
All parameters are validated for type and range before being passed to a wrapper:
188+
- Integer parameters must be integers (string coercion attempted).
189+
- Numeric parameters can have `min`/`max` bounds.
190+
- Coordinate parameters must be `[x, y]` pairs within valid bounds.
191+
- Invalid parameters raise a clear error and block execution.
192+
193+
### Blocked applications
194+
195+
Applications on the security block list (`BLOCKED_APPS` in `core.confirm`) are
196+
rejected even if a wrapper is installed. Add dangerous system processes here.
197+
198+
### Activity logging
199+
200+
Every action and confirmation decision is recorded to `logs/activity.log` as
201+
one JSON record per line:
202+
203+
```json
204+
{"timestamp": "2026-11-26T10:30:00.123456", "app": "blender", "action": "render", "args": {"file": "scene.blend"}, "status": "success", "message": ""}
205+
```
206+
207+
Status values: `success`, `failed`, `rejected`, `cancelled`.
208+
Logs are append-only and never auto-deleted; use `deskbridge log` to read or
209+
`core.activity_log.clear_logs()` to clear programmatically.
210+
211+
**No API keys, tokens, passwords, or credentials are stored in code or logs.**
212+
213+
### Local validation before execution
214+
215+
All security checks (allowlist, parameter validation, confirmation) happen
216+
**locally before** any desktop action or wrapper code is executed. Nothing is
217+
sent to a remote server.
159218
- [x] Blender render wrapper
160219
- [x] Core loader + confirmation
161220
- [x] Activity log tracking

0 commit comments

Comments
 (0)