Skip to content

Commit b0480a6

Browse files
authored
feat(core): make portable shell scanner authoritative (#42581)
1 parent bdbccca commit b0480a6

22 files changed

Lines changed: 2122 additions & 2 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@opencode-ai/core": minor
3+
"@opencode-ai/schema": minor
4+
"@opencode-ai/protocol": minor
5+
"@opencode-ai/client": minor
6+
---
7+
8+
Add an opt-in portable shell permission scanner. Opaque commands use normal shell authorization without inferring
9+
external directories, while the default tree-sitter path remains unchanged.

‎bun.lock‎

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/client/src/promise/generated/types.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,6 +1835,7 @@ export type ConfigEntry =
18351835
}
18361836
}
18371837
experimental?: {
1838+
portable_shell_scanner?: boolean
18381839
subagent_depth?: number
18391840
policies?: Array<{ action: "provider.use"; resource: string; effect: "allow" | "deny" }>
18401841
}

‎packages/core/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"@types/bun": "catalog:",
8181
"@types/node": "catalog:",
8282
"@types/which": "3.0.4",
83+
"@opencode-ai/shell-scan": "workspace:*",
8384
"@parcel/watcher-darwin-arm64": "2.5.1",
8485
"@parcel/watcher-darwin-x64": "2.5.1",
8586
"@parcel/watcher-linux-arm64-glibc": "2.5.1",

‎packages/core/script/build.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ const result = await Bun.build({
2020
format: "esm",
2121
packages: "external",
2222
external: ["#sqlite", "#pty", "#fff", "#photon-wasm", "#shell-parser-wasm", "#process-lock-ffi", "#v1-migration"],
23+
plugins: [
24+
{
25+
name: "bundle-shell-scan",
26+
setup(build) {
27+
build.onResolve({ filter: /^@opencode-ai\/shell-scan$/ }, () => ({
28+
path: path.resolve("../shell-scan/src/index.ts"),
29+
}))
30+
},
31+
},
32+
],
2333
splitting: true,
2434
loader: {
2535
".txt": "text",

‎packages/core/src/config/normalize.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,15 @@ function normalizeExperimental(
401401
unsupportedExperimental.forEach((key) =>
402402
unsupportedIfPresent(experimental, key, ["experimental", key], diagnostics),
403403
)
404+
if (own(experimental, "portable_shell_scanner")) {
405+
const value = decodeEncoded(
406+
ConfigExperimental.Info.fields.portable_shell_scanner,
407+
experimental.portable_shell_scanner,
408+
["experimental", "portable_shell_scanner"],
409+
diagnostics,
410+
)
411+
if (value !== undefined) result.portable_shell_scanner = value
412+
}
404413
if (own(experimental, "subagent_depth")) {
405414
const value = decodeEncoded(
406415
ConfigExperimental.Info.fields.subagent_depth,

0 commit comments

Comments
 (0)