Commit Graph
3 Commits
Author SHA1 Message Date
lotherkandClaude Opus 5.5 6fe30f4787 security: the authorization model holds where the model writes the input
A review found the tool classes - the core of the harness - bypassable in
several places where model output was pasted into a shell or trusted as an id.
Each fix below has a test that reproduces the original failure.

No shell for model data
- webfetch put the URL between '...' and ran it through popen: a quote in the
  URL ran any command, from a tool that needed no consent. curl is now exec'd
  with an argv, http(s) only, HTML stripped in C, stderr off the curses screen.
- webfetch is mutate: with read free, "read a key, fetch evil/?k=..." left the
  machine without anybody being asked. websearch stays read (fixed host).
- kids: the parent-approval command got the model's arguments inside '...'
  via system(); they are now "$1". The domain check reads the URL with the
  same parser as the tool (duplicate keys) and refuses user@host URLs.
- delegate: the two copies of the child argv are one (exec_delegate). The ssh
  path exec'd splinter with "ssh" as argv[0]; it now runs ssh and quotes every
  word for the remote shell. A single delegate to a host now really runs there.

Approvals (ack)
- The id was the pid: a late yes stayed on disk and approved the next request
  unseen. Ids are random, requests 0600 with O_EXCL, deleted when answered or
  expired; an answer is refused after expiry; the first answer wins (link(2)).
- An ack dir owned by someone else or writable by others is refused.
- --ack accepted every word but "no" as yes ("nein" approved). Now strict.
- The terminal thread blocked in fgets after a phone answer; it is stoppable.

Secrets
- API key and Telegram token were in curl's argv, readable via ps. src/curl.c
  passes URL and auth headers as a -K config on stdin (transport, telegram,
  tg-ask.sh; its dead eval fallback is gone).
- 'run' and task_start no longer inherit splinter's keys ("run env"). 'run' got
  its own process group, stdin /dev/null and SPLINTER_RUN_TIMEOUT (300 s).

MCP server
- Beyond 127.x it refuses to start without SPLINTER_MCP_TOKEN; connections
  must begin with "AUTH <token>". SIGPIPE ignored, idle connections closed.

Crashes
- task_kill sent kill(-0) - SIGTERM to splinter's own process group - because
  popen gave no pid. Tasks now have a pid and a process group; integer ids work.
- ui: a 3- or 4-byte UTF-8 character overflowed char[2] on every redraw
  (now sp_ui_ascii_char, tested); the scroll offset was taken from one buffer
  and applied to another, reading past its end.

Repo
- The test binaries are no longer tracked (.gitignore already said so).

make check: 23 test binaries, green, also under ASan/UBSan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 20:19:01 +00:00
Konrad 3c5cdaf53a splinter: delegations are tasks too, and the status line is alive
A delegate is work someone else does while we wait, so it belongs in the task
panel with its own clock. The tasks plugin now publishes sp_task_ops through the
host, and delegate.c opens an entry before the call and closes it with status and
rough token count after - 'who is still running' becomes a fact on screen instead
of a guess.

Measured status line, live during a turn:

  splinter 0.1.0  clock: 19:12:56  |  ctx 4.0k  |  12 tok/s  |
  4.0k in / 238 out  |  tasks 0/4          Delphinium 19178ms

Not yet observed: a delegate entry in the panel. Both test configs had no
reachable delegate (one endpoint dead, one with no defers at all), so the cycle
open -> close never ran against a real call. The wiring compiles and the task API
is exercised by task_start/task_list; the delegate half needs one live delegate to
prove.
2026-11-08 19:13:44 +00:00
Konrad b02d51326c splinter: background tasks, four at a time, and the telegram channel
Some work should not hold the conversation: a build, a test run, a delegate on
another host. plugins/tasks adds four tools -

  task_start  command, label?  -> id, starts at once
  task_list                    -> id, state, seconds, bytes, label
  task_result id               -> output and exit status once finished
  task_kill   id               -> stop it

SPLINTER_TASKS_MAX defaults to 4, and a start beyond it is refused with the
reason instead of queued into an invisible backlog: a machine running twenty
shell commands at once is not faster, only harder to read. Output is capped at
1 MiB and says so. The sidebar gets a tasks widget that ticks once a second while
something runs, and the status meter carries tasks_running/tasks_max for the
status plugin.

Measured, through the model:
  task_start    -> 'started #1 (sleep_task) - 1/4 running'
  task_list     -> '#1 running 0s 0 B  sleep_task'
  limit 1:      -> 'started #1 ... 1/1' then 'error: 1 tasks already running'

tools/tg-ask.sh sends an approval request to a Telegram chat and returns; the
gateway answers it, because one reader per chat is the whole point. Verified
against a stub curl (chat_id, text and token land in the right place) and it fails
cleanly when the token is missing.

The status line shows its segments now - the earlier empty bar was the Makefile
recipe that built kids.c into status.so, not a drawing bug.
2026-11-08 18:35:47 +00:00