opencode-fs-plugin 3.6.0 → 3.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -10
- package/SPEC.md +7 -2
- package/package.json +1 -1
- package/skills/filesystem/SKILL.md +9 -3
- package/src/tools/command.ts +4 -4
package/README.md
CHANGED
|
@@ -164,16 +164,22 @@ T1** (user namespaces and TPROXY). Every run gets procage's transparent relay:
|
|
|
164
164
|
there is no direct route, and every TCP or UDP flow is named to the plugin as a
|
|
165
165
|
DNS QNAME, TLS SNI, HTTP `Host`, QUIC SNI, or an IP literal. Bare IPv6 literals
|
|
166
166
|
and bracketed IPv6 `Host` forms with an optional port are accepted as
|
|
167
|
-
resources. That exact resource must be approved through `
|
|
167
|
+
resources. That exact resource must be approved through `fs_command_network`; the
|
|
168
168
|
port, URL, headers, and payload are never part of the permission. There is no
|
|
169
|
-
separate network allowlist option
|
|
169
|
+
separate network allowlist option.
|
|
170
|
+
|
|
171
|
+
> **Migration from `fs_exec_network`:** replace every old rule with
|
|
172
|
+
> `fs_command_network` before upgrading. Old rules are ignored, and an unlisted
|
|
173
|
+
> `fs_command_network` resource can be allowed by the base rule unless another
|
|
174
|
+
> matching rule applies, so a previous `fs_exec_network` `deny *` no longer
|
|
175
|
+
> closes network egress.
|
|
170
176
|
|
|
171
177
|
```jsonc
|
|
172
178
|
{
|
|
173
179
|
"permissions": [
|
|
174
|
-
{ "action": "
|
|
175
|
-
{ "action": "
|
|
176
|
-
{ "action": "
|
|
180
|
+
{ "action": "fs_command_network", "resource": "*", "effect": "deny" },
|
|
181
|
+
{ "action": "fs_command_network", "resource": "registry.npmjs.org", "effect": "allow" },
|
|
182
|
+
{ "action": "fs_command_network", "resource": "pypi.org", "effect": "allow" }
|
|
177
183
|
]
|
|
178
184
|
}
|
|
179
185
|
```
|
|
@@ -202,7 +208,7 @@ External proxy settings are preserved: `HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY`,
|
|
|
202
208
|
`NO_PROXY`, their lowercase forms, and the npm proxy variables are passed to the
|
|
203
209
|
child explicitly, because they are not in the preset's environment allowlist.
|
|
204
210
|
The relay treats the proxy as the destination, never its `CONNECT` target, so
|
|
205
|
-
an external proxy works only when `
|
|
211
|
+
an external proxy works only when `fs_command_network` allows the proxy's address
|
|
206
212
|
(or its cached DNS name, which also needs its DNS query allowed). That approval
|
|
207
213
|
lets the proxy forward to whatever it reaches; it is not scoped to the target
|
|
208
214
|
URL behind the proxy. No other caller environment variable is forwarded
|
|
@@ -494,7 +500,7 @@ paths, absolute external boundaries, or network names/addresses. A specific
|
|
|
494
500
|
resource saves narrowly; an explicitly requested `*` remains `*`.
|
|
495
501
|
|
|
496
502
|
`fs.command` asserts `fs_command` with the executable name, asks
|
|
497
|
-
`external_directory` for any blocked path, and asks `
|
|
503
|
+
`external_directory` for any blocked path, and asks `fs_command_network` for the
|
|
498
504
|
exact DNS name or IP address the transparent relay named. There is no `*`
|
|
499
505
|
fallback and no direct-IP mode; networking that cannot use the relay is
|
|
500
506
|
disabled:
|
|
@@ -505,15 +511,15 @@ disabled:
|
|
|
505
511
|
{ "action": "fs_command", "resource": "*", "effect": "deny" },
|
|
506
512
|
{ "action": "fs_command", "resource": "npm", "effect": "allow" },
|
|
507
513
|
{ "action": "external_directory", "resource": "$HOME/.npm/**", "effect": "ask" },
|
|
508
|
-
{ "action": "
|
|
509
|
-
{ "action": "
|
|
514
|
+
{ "action": "fs_command_network", "resource": "*", "effect": "deny" },
|
|
515
|
+
{ "action": "fs_command_network", "resource": "registry.npmjs.org", "effect": "allow" }
|
|
510
516
|
]
|
|
511
517
|
}
|
|
512
518
|
```
|
|
513
519
|
|
|
514
520
|
Keep the rules explicit. Plugin actions match OpenCode's base
|
|
515
521
|
`{ "action": "*", "resource": "*", "effect": "allow" }` rule, so an unlisted
|
|
516
|
-
`fs_command`, `
|
|
522
|
+
`fs_command`, `fs_command_network`, or `external_directory` resource is allowed
|
|
517
523
|
without a prompt, not asked.
|
|
518
524
|
|
|
519
525
|
`fs.curl` reuses the built-in `webfetch` permission, with the requested
|
package/SPEC.md
CHANGED
|
@@ -159,9 +159,14 @@ Aliases are accepted only where noted: `path` for one `paths` element (`stat`,
|
|
|
159
159
|
- Every TCP/UDP flow is named as a DNS QNAME, TLS SNI, HTTP `Host`, QUIC SNI, or
|
|
160
160
|
IP literal. Bare IPv6 literals and bracketed IPv6 `Host` forms with an
|
|
161
161
|
optional port pass resource validation. That exact resource is asserted with
|
|
162
|
-
`
|
|
162
|
+
`fs_command_network`; the port, protocol, URL, headers, and payload never reach
|
|
163
163
|
the permission. The permission rules are the only network allowlist; there is
|
|
164
164
|
no plugin option for it.
|
|
165
|
+
- **Migration from `fs_exec_network`:** replace every old rule with
|
|
166
|
+
`fs_command_network` before upgrading. Old rules are ignored; an unlisted
|
|
167
|
+
`fs_command_network` resource can fall back to the base allow unless another
|
|
168
|
+
matching rule applies, so an old `fs_exec_network` `deny *` no longer closes
|
|
169
|
+
egress.
|
|
165
170
|
- DNS queries are decisions too. An allowed QNAME is forwarded to the parent
|
|
166
171
|
resolver; procage's discovery reads `/etc/resolv.conf` and systemd-resolved
|
|
167
172
|
paths, including a loopback stub, and the plugin leaves `relay_dns_upstream`
|
|
@@ -190,7 +195,7 @@ Aliases are accepted only where noted: `path` for one `paths` element (`stat`,
|
|
|
190
195
|
`NO_PROXY`, lowercase forms, and npm proxy variables) are passed explicitly
|
|
191
196
|
because they are not in the preset environment allowlist. The relay treats
|
|
192
197
|
the proxy as the destination, never its `CONNECT` target, so the proxy's
|
|
193
|
-
address or cached DNS name must be allowed in `
|
|
198
|
+
address or cached DNS name must be allowed in `fs_command_network`. No other
|
|
194
199
|
caller environment variable is forwarded explicitly; the preset's own
|
|
195
200
|
allowlist still applies, and a proxy variable may itself carry credentials.
|
|
196
201
|
- Denied paths ask `external_directory` on their containing directory (or the
|
package/package.json
CHANGED
|
@@ -168,12 +168,18 @@ With no rule the base allow applies to every executable.
|
|
|
168
168
|
The project is read/write/exec. **Network egress needs Linux tier T1** and uses
|
|
169
169
|
procage's transparent relay. There are no per-call grants. Every TCP/UDP flow is
|
|
170
170
|
named as a DNS QNAME, TLS SNI, HTTP `Host`, QUIC SNI, or IP literal, and that
|
|
171
|
-
exact resource is approved through `
|
|
171
|
+
exact resource is approved through `fs_command_network`; ports, URLs, and payloads
|
|
172
172
|
are never part of the permission. Bare IPv6 literals and bracketed IPv6 `Host`
|
|
173
173
|
forms with an optional port are valid resources. The permission rules are the
|
|
174
174
|
network allowlist: a `*` deny plus name/address allows fails closed for anything
|
|
175
175
|
else.
|
|
176
176
|
|
|
177
|
+
> **Migration from `fs_exec_network`:** replace every old rule with
|
|
178
|
+
> `fs_command_network` before upgrading. Old rules are ignored; an unlisted
|
|
179
|
+
> `fs_command_network` resource can fall back to the base allow unless another
|
|
180
|
+
> matching rule applies, so an old `fs_exec_network` `deny *` no longer closes
|
|
181
|
+
> egress.
|
|
182
|
+
|
|
177
183
|
DNS is authorized by QNAME. Allowed answers feed a per-run address-to-name
|
|
178
184
|
cache: a nameless flow is allowed by a fresh allowed name bound to its address,
|
|
179
185
|
else by the address. A named flow needs the exact `(name, address)` from an
|
|
@@ -193,7 +199,7 @@ await tools.fs.command({ command: "npm", args: ["install"], timeoutMs: 300000 })
|
|
|
193
199
|
Proxy variables (`HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY`, `NO_PROXY`, lowercase
|
|
194
200
|
forms, npm proxy settings) pass through explicitly. The relay treats the proxy
|
|
195
201
|
as the destination, never its `CONNECT` target, so allow the proxy's address or
|
|
196
|
-
cached DNS name in `
|
|
202
|
+
cached DNS name in `fs_command_network`; approving it lets the proxy reach whatever
|
|
197
203
|
it forwards. No other caller environment variable is forwarded explicitly, but
|
|
198
204
|
the preset's own allowlist still applies, and a proxy variable may itself carry
|
|
199
205
|
proxy credentials.
|
|
@@ -583,7 +589,7 @@ hidden inside a pipeline. Do not work around a denied tool with shell.
|
|
|
583
589
|
|
|
584
590
|
`fs.command` asserts `fs_command` with the executable name as its resource;
|
|
585
591
|
deny `*` for a closed set. It asks `external_directory` for a blocked path and
|
|
586
|
-
`
|
|
592
|
+
`fs_command_network` with the exact DNS name or IP address named by the relay.
|
|
587
593
|
There is no `*` fallback and no direct-IP mode; networking that cannot use the
|
|
588
594
|
relay is disabled. There are no per-call grants and no shell.
|
|
589
595
|
|
package/src/tools/command.ts
CHANGED
|
@@ -101,7 +101,7 @@ class RelayUnsupportedError extends Error {
|
|
|
101
101
|
/** Why a blocked run failed, and what to do about it. */
|
|
102
102
|
export function blockedHint(mode: NetworkMode): string {
|
|
103
103
|
return mode === "relay"
|
|
104
|
-
? "The sandbox denied a path or refused a network flow. Approve the denied path, or the refused resource in
|
|
104
|
+
? "The sandbox denied a path or refused a network flow. Approve the denied path, or the refused resource in fs_command_network, and retry."
|
|
105
105
|
: "Networking is disabled in this sandbox. Approve the denied external path in the permission prompt and retry; relayed networking needs Linux tier T1.";
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -129,7 +129,7 @@ export const commandTool: ToolSpec<Input> = {
|
|
|
129
129
|
description:
|
|
130
130
|
"Run an executable allowed by fs_command in a procage sandbox without a shell. Direct calls return JSON; " +
|
|
131
131
|
"pipe stages pass raw stdout. On Linux tier T1 every network flow is named to the transparent relay, " +
|
|
132
|
-
"which asks
|
|
132
|
+
"which asks fs_command_network for its exact resource; elsewhere networking is disabled.",
|
|
133
133
|
schema: Schema,
|
|
134
134
|
pipeable: "filter",
|
|
135
135
|
mutates: true,
|
|
@@ -163,7 +163,7 @@ export const commandTool: ToolSpec<Input> = {
|
|
|
163
163
|
const approvedResources: string[] = [];
|
|
164
164
|
const approved: Array<{ full: string }> = [];
|
|
165
165
|
const assertNetwork = async (resource: string) => {
|
|
166
|
-
await ctx.permissionFor("
|
|
166
|
+
await ctx.permissionFor("fs_command_network").assertTrusted([resource]);
|
|
167
167
|
if (!approvedResources.includes(resource)) approvedResources.push(resource);
|
|
168
168
|
};
|
|
169
169
|
const base = {
|
|
@@ -368,7 +368,7 @@ async function runCaged(ctx: RunContext, input: CagedInput): Promise<ExecOutcome
|
|
|
368
368
|
// preset's secret filtering. The transparent relay treats a connection to the
|
|
369
369
|
// proxy as the proxy's own destination (never its CONNECT target), so the
|
|
370
370
|
// proxy's address, or its cached DNS name, is authorized through
|
|
371
|
-
//
|
|
371
|
+
// fs_command_network; the target URL behind the proxy is never treated as
|
|
372
372
|
// approved.
|
|
373
373
|
const env: Record<string, string> = { TMPDIR: input.tempDir };
|
|
374
374
|
for (const name of EXEC_PROXY_ENV) {
|