Commit Graph
6 Commits
Author SHA1 Message Date
Hasan BasbunarandClaude Fable 5.2 cf7c07798a opencode guard: the report's hosts are denied to webfetch too, on both majors
Since v1.40.4 the box's opencode configs deny a shell command naming an Alibaba Cloud host or a
cloud metadata address. On 2026-11-21 the same kind of request left this box as a webfetch tool
call, twice, which no shell rule sees (decision 1561). The same three patterns are now written
for the webfetch tool.

1.x: a block "webfetch*" after "bash*" at the end of "permission" (the plain key "webfetch"
cannot hold an object: 1.19.5 refuses the config), and "*webfetch" after "*bash" in the unit's
OPENCODE_PERMISSION. A block already last and intact is not rewritten, so a box of an earlier
release gets "webfetch*" after its "bash*" and nothing else of its file moves. A block the person
set to one action is theirs: "deny" stands while no key after it speaks for the tool again,
anything else is said (rc 1) and the other block is written still.

2.x: three webfetch rules after the three shell ones, in "permissions" and in the unit's
OPENCODE_CONFIG_CONTENT. A box that served 2.x on v1.56.0 gets the three new rules once; the
rollback to 1.x and the uninstall recognise both shapes of the array, and an empty array is the
person's, not ours.

The unit's values stay this repo's rules alone. On OpenCode 2 the unit's allow overrides every
deny rule of the person's own configs (the content merges after every file): the install's note
said "unless your config has one after it", which no file can have, and now says what happens.

Measured on the real binaries against a scripted endpoint asking for a webfetch whose URL names
aliyuncs.com and points at 127.0.0.1: 1.19.5 and 1.19.6 fetch it with no rule and refuse it with
"webfetch*" and with "*webfetch"; 2.3.2 fetches it under the wildcard allow alone and answers
permission.rejected with the rule after it. Tests red on the old code, green now.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 15:45:10 +01:00
Hasan BasbunarandClaude Opus 5.5 af77e5e5f2 WIP opencode v2 (2.3.0, opt-in): the session's work of 2026-11-13 and 14, taken over as it was left
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 07:37:14 +01:00
Hasan BasbunarandClaude Opus 5.5 620862f832 v1.40.4: the notes say what the rules do not hold against, as three verifications found
Three verifications before the push read opencode 1.19.4's own code and
replayed it. The notes claimed more than it does: its patterns tell case
apart, so a host in capitals is not refused, and what opencode reads
after the rules can allow what they deny: a project's own config, an
agent's own permission, a key added after the block in a global config
that holds it, and an "Always" given to a command, which the approval
mode below now says to answer "Once". Under AGENT_AUTO=1 a user's own
rules give way to its "*" only when the config has no "*" of its own.
The proxy reads no tool arguments past a streamed request's first MiB.
A config of the user's never gets the rules, though install.sh has long
merged autoupdate and compaction into it. The two Agent tab claims were
measured with opencode run under its permission, and say so.

Cohere's post names 169.254.169.254 alone: 100.100.100.200 is Alibaba
Cloud's own metadata address, and the title, the banner and the docs say
an Alibaba Cloud host or a cloud metadata address. The four publishers
are those whose builds write the hosts, not the PUT. aliyuncs.com is
Alibaba Cloud's whole domain, DashScope and its registry included. The
unit template, docs/cockpit.md and the install note of the Agent tab
said deny rules still held under AGENT_AUTO=1. install.sh's memory
comment says GiB and cudaMalloc, as the memory pages do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 00:59:06 +01:00
Hasan BasbunarandClaude Opus 5.5 21ecc040e4 Fixes found by a real uninstall and a real first install on the reference box
- oc and the Agent tab load the box's generated opencode config through
  OPENCODE_CONFIG: on a box emptied and installed with the published
  one-liner, both answered with opencode's hosted free model (big-pickle),
  not the model the box serves.
- uninstall.sh --yes takes the providers that read the API key out of
  opencode's config before deleting the key (opencode refused to start at
  all: "bad file reference"); a file with nothing else of the user's goes to
  a backup (oc-merge-limits.py --remove-providers).
- The uninstall inventory knows the image lane's checkpoint (31 GB), and the
  CI gate on inventory pins reads install-image.sh too.
- The docker room check asks only for the container's room when the image is
  already here (an update with 36 GB free was refused for want of 40).
- A commented-out opencode PATH line no longer counts as one.
- uninstall.sh says when there was nothing to remove.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 17:43:37 +02:00
Hasan BasbunarandClaude Fable 5.1 48e8e043ca agent tab: AGENT_AUTO=1 approves every tool call (v1.7.1)
opencode serve rejects the TUI's --yolo and --auto flags, so the installer
renders OPENCODE_PERMISSION={"*":"allow"} into opencode-web.service when asked
(single-quoted assignment so the JSON survives systemd's parser), which opencode
honours: the served config reads {"*": "allow"}. Verified on the reference box:
a bash call reading a path outside the session's project ran with no permission
request. Explicit deny rules still apply, the user's opencode.json is untouched,
a re-run remembers the choice (AGENT_AUTO=0 turns it off).

The collector reports the mode the unit declares and the mode the running
server applies (GET /config through the credentials); the tab line says which,
and says when a restart is pending. Tests: relay helpers (26 tests), CI renders
the auto line, the HTTP smoke checks unit and server agree.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-03 23:55:11 +02:00
Hasan BasbunarandClaude Fable 5.1 e7ebfe0df5 cockpit: the Agent tab, opencode's web interface behind the cockpit login (v1.7.0)
dashboard/install-agent.sh installs opencode-web.service (opencode serve as the
user on 127.0.0.1:4096, Basic credentials generated once, 0600) and re-installs
the cockpit with a relay on one address, the tailnet address by default. The
relay (dashboard/agent_relay.py, stdlib) is the only thing that reaches
opencode: cockpit session cookie required, foreign Origin refused, cookie
stripped, credentials added, plain answers, event stream and the terminal's
WebSocket streamed back, frame-ancestors set to the cockpit. One host for the
cockpit and the relay, so the tab needs no second login and no Basic prompt.

The tab reports the server, the relay and the served version, with Open in a
tab, Reload and Restart server (three more exact sudoers lines); the Logs tab
reads the server's journal. install-dashboard.sh now keeps the bind, port and
relay settings it finds in the installed unit when re-run without variables.

Tests: 25 offline relay tests (fake opencode with SSE and WebSocket), a
headless check of the tab against the live cockpit, eleven relay checks in the
HTTP smoke, the monkey check covers the new tab (a deep link to #agent crashed
the first build at parse time; fixed), CI renders both cockpit unit templates
and cross-checks every unit action against the sudoers allowlist.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-03 23:34:09 +02:00