Model Output Validation Sandbox
Security Recommendation
A model response evaluation sandbox MAY be deployed to validate model outputs by performing checks that carry higher risk and must be done in isolation. This is especially relevant when model outputs are executed or trigger actions.
Use Cases
| Scenario | What the Sandbox Does |
|---|---|
| Generated source code | Executes the code in isolation to validate it is safe and correct |
| Generated API calls | Validates the target endpoint and parameters are safe before executing |
| Generated commands | Tests OS commands in a contained environment before execution |
| Generated configurations | Validates configurations won't introduce security misconfigurations |
Critical Requirement: True Isolation
The sandbox MUST be truly isolated so that it does not represent a risk for the system. A compromised sandbox must not be able to:
- Access production data or services
- Modify the host system
- Communicate with external networks (unless explicitly required for validation)
- Escalate privileges beyond the sandbox boundary
Isolation Mechanisms
| Mechanism | Description |
|---|---|
| Containers (rootless, read-only) | Lightweight isolation with limited capabilities |
| MicroVMs (Firecracker, gVisor) | Stronger isolation with hardware-level boundaries |
| seccomp + namespaces | Restrict syscalls and isolate PID/network/mount/user |
| Network isolation | No network access or allowlist-only egress |
| Resource limits | CPU, memory, disk, and time limits to prevent resource exhaustion |
Implementation Checklist
- [ ] Evaluate whether model outputs in your system require sandbox validation
- [ ] Deploy sandbox infrastructure with true isolation (containers, microVMs, or equivalent)
- [ ] Enforce no network access from the sandbox by default
- [ ] Set strict resource limits (CPU, memory, time) on sandbox executions
- [ ] Define validation criteria for each output type (code, API calls, commands)
- [ ] Return validation results to the caller without exposing sandbox internals
- [ ] Log all sandbox executions and their results for audit
- [ ] Monitor sandbox health and detect escape attempts