opencode-any-sandbox 0.1.0 → 0.1.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 +4 -1
- package/dist/index.js +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,7 +36,8 @@ Then install the engine: `npm i -g @carlostapiacl/tartaros` (the default) or `np
|
|
|
36
36
|
- It writes to the project and to a private `$TMPDIR`, and nowhere else.
|
|
37
37
|
- It cannot touch `.opencode`, `.claude`, `.agents`, `.codex`, `opencode.json(c)`, `.git/hooks` or `.git/config`, so it
|
|
38
38
|
cannot plant a skill, a plugin or a git hook that runs later outside the sandbox. The `write`, `edit` and `patch`
|
|
39
|
-
tools are denied the same
|
|
39
|
+
tools are denied the same names in any subdirectory of the project, also through a symlink or another letter case,
|
|
40
|
+
and `cd` cannot enter them.
|
|
40
41
|
- It cannot read `~/.ssh`, `~/.aws`, `~/.gnupg`, `~/.kube`, `~/.config/gh`, `~/.netrc`, `~/.npmrc` or OpenCode's own
|
|
41
42
|
data.
|
|
42
43
|
- It has no network, unless you list domains.
|
|
@@ -95,6 +96,8 @@ Windows is next. Today commands are blocked there.
|
|
|
95
96
|
|
|
96
97
|
- Only the shell tool is confined. MCP servers, formatters, LSPs and your own terminal run as before.
|
|
97
98
|
- A plugin that rewrites the same shell invocation after this one could undo it.
|
|
99
|
+
- The sandbox gets fixed paths, so for the shell those names are read-only at the project root, not in subdirectories.
|
|
100
|
+
OpenCode loads a subdirectory's `.opencode` only for a session whose directory is that one or below it.
|
|
98
101
|
- OpenCode's experimental remote machines are not supported yet.
|
|
99
102
|
|
|
100
103
|
## How it works
|
package/dist/index.js
CHANGED
|
@@ -280,12 +280,15 @@ export const plugin = {
|
|
|
280
280
|
return list;
|
|
281
281
|
};
|
|
282
282
|
// Both the path as written and where it really lands (a symlink inside the project can point at a protected place).
|
|
283
|
+
// OpenCode also loads `.opencode` and `opencode.json` from subdirectories, so inside the project a protected name
|
|
284
|
+
// counts at any depth, for the path as written and for where it really lands.
|
|
285
|
+
const nestedName = (value) => contains(project, value) && touchesProtectedName(path.relative(fold(project), fold(value)));
|
|
283
286
|
const isGuarded = async (value) => {
|
|
284
287
|
const guarded = await guardedNow();
|
|
285
|
-
if (guarded.some((root) => contains(root, value)))
|
|
288
|
+
if (guarded.some((root) => contains(root, value)) || nestedName(value))
|
|
286
289
|
return true;
|
|
287
290
|
const real = await realTarget(value);
|
|
288
|
-
return guarded.some((root) => contains(root, real));
|
|
291
|
+
return guarded.some((root) => contains(root, real)) || nestedName(real);
|
|
289
292
|
};
|
|
290
293
|
// OpenCode resolves relative paths against the session's working directory, which the `cd` tool can move. Track it,
|
|
291
294
|
// and refuse to move it into a protected place.
|
package/package.json
CHANGED