Claude (noether) ebccfa0467 sic: v2 main() — nested targets, boundary-preserved argv, real stdin forwarding
WP8, the last code before deploy. Rewrites the client entrypoint on the v2 wire:

  * target parsing: host[/hop1/hop2...]; hops resolved to incus/docker/pct verbs via
    /etc/sic/hosts.toml (loaded only when hops are present), folded into the frame onion
    by buildChain — verbs[0] is the outermost layer the host sicd enters first.
  * argv is carried as [][]byte end to end and NEVER space-joined; --sh is the sole
    exception (user asked for a shell line -> [sh -c <joined>]).
  * stdin is forwarded AFTER the frame (the v1 client set Stdin to the frame alone, so
    `sic host cat >f <local` wrote a zero-byte file). The copy runs in an abandoned
    goroutine so a stdin-ignoring command on a tty never blocks on a read that never EOFs.
  * ssh -T: the frame is binary; a pty would mangle it.
  * exit code inherited from the far end.

Dead v1 framing (netstring/frameArgv/indexOf) removed — frame.go owns the wire now.
Also corrected the stale runV2 doc comment in sicd (still described the removed 0:,
terminator; it is argc-prefixed since e1f93de).

E2e on boltzmann (ssh localhost + real sicd), all green: touch "a b" -> ONE file;
echo A "" B -> "A  B"; pipe+redirect stdin both forward; exit 7 propagates; a
stdin-ignoring echo does not hang; --sh; and netstring-looking args (3:x, a,b:c)
survive as single arguments.
2026-07-23 11:59:26 +02:00

sic

Run a command on a remote host without a shell re-parsing its arguments.

ssh host touch 'a b' creates two files: ssh joins its arguments with spaces and hands the result to the remote login shell, which splits it again. sic host touch 'a b' creates one file named a b. sic sends the argument vector to a daemon on the host as length-prefixed fields, and the daemon calls execvp on it. No shell parses the arguments.

Components

  • sic — client. Takes argv on the command line, frames it as netstrings, pipes the frame over ssh to sicd.
  • sicd — daemon on the target host. Reads netstrings from stdin and runs the command.

Both are single static Go binaries (cmd/sic, cmd/sicd). A Python reference implementation of the daemon is in gateway/sicd.

Wire format

Each field is a netstring: <length>:<bytes>,. A frame is a mode field, zero or more argument fields, and an empty terminator:

<mode> <arg>* 0:,

argv = ["touch", "a b"] is 4:exec,5:touch,3:a b,0:,. The length prefix means no byte needs escaping and no delimiter can collide with the payload.

mode selector behaviour
exec (default) 4:exec, execvp(argv), no shell. Arguments are passed through unchanged.
sh 2:sh, one field passed to sh -c. Pipes, redirects, and globs work.

Usage

sic <host> <command> [arg ...]
sic --sh <host> '<shell string>'
sic <host> -- <command> [arg ...]      # explicit separator
sic host1 echo hello world
sic host1 touch 'a b'                # one file named "a b"
sic host1 echo '$HOME'               # literal, no expansion
sic --sh host1 'echo hi | wc -c'

Build

go build -o bin/sic  ./cmd/sic
go build -o bin/sicd ./cmd/sicd

Install

Client:

cp bin/sic ~/bin/sic

Daemon on each target host. sicd runs what it is sent, so it must only be reachable over an authenticated transport. Pin it to a dedicated ssh key so the target can run nothing else with that key:

scp bin/sicd host:/tmp/sicd
ssh host 'sudo install -m755 /tmp/sicd /usr/local/bin/sicd'
# ~/.ssh/authorized_keys on the target:
# command="sicd",no-port-forwarding,no-pty ssh-ed25519 AAAA...

Do not listen on a TCP or message-bus port.

Test

printf '4:exec,2:id,0:,' | ssh host sicd
sic host echo hello world

See also

  • docs/design.md — wire format, exec modes, transport and security, prior art.
  • demos/quoting-hell.py — six cases run both ways, plain ssh versus sic.
  • SKILL.md, SKILL-bg.md — agent skill definitions (foreground and background).
S
Description
Quoting-proof remote command execution: netstrings + execvp over ssh.
Readme MIT 3.4 MiB
Languages
Go 71%
Python 23.4%
Shell 5.6%