OpenCode v2.2 starts a background service on 127.0.0.1:49374, which nono blocks unless a localhost port is granted. Give the sandbox its own service on 49376 with isolated config/state, and clean up its lifecycle. - Grant localhost ports 49376 (sandboxed service) and 3301 (Tinfoil proxy) - Add sandbox config/state dirs and XDG_STATE_HOME/OPENCODE_CONFIG_DIR - Wrapper mirrors real config, pins the sandbox service port, and stops stale/orphaned services so they never outlive the nono proxy - Remove deprecated commands.allow/deny and the redundant SSH key glob deny - Update installer, uninstall cleanup, and README
135 lines
3.2 KiB
JSON
135 lines
3.2 KiB
JSON
{
|
|
"meta": {
|
|
"name": "opencode-tinfoil",
|
|
"description": "OpenCode sandbox with Tinfoil enclave and LLM API access"
|
|
},
|
|
"groups": {
|
|
"include": ["deny_credentials"]
|
|
},
|
|
"workdir": {
|
|
"access": "readwrite"
|
|
},
|
|
"filesystem": {
|
|
"allow": [
|
|
"."
|
|
],
|
|
"read": [
|
|
"$HOME/.config/opencode",
|
|
"$HOME/.config/opencode-sandbox",
|
|
"$HOME/.local/share/opencode",
|
|
"$HOME/.local/state/opencode-sandbox",
|
|
"$HOME/.cache/opencode",
|
|
"$HOME/.opencode",
|
|
"$HOME/.claude",
|
|
"$HOME/.gitconfig",
|
|
"$HOME/.ssh/config",
|
|
"$HOME/.tinfoil",
|
|
"/etc/ssl",
|
|
"/etc/pki",
|
|
"/usr/share/ca-certificates",
|
|
"/usr/local/share/ca-certificates",
|
|
"/tmp"
|
|
],
|
|
"write": [
|
|
"$HOME/.config/opencode",
|
|
"$HOME/.config/opencode-sandbox",
|
|
"$HOME/.local/share/opencode",
|
|
"$HOME/.local/state/opencode-sandbox",
|
|
"$HOME/.cache/opencode",
|
|
"$HOME/.opencode",
|
|
"$HOME/.claude",
|
|
"/tmp"
|
|
],
|
|
"deny": [
|
|
"$HOME/.gnupg",
|
|
"$HOME/.aws",
|
|
"$HOME/.azure",
|
|
"$HOME/.gcp",
|
|
"$HOME/.kube",
|
|
"$HOME/.docker/config.json",
|
|
"$HOME/.netrc",
|
|
"$HOME/.npmrc",
|
|
"/etc/shadow",
|
|
"/etc/passwd",
|
|
"/etc/hosts"
|
|
]
|
|
},
|
|
"network": {
|
|
"block": false,
|
|
"open_port": [
|
|
49376, // OpenCode background service, kept separate from the host service on 49374
|
|
3301 // Tinfoil local proxy http://127.0.0.1:3301/v1
|
|
],
|
|
"allow_domain": [
|
|
"api.openai.com",
|
|
"api.anthropic.com",
|
|
"api.groq.com",
|
|
"api.together.xyz",
|
|
"api.openrouter.com",
|
|
"generativelanguage.googleapis.com",
|
|
"api.mistral.ai",
|
|
"api.cohere.com",
|
|
"api.x.ai",
|
|
"api.deepseek.com",
|
|
"api.perplexity.ai",
|
|
"api.gemini.google.com",
|
|
"api.fireworks.ai",
|
|
"api.replicate.com",
|
|
"api.ollama.local",
|
|
"llm.api.cloudflare.com",
|
|
"api.scaleway.ai",
|
|
"api.alibabacloud.com",
|
|
"api.moonshot.cn",
|
|
"api.minimaxi.com",
|
|
"api.stepfun.com",
|
|
"api.01.ai",
|
|
"inference.tinfoil.sh",
|
|
"*.tinfoil.sh",
|
|
"api.tinfoil.sh",
|
|
"containers.tinfoil.sh",
|
|
"127.0.0.1", // Tinfoil local proxy http://127.0.0.1:3301/v1
|
|
// Other providers:
|
|
// "api.anthropic.com",
|
|
// "api.chatglm.org",
|
|
// "api.moonshot.cn",
|
|
// "api.openrouter.com",
|
|
// "api.together.xyz",
|
|
// "api.mistral.ai",
|
|
"ghcr.io",
|
|
"registry.npmjs.org",
|
|
"npmjs.org",
|
|
"github.com",
|
|
"raw.githubusercontent.com",
|
|
"objects.githubusercontent.com",
|
|
"huggingface.co",
|
|
"cdn.jsdelivr.net",
|
|
"unpkg.com",
|
|
"esm.sh",
|
|
"deno.land",
|
|
"crates.io",
|
|
"index.crates.io",
|
|
"static.crates.io",
|
|
"proxy.golang.org",
|
|
"sum.golang.org",
|
|
"pypi.org",
|
|
"files.pythonhosted.org",
|
|
"download.pytorch.org"
|
|
]
|
|
},
|
|
"environment": {
|
|
"set_vars": {
|
|
"XDG_STATE_HOME": "$HOME/.local/state/opencode-sandbox",
|
|
"OPENCODE_CONFIG_DIR": "$HOME/.config/opencode-sandbox/opencode",
|
|
"TINFOIL_CONFIG_DIR": "$HOME/.tinfoil"
|
|
},
|
|
"deny_vars": [
|
|
"AWS_*",
|
|
"GOOGLE_*",
|
|
"AZURE_*",
|
|
"GCP_*",
|
|
"KUBECONFIG",
|
|
"SSH_AUTH_SOCK"
|
|
]
|
|
}
|
|
}
|