fix: harden 13 security vulnerabilities (phase 2)#119
Merged
jamiepine merged 7 commits intoFeb 22, 2026
Conversation
…ell bypass) - Validate memory IDs as UUID format before LanceDB predicate interpolation (SQL injection) - Restrict CORS from allow_origin(Any) to mirror_request() with explicit methods/headers - Add 10 MiB request body size limit to prevent DoS via unlimited uploads - Clear inherited env vars from MCP subprocesses to prevent secret leakage - Block identity file writes (SOUL.md, IDENTITY.md, USER.md) through file tool - Expand shell hardening: unbraced $VAR detection, dump command blocking, interpreter one-liner prevention (python -c, perl -e, etc.)
…mlinks - Replace derived Debug with custom impls on 7 config structs that hold secrets (ProviderConfig, LlmConfig, DefaultsConfig, DiscordConfig, SlackConfig, TelegramConfig, TwitchConfig) — all secret fields now show [REDACTED] in logs and debug output - Replace unbounded_channel with bounded channel(256) in cortex_chat to prevent unlimited memory growth under backpressure - Reject symlinks within workspace in file tool resolve_path to prevent TOCTOU races where a path component is swapped after canonicalization
…d adapters Convert 11 production .expect() and panic!() calls to Result-based error handling: - main.rs: rustls crypto provider, agent config validation, 4 permissions checks - config.rs: provider API key resolution - slack.rs: 4 SlackAdapterState downcasts Startup failures now produce clean error messages instead of panics.
|
For the CORS fix, @PyRo1121 mentioned "restricted to configured origins with env override", though looking at the diff I don't see any way to configure it. |
rktmeister
pushed a commit
to rktmeister/spacebot
that referenced
this pull request
Mar 11, 2026
…ning-phase2 fix: harden 13 security vulnerabilities (phase 2)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Second wave of security hardening following PR #117. Addresses 13 findings from a comprehensive security audit — 2 critical, 7 high, and 4 medium severity.
Fixes
Commit 1 —
07b6b3aformat!()— added UUID validation before interpolating IDs into predicatessrc/memory/lance.rsallow_origin(Any)on API — restricted to configured origins with env overridesrc/api/server.rsenv_clear()before spawnsrc/mcp.rsSHELL,COMSPEC)src/tools/shell.rsDefaultBodyLimit(10MB)to API serversrc/api/server.rsSOUL.md,IDENTITY.md,USER.mdsrc/tools/file.rsCommit 2 —
5bfa2bdDebugderives on config structs expose secrets in logs — customDebugimpls redacting 7 secret-bearing structssrc/config.rschannel(256)bounded channelsrc/agent/cortex_chat.rs,src/hooks/cortex.rssrc/tools/file.rsCommit 3 —
81c3c06LD_PRELOAD,NODE_OPTIONS, etc.) — added blocklist with case-insensitive checksrc/tools/exec.rssrc/tools/memory_save.rsCommit 4 —
4c281d9scan_for_leaksnow decodes base64, hex, and URL-encoded content before pattern matching. Addedhexcrate dependency.src/hooks/spacebot.rs,Cargo.tomlCommit 5 —
bad87d3panic!/.expect()calls crash on recoverable errors — replaced 11 instances withResult-based error propagation: rustls init, agent config validation, permissions checks (main.rs), API key resolution (config.rs), adapter state downcasts (slack.rs)src/main.rs,src/config.rs,src/messaging/slack.rsTesting
rust-analyzerdiagnostics with zero errorsprotocnot available in dev env socargo checkcannot run (LanceDB build dependency), but all Rust analysis is cleanRelated