Sandboxed vulnerability validation
Eliminate false-positive security alerts by reproducing candidate vulnerabilities deterministically inside ephemeral /v1/sandbox leases and scoring severity with Kai.
Static analyzers drown engineering teams in unverified alerts. The cure is empirical reproduction: never page an engineer or open a remediation PR until a minimal test fails deterministically inside an isolated /v1/sandbox microVM.
Sandboxed validation workflow
- Lease an isolated environment (
POST /v1/sandbox/lease) matching the target runtime image with no production credentials mounted. - Stage the target commit and minimal reproducer (
POST /v1/sandbox/{id}/fsor repo checkout inside the sandbox). - Run the reproducer (
POST /v1/sandbox/{id}/exec) and capture exact exit code, stdout/stderr, and sanitizer traces. - Classify impact with Kai (
POST /v1/decisions):exploitable(noul),severity(score:low,medium,high,critical), andowner_team(choice). - Tear down immediately (
POST /v1/sandbox/stoporDELETE /v1/sandbox/{id}).
Validate a finding across all four surfaces
CLI
SDK
HTTP
MCP
# 1. Lease an isolated sandbox
SANDBOX_ID=$(hanzo sandbox lease --data '{"image":"alpine:3.20","ttl_seconds":300}' | jq -r '.id')
# 2. Execute minimal vulnerability proof-of-reproduction test
hanzo sandbox exec "$SANDBOX_ID" --data '{"cmd":["sh","-c","pytest tests/security/test_auth_bypass.py"]}'
# 3. Always release sandbox when done
hanzo sandbox stop --data "{\"id\":\"${SANDBOX_ID}\"}"TypeScript
Python
import { Configuration, SandboxApi } from 'hanzoai';
const sb = new SandboxApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data: lease } = await sb.postSandboxLease({ image: 'alpine:3.20', ttl_seconds: 300 });
try {
const { data: exec } = await sb.postSandboxByIdExec(lease.id, {
cmd: ['sh', '-c', 'pytest tests/security/test_auth_bypass.py'],
});
console.log(exec);
} finally {
await sb.postSandboxStop({ id: lease.id });
}import os
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import SandboxApi
api = SandboxApi(ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"])))
lease = api.post_sandbox_lease({"image": "alpine:3.20", "ttl_seconds": 300})
try:
result = api.post_sandbox_by_id_exec(
lease["id"], {"cmd": ["sh", "-c", "pytest tests/security/test_auth_bypass.py"]}
)
print(result)
finally:
api.post_sandbox_stop({"id": lease["id"]})SANDBOX_ID=$(curl -s -X POST https://api.hanzo.ai/v1/sandbox/lease \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"image":"alpine:3.20","ttl_seconds":300}' | jq -r '.id')
curl -s -X POST "https://api.hanzo.ai/v1/sandbox/${SANDBOX_ID}/exec" \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"cmd":["sh","-c","pytest tests/security/test_auth_bypass.py"]}' | jq '.'
curl -s -X POST https://api.hanzo.ai/v1/sandbox/stop \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"id\":\"${SANDBOX_ID}\"}"curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "sandbox",
"arguments": {"op": "get_sandbox_quota", "input": {}}
}
}'Authorization rule
Only validate vulnerabilities against repositories, staging environments, and assets you own or hold explicit written authorization to test. Sandbox leases inherit your org's network egress policy and audit logging (GET /v1/audit).
Related courses & docs
Was this page useful?
Broken link or missing step? Drop it in #docs on Discord or open a PR.