You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 83fb214
Browse filesBrowse the repository at this point in the historyBrowse files
## Objective
Resolve the false-negative native CLI smoke caused by OpenCode 1.19.3's
free-tier incompatibility with `read: deny`, without granting
uncontrolled filesystem or credential access.
Confirmed with the real pinned runtime (same model/prompt, isolated
`HOME`/XDG, empty workdir):
- `read: allow` → control: canary read executes, model returns `OK`
- `read: ask` → headless: `tool_use(read,error)`,
`step_finish(reason=tool-calls)`, exit 0, ~4 s, canary never leaves the
sandbox
- `read: deny` → changes the outbound envelope; gateway answers pre-auth
HTTP 403
Live gateway with a synthetic non-credential key (same CLI and config
surface): `ask` → 401, `allow` → 401, `deny` → 403. The failed run
[39972207857](https://github.com/AhmedMahmoud2222/DCIM/actions/runs/39972207857)
shows `provider_error` / `forbidden` / 403 for exactly that reason.
Upstream: <anomalyco/opencode#50627>
## Change (diagnostic-only, one branch/PR)
1. **`read: 'ask'`** in `.github/scripts/opencode_native_smoke.py`;
every other tool of 1.19.3 stays `deny` (`edit`, `bash`, `webfetch`,
`external_directory`, `task`, `todowrite`). The transcript guard rejects
**any** `tool_use` event (completed or error), and a `tool-calls`
termination is not accepted. The CLI is always started with
`stdin=subprocess.DEVNULL`, so headless `ask` cannot block.
2. **Credential-free compatibility preflight**: new `--preflight` mode
sends the identical fixed envelope with a fixed synthetic placeholder.
It passes only when the gateway reaches authentication (HTTP 401) and
fails closed with `reason=config_envelope_rejected` on a policy
rejection (403). The preflight **never reads `OPENCODE_API_KEY`**; the
workflow maps the secret only in the following step, after the preflight
passes. Both sanitized artifacts are uploaded with `if: always()`.
3. **Artifact**: closed field list gains `mode` (`preflight`/`live`). A
passing probe records `status=ok`,
`reason=credential_rejected_as_expected`, `error_class=auth_error`,
`error_status_code=401`.
4. **`docs/diagnostics/opencode-free-tier-compatibility.md`**: 403
false-negative evidence, headless `ask` results, reconciliation with the
production read policy, the outdated `/zen/v1` catalog fallback and
model-proxy compatibility risks, and the recommended controlled next
experiment. No production code, registry/health flags, proxy, sandbox,
publisher or branch protection is touched.
## Security evidence
- **Headless `ask` is not auto-approved**: with a scripted read request
and a canary file, the read ends in `error` and the canary content never
appears in any recorded request. Same with an open idle stdin pipe.
Control `allow` *does* leak the canary, proving the detector.
- **No hang**: both stdin modes finish in ~4 s; the runner adds
`DEVNULL`, a bounded timeout and `timed_out` classification.
- **Envelope regression guard**: preflight passes only on 401
(`auth_error`); 403 becomes `config_envelope_rejected` before the secret
step. Statically tested that the preflight step has no `secrets.`
reference and that `resolve_key('preflight', …)` ignores an environment
key.
- **Isolation unchanged**: empty workdir, dedicated `HOME`/XDG trees
under `RUNNER_TEMP`, no repository source in model context, `contents:
read` only, no publish permissions, fixed model and prompt, no untrusted
input, sanitized closed artifact.
## Production reconciliation
Production (`opencode_sandbox.py agent_config()`) uses `read: {'*':
'allow', '*.env': 'deny', '*.env.*': 'deny', '*.env.example': 'allow'}`
inside a sanitized worktree (untrusted configs and credential-like files
dropped), with `external_directory: deny`, a separate OS user and a
loopback-only proxy. The diagnostic's `read: ask` is envelope-compatible
with the free tier and executes no reads headless; it is not equivalent
to production `allow`. A diagnostic-specific 403 from `read: deny`
**must not** be read as production inference being unavailable.
## Verification
- `tests/deployment/test_opencode_native_smoke.py`: **76 passed, 11
skipped** locally (skips are the POSIX stub end-to-end tests; Windows
`nt`); new preflight unit, workflow-policy and stub e2e coverage.
- `tests/deployment/test_workflow_action_pins.py`: 4 passed;
`check_workflows.py`: all checks passed.
- Deployment/opencode regressions: 155 passed, 11 skipped, 15 subtests
passed; only the 3 known pre-existing `ReportMessageTests` failures that
also fail on pristine `origin/main`.
- CI for this PR runs the full deployment suites, including the POSIX
preflight e2e.
This is a Draft diagnostic PR. **Do not merge and do not dispatch it
with a real key** until the independent review is complete. No model is
activated.
@claude — independent security review requested as a comment on this PR
(HEAD `6d6a0ab`). Focus: headless `read: ask` safety, credential-free
preflight correctness and fail-closed behavior, secret isolation, and
the production-reconciliation reasoning.
0 commit comments