Overview
The satellite protects against security threats at multiple levels:- Input Validation: Re-validates commands and arguments before spawn
- Command Resolution: Only allows commands from a strict allowlist
- nsjail Sandbox: Isolates processes with resource limits and restricted filesystem access
- Environment Sanitization: Strips dangerous environment variables
- Backend validation is bypassed due to a bug
- Database is compromised and contains malicious data
- Configuration is modified after backend validation
Defense-in-Depth Architecture
services/satellite/src/config/security-validation.ts- Validation functionsservices/satellite/src/process/nsjail-spawner.ts- Secure process spawningservices/satellite/src/config/nsjail.ts- nsjail configuration and blocked env vars
Command Validation
The satellite validates commands against a strict allowlist before resolving to executable paths.Allowed Commands
Path Resolution:
Command paths are resolved dynamically at satellite startup using the system PATH. Common locations searched:
~/.local/bin/- User-local installations (Python tools via pip)/usr/local/bin/- Homebrew, manual installs/usr/bin/- System package manager/bin/- Core system binaries
Dynamic Command Resolution
Commands are resolved at satellite startup, not hardcoded:- Startup Validation -
validateSystemRuntimes()checks commands exist - Path Resolution -
initializeCommandCache()finds absolute paths usingwhich - Security Validation - Paths validated against allowed patterns
- Caching - Resolved paths cached in memory for runtime use
- Spawning - nsjail uses cached paths for process execution
- Startup-time resolution - Not per-request, prevents injection
- Path validation - Only allowed directories accepted
- File permissions check - Must be executable
- Caching - Resolved paths cached in memory, can’t be manipulated
- Allowlist - Only specific commands allowed
- pip with
--user:~/.local/bin/ - System packages:
/usr/bin/ - Homebrew:
/usr/local/bin/ - Custom installs:
/opt/*/bin/
Secure Command Resolution
TheresolveCommandPath() function validates commands and uses the runtime cache:
Rejected Patterns
- Absolute paths (
/bin/bash,/usr/bin/node) - Commands not in the allowlist
- Empty or non-string commands
Argument Validation
Arguments are validated before being passed to nsjail to prevent sandbox bypass and command injection.Critical Blocked Patterns
Validation Before Spawn
nsjail Sandbox Protection
nsjail provides process isolation with strict resource limits and filesystem restrictions.Resource Limits
Filesystem Restrictions
Read-Only Mounts:/usr- System binaries/lib,/lib64- System libraries/bin,/sbin- Core utilities/etc- Configuration (includes DNS resolver)
/tmp- Temporary storage (tmpfs with size limit)/home/{runtime}- Runtime-specific cache directory
/app- GitHub deployment directory (read-only, present only for GitHub deployments)
/dev/null- Required for I/O/dev/urandom- Required for crypto operations/dev/zero- Required for memory allocation/dev/fd- File descriptor management (symlink)
Namespace Isolation
Active Namespaces (Primary Security Boundary):- PID Namespace: Complete process tree isolation per team
- Mount Namespace: Isolated filesystem view with read-only system directories
- User Namespace: UID/GID mapping (prevents ALL privilege escalation including setuid)
- IPC Namespace: Isolated inter-process communication
- UTS Namespace: Team-specific hostname (
mcp-{team_id})
- Network Namespace: Disabled to allow package downloads via npx/uvx
- Cgroup Namespace: Disabled for kernel compatibility
Security Model: Namespace isolation is the primary security boundary that prevents malicious code from escaping the sandbox or accessing other teams’ data. Resource limits (rlimits) provide secondary DoS protection. With user namespace active, privilege escalation attacks (including rlimit bypasses) are prevented.
Network access is currently allowed to enable package downloads via npx/uvx. Future enhancements may add egress filtering to restrict network destinations.
Environment Variable Sanitization
The satellite strips dangerous environment variables before passing them to nsjail.Blocked Variables
Library Injection:LD_PRELOAD- Most dangerous, injects shared librariesLD_LIBRARY_PATH- Library search path manipulationLD_AUDIT,LD_DEBUG,LD_PROFILE
NODE_OPTIONS- Node.js flag injectionNODE_PATH- Module path manipulationPYTHONSTARTUP- Python startup script executionPYTHONPATH- Python module path manipulation
BASH_ENV,ENV- Shell startup script executionSHELL- Default shell override
PATH,HOME,TMPDIR- Already controlled by nsjail
Sanitization Implementation
Security Logging
All security-relevant events are logged for audit purposes.Log Events
Log Format
Log Rate Limiting Protection
The satellite implements per-process log rate limiting to prevent stderr flooding attacks.Attack Vector
A malicious or buggy MCP server could flood stderr with excessive log output to:- Exhaust satellite memory and CPU
- Overload backend database with INSERT operations
- Fill EventBus queue causing legitimate log loss
- Degrade performance for all teams on the satellite
Protection Mechanism
Per-Process Rate Limiting:- Rate limit: 20 logs per second per MCP process (configurable)
- Line truncation: 1KB maximum per log line (configurable)
- Action on exceeded: Excess logs silently dropped
- Warning emission: Summary warning every 60 seconds when limit exceeded
- Rate limiting happens at stderr capture (before LogBuffer)
- Sliding window algorithm (20 logs in last 1 second)
- Independent rate limiter per process (~176 bytes memory overhead)
- Automatic cleanup on process termination
Configuration
Monitoring
When a process exceeds the rate limit, the satellite logs a warning:mcp.server.log_rate_limit_exceeded event to the backend for monitoring dashboards and alerts.
File References:
services/satellite/src/process/log-rate-limiter.ts- Rate limiting logicservices/satellite/src/process/manager.ts- Integration with stderr handler
Runtime-Specific Configuration
The satellite applies runtime-specific environment variables for each supported runtime.Node.js Runtime
Python Runtime
Sandboxed Build Commands (GitHub Deployments)
For GitHub deployments, build commands (npm install, npm run build, uv sync) run inside the nsjail sandbox with sanitized environments.
File Reference: services/satellite/src/process/nsjail-spawner.ts
Build Command Sandboxing
Allowed Build Commands
Paths resolved at startup from system PATH. See Dynamic Command Resolution for details.
Sanitized Build Environment
Build commands receive a minimal, sanitized environment with NO secrets: Node.js:Network Policy
Build Script Re-validation (Defense-in-Depth)
The satellite re-validates build scripts before execution, even though the backend already validated them:services/satellite/src/config/security-validation.ts
Python Runtime Support
The satellite supports Python GitHub deployments with auto-detection of three installation patterns.Installation Methods
For detailed pattern detection logic, see: GitHub Deployment
Python Version Selection (Security Consideration)
The satellite uses smart Python version selection to avoid bleeding-edge versions:- Avoids bleeding-edge Python (e.g., 3.14 when just released) to prevent wheel compilation issues
- Prefers stable versions (e.g., 3.13) with mature package ecosystems and pre-built wheels
- Respects
requires-pythonconstraints frompyproject.toml
- Reduces attack surface: Avoids unstable Python releases with potential security vulnerabilities
- Prevents source compilation: Pre-built wheels reduce supply chain risks from malicious build scripts
- Ensures reproducible builds: Stable Python versions produce consistent, auditable builds
- Minimizes build failures: Mature ecosystems have better wheel availability
- Current stable version (e.g., 3.13 when 3.14 is bleeding-edge)
- Previous stable version (e.g., 3.12)
- LTS versions (e.g., 3.11, 3.10)
- System default (last resort)
services/satellite/src/utils/runtime-validator.ts - selectBestPythonForDeployment()
Entry Point Resolution
The satellite resolves Python entry points in this priority order:[project.scripts]in pyproject.toml →.venv/bin/{script_name}[project.gui-scripts]in pyproject.toml →.venv/bin/{script_name}__main__.pyfallback →.venv/bin/python __main__.pysrc/__main__.pyfallback →.venv/bin/python src/__main__.pyserver.pyfallback →.venv/bin/python server.pymain.pyfallback →.venv/bin/python main.pyapp.pyfallback →.venv/bin/python app.pyrun.pyfallback →.venv/bin/python run.py
services/satellite/src/process/github-deployment.ts - resolvePythonPackageEntry()
Configuration
Security settings can be tuned via environment variables:Related Documentation
- Backend MCP Server Security - First-line validation
- Process Management - Process lifecycle
- Team Isolation - Multi-tenant security
- Architecture - Overall satellite design
- Security and Privacy - User-facing security documentation

