@soleur/opencode 3.378.11 → 3.378.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soleur/opencode",
3
- "version": "3.378.11",
3
+ "version": "3.378.12",
4
4
  "description": "Soleur AI organization plugin for OpenCode",
5
5
  "type": "module",
6
6
  "bin": {
@@ -37,7 +37,9 @@
37
37
  import { execFileSync, spawn, spawnSync } from "child_process";
38
38
  import { randomBytes } from "crypto";
39
39
  import {
40
+ accessSync,
40
41
  closeSync,
42
+ constants,
41
43
  existsSync,
42
44
  mkdirSync,
43
45
  mkdtempSync,
@@ -46,6 +48,7 @@ import {
46
48
  readdirSync,
47
49
  realpathSync,
48
50
  rmSync,
51
+ statSync,
49
52
  writeFileSync,
50
53
  } from "fs";
51
54
  import { tmpdir } from "os";
@@ -600,16 +603,33 @@ export const SKILL_SETTLE_TIMEOUT_MS = 120_000;
600
603
  * `opencode` on PATH is almost always a version-manager shim, and a shim resolves its
601
604
  * install through `$HOME` — which this arm redirects for hermeticity, and which makes the
602
605
  * shim try to REINSTALL (measured: the run hangs, then dies with `Disk quota exceeded`).
603
- * `readlink -f` follows the shim chain to the real launcher, which needs no HOME at all.
606
+ * `realpathSync` follows the shim chain to the real launcher, which needs no HOME at all.
607
+ *
608
+ * The walk is pure Node, not `bash -c 'command -v …; readlink -f …'`: the inline-script
609
+ * form made `run()`'s shared `execFileSync` an indirect shell execution, so every
610
+ * absolute-path argv element at every `run()` call site was a CodeQL sink
611
+ * (js/shell-command-injection-from-environment, alert 279). `command -v` semantics that
612
+ * matter are kept — the entry must be a regular executable file, the first PATH hit
613
+ * wins, absent → `undefined`. Empty PATH entries are SKIPPED rather than resolved
614
+ * CWD-relative: a `.` hit is never the installed launcher this function exists to find.
604
615
  */
605
616
  export function resolveBin(bin: string): string | undefined {
606
- const r = run(
607
- "bash",
608
- ["-c", 'p=$(command -v "$1") || exit 1; r=$(readlink -f "$p" 2>/dev/null) || r="$p"; [ -n "$r" ] || r="$p"; printf "%s" "$r"', "bash", bin],
609
- { PATH: process.env.PATH ?? "" },
610
- );
611
- const out = r.out.trim();
612
- return r.ok && out !== "" ? out : undefined;
617
+ for (const dir of (process.env.PATH ?? "").split(":")) {
618
+ if (dir === "") continue;
619
+ const candidate = join(dir, bin);
620
+ try {
621
+ if (!statSync(candidate).isFile()) continue;
622
+ accessSync(candidate, constants.X_OK);
623
+ } catch {
624
+ continue;
625
+ }
626
+ try {
627
+ return realpathSync(candidate);
628
+ } catch {
629
+ return candidate;
630
+ }
631
+ }
632
+ return undefined;
613
633
  }
614
634
 
615
635
  /**