Commit 33b6e30
committed
security(plugins): fix critical security vulnerabilities in plugin system
WASM Runtime DoS Protection:
- Add fuel-based CPU limiting (10M operations max)
- Add epoch interruption support for timeout handling
- Implement ResourceLimiter with 16MB memory cap
- Add table/instance/memory limits
- Remove panic-prone Default impl for WasmRuntime
Path Traversal Prevention:
- Canonicalize all paths before access checks
- Resolve symlinks to prevent traversal via symlinks
- Validate paths stay within allowed boundaries
- Handle non-existent paths safely for write operations
Fail-Closed Security Model:
- Empty command allowlist now denies all commands
- Empty domain allowlist now denies all network access
- None allowed_domains denies network access
- Explicit opt-in required via '*' wildcard
SSRF Protection:
- Block localhost/loopback addresses (127.0.0.1, ::1, etc.)
- Block private IP ranges (10.x, 172.16-31.x, 192.168.x)
- Block link-local addresses (169.254.x.x)
- Block .local/.internal domain suffixes
- Block dangerous ports (SSH, databases, etc.)
- Allow only http/https protocols
Permission Hook Security:
- Document security implications of Allow decision
- Add requires_elevated_trust() method
- Add validate_for_third_party() method
Hook Priority Security:
- Reserve priorities 0-49 for system use
- Add SYSTEM_CRITICAL, SYSTEM, SYSTEM_HIGH constants
- Add PLUGIN_MIN (50), PLUGIN_HIGH (75) for third-party
- Add validate_for_plugin() method
- Deprecate HIGHEST/HIGH in favor of explicit names
SDK Safety Documentation:
- Add SAFETY comments to all unsafe FFI calls
- Document host contract assumptions1 parent 54b4804 commit 33b6e30
7 files changed
Lines changed: 782 additions & 54 deletions
File tree
- src/cortex-plugins
- src
- hooks
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
0 commit comments