Skip to content

Commit d162d9b

Browse files
Yoseph-ZuskinOpenCode Muse Spark 1.3 Free (1M context)
andauthored
feat(providers): verify OpenCode 1.18.31 for the deny-all policy (#575)
* feat(providers): verify OpenCode 1.18.31 for the deny-all policy - Bump _OPENCODE_SUPPORTED_VERSION 1.18.30 → 1.18.31 plus all version references (code comments, test fixtures, README pin note, DEVELOPMENT); run --help flags identical across the bump, no policy changes - Fix test_probe_rejects_unverified_version to use 1.18.99 as its rejection case (it had hardcoded the new pinned version) - Verified: provider suites 128 passed; ruff + format clean; live self-scan on 1.18.31 via Zen free tier (opencode/mimo-v2.5-free): llm_available true, 3/3 calls succeeded, 0 semantic findings Signed-off-by: Yoseph Zuskin <[email protected]> Co-Authored-By: OpenCode Muse Spark 1.3 Free (1M context) <[email protected]> * test(providers): use a version outside both pins in deny-all test - test_unverified_runtime_version_fails_before_inference faked 1.18.31 as its rejection case, which stopped failing once the pin bumped to it (CI: DID NOT RAISE); fake 1.18.99 instead, wrong under both pins Signed-off-by: Yoseph Zuskin <[email protected]> Co-Authored-By: OpenCode Muse Spark 1.3 Free (1M context) <[email protected]> --------- Signed-off-by: Yoseph Zuskin <[email protected]> Co-authored-by: OpenCode Muse Spark 1.3 Free (1M context) <[email protected]>
1 parent a2100fe commit d162d9b

4 files changed

Lines changed: 13 additions & 13 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ inference gateways.
242242
| `claude_cli` | _(none — uses local CLI auth)_ | local `claude` binary | local Claude runtime fallback, or `SKILLSPECTOR_MODEL` |
243243
| `codex_cli` | _(none — uses local CLI auth)_ | local `codex` binary | local Codex runtime fallback, or `SKILLSPECTOR_MODEL` |
244244
| `gemini_cli` | _(none — uses local CLI auth)_ | local `gemini` binary | local Gemini runtime fallback, or `SKILLSPECTOR_MODEL` |
245-
| `opencode_cli` | _(none — uses local CLI auth)_ | local `opencode` 1.18.30 binary | local OpenCode runtime fallback, or `SKILLSPECTOR_MODEL` |
245+
| `opencode_cli` | _(none — uses local CLI auth)_ | local `opencode` 1.18.31 binary | local OpenCode runtime fallback, or `SKILLSPECTOR_MODEL` |
246246

247247
```bash
248248
# Stock OpenAI
@@ -633,7 +633,7 @@ Issues (2)
633633

634634
> **CLI providers** (`claude_cli`, `codex_cli`, `gemini_cli`, `opencode_cli`): No API key is needed. Authentication is managed entirely by the agent CLI's own login session. SkillSpector never reads or forwards API keys when these providers are active. The subprocess is run with capabilities restricted, and untrusted skill content is delivered only via stdin.
635635
>
636-
> `opencode_cli` currently fails closed unless the installed OpenCode version is exactly `1.18.30`, the version whose configuration precedence and deny-all semantics are verified by this release.
636+
> `opencode_cli` currently fails closed unless the installed OpenCode version is exactly `1.18.31`, the version whose configuration precedence and deny-all semantics are verified by this release.
637637
638638
### CLI Options
639639

‎docs/DEVELOPMENT.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ Base URL env vars are not needed for live provider tests; the tests intentionall
345345
- `claude_cli/` — **local `claude` binary; no API key**. Uses the CLI's own auth session (`claude auth login`). Set `SKILLSPECTOR_PROVIDER=claude_cli`.
346346
- `codex_cli/` — **local `codex` binary; no API key**. Uses the CLI's own auth session (`codex login`). Set `SKILLSPECTOR_PROVIDER=codex_cli`.
347347
- `gemini_cli/` — **local `gemini` binary; no API key**. Uses the CLI's own auth session. Set `SKILLSPECTOR_PROVIDER=gemini_cli`.
348-
- `opencode_cli/` — **local `opencode` 1.18.30 binary; no API key**. Uses the CLI's own auth session (`opencode auth login`) and fails closed on every other runtime version because the deny-all policy is verified against that exact release. Set `SKILLSPECTOR_PROVIDER=opencode_cli`.
348+
- `opencode_cli/` — **local `opencode` 1.18.31 binary; no API key**. Uses the CLI's own auth session (`opencode auth login`) and fails closed on every other runtime version because the deny-all policy is verified against that exact release. Set `SKILLSPECTOR_PROVIDER=opencode_cli`.
349349

350350
CLI providers (`claude_cli`, `codex_cli`, `gemini_cli`, `opencode_cli`) implement the optional `AgentCLICapable` interface (`is_available()` + `complete()`) defined in [providers/base.py](../src/skillspector/providers/base.py). `has_cli_capability(provider)` detects this at runtime. All subprocess calls go through the hardened helper [providers/_agent_cli.py](../src/skillspector/providers/_agent_cli.py) which enforces: no shell (`shell=False`), untrusted content via stdin only, capability stripping (tools disabled / sandboxed), environment scrubbing (no API keys forwarded), per-call timeout, and fail-closed error handling.
351351

‎src/skillspector/providers/_agent_cli.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -454,13 +454,13 @@ def _parse_gemini_output(raw: str) -> str:
454454

455455

456456
# ---------------------------------------------------------------------------
457-
# OpenCode CLI invocation (verified against opencode 1.18.30)
457+
# OpenCode CLI invocation (verified against opencode 1.18.31)
458458
# ---------------------------------------------------------------------------
459459

460460

461461
_OPENCODE_AGENT_PREFIX = "skillspector-deny-all"
462462
_OPENCODE_DENY_ALL = json.dumps({"*": "deny"}, separators=(",", ":"))
463-
_OPENCODE_SUPPORTED_VERSION = "1.18.30"
463+
_OPENCODE_SUPPORTED_VERSION = "1.18.31"
464464

465465

466466
def _opencode_agent_name(argv: list[str]) -> str:
@@ -578,7 +578,7 @@ def _prepare_opencode_env(
578578
"OPENCODE_EXPERIMENTAL_PLAN_MODE": "0",
579579
"OPENCODE_PERMISSION": _OPENCODE_DENY_ALL,
580580
"OPENCODE_PURE": "1",
581-
# OpenCode 1.18.30 uses this internal override for the home paths
581+
# OpenCode 1.18.31 uses this internal override for the home paths
582582
# searched for AGENTS.md, .opencode, .claude, and .agents content.
583583
"OPENCODE_TEST_HOME": isolated_home,
584584
# The same pinned version uses this override instead of the
@@ -601,7 +601,7 @@ def _preflight_opencode_policy(
601601
"""Fail closed unless OpenCode's fully resolved sensitive config is exact.
602602
603603
macOS MDM preferences are loaded after ``OPENCODE_CONFIG_CONTENT`` and do
604-
not have a supported disable flag in OpenCode 1.18.30. Querying the final
604+
not have a supported disable flag in OpenCode 1.18.31. Querying the final
605605
config with the exact environment and directory prevents a managed
606606
``share: auto`` (or another late source) from silently reopening ambient
607607
capabilities before the inference process is allowed to start.
@@ -674,7 +674,7 @@ def run_probe(command: list[str], label: str) -> bytes:
674674
def _build_opencode_argv(binary: str, model: str, max_output_tokens: int = 0) -> list[str]:
675675
"""Build argv for a text-only, deny-all ``opencode run`` call.
676676
677-
Flags chosen (verified against ``opencode`` 1.18.30 ``run --help``):
677+
Flags chosen (verified against ``opencode`` 1.18.31 ``run --help``):
678678
679679
``run``
680680
Non-interactive single-shot mode. With no positional message, the
@@ -728,7 +728,7 @@ def _build_opencode_argv(binary: str, model: str, max_output_tokens: int = 0) ->
728728
def _parse_opencode_output(raw: str) -> str:
729729
"""Extract assistant text from ``opencode run --format json`` JSONL events.
730730
731-
Verified against opencode 1.18.30, whose events look like::
731+
Verified against opencode 1.18.31, whose events look like::
732732
733733
{"type": "step_start", ..., "part": {"type": "step-start", ...}}
734734
{"type": "text", ..., "part": {"type": "text", "text": "hi", ...}}

‎tests/provider/test_opencode_cli.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def test_probe_nonzero_exit_is_fail_closed(self, mock_run: MagicMock) -> None:
258258

259259
@patch("skillspector.providers._agent_cli.subprocess.run")
260260
def test_probe_rejects_unverified_version(self, mock_run: MagicMock) -> None:
261-
mock_run.return_value = _ok_result(b"1.18.31\n")
261+
mock_run.return_value = _ok_result(b"1.18.99\n")
262262
ok, reason = _opencode_auth_check(OPENCODE_BINARY)
263263
assert ok is False
264264
assert _OPENCODE_SUPPORTED_VERSION in (reason or "")
@@ -430,7 +430,7 @@ def test_unverified_runtime_version_fails_before_inference(
430430
markers.mkdir()
431431
self._write_fake_opencode(binary)
432432
monkeypatch.setenv("ATTACK_MARKERS", str(markers))
433-
monkeypatch.setenv("FAKE_OPENCODE_VERSION", "1.18.31")
433+
monkeypatch.setenv("FAKE_OPENCODE_VERSION", "1.18.99")
434434
monkeypatch.setattr(_agent_cli, "find_binary", lambda _name: str(binary))
435435

436436
with pytest.raises(AgentCLIError, match=f"only for version {_OPENCODE_SUPPORTED_VERSION}"):
@@ -443,7 +443,7 @@ def test_unverified_runtime_version_fails_before_inference(
443443
# ---------------------------------------------------------------------------
444444

445445

446-
# Real opencode 1.18.30 envelope shapes (Step-0 probe:
446+
# Real opencode 1.18.31 envelope shapes (Step-0 probe:
447447
# `opencode run "say hi" --format json` in an empty dir; verbatim raw saved
448448
# to Temp scratch only). Top-level `type` is one of step_start / text /
449449
# step_finish; the reply text lives at part.text of `text` events.
@@ -484,7 +484,7 @@ def test_concatenates_multiple_text_events_in_order(self) -> None:
484484

485485
def test_skips_non_json_noise_lines(self) -> None:
486486
# Banner/TUI noise must never leak into the extracted output.
487-
raw = f"opencode v1.18.30\n{_TEXT_EVENT}\nattaching session...\n"
487+
raw = f"opencode v1.18.31\n{_TEXT_EVENT}\nattaching session...\n"
488488
assert _parse_opencode_output(raw) == "hi"
489489

490490
def test_empty_stdout_raises(self) -> None:

0 commit comments

Comments
 (0)