Skip to content

Commit 33b6e30

Browse files
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 assumptions
1 parent 54b4804 commit 33b6e30

7 files changed

Lines changed: 782 additions & 54 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cortex-plugins/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ toml = { workspace = true }
1919

2020
# Error handling
2121
thiserror = { workspace = true }
22+
anyhow = { workspace = true }
2223

2324
# Logging
2425
tracing = { workspace = true }

0 commit comments

Comments
 (0)