Skip to content

🦀 v0.9.0 — Rust rewrite: one small binary, read-only that really is read-only - #5

Merged
limeflash merged 12 commits into
mainfrom
rust-port
Nov 24, 2026
Merged

limeflash merged 12 commits into
mainfrom
rust-port

Conversation

@limeflash

@limeflash limeflash commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

🦀 v0.9.0 — one small Rust binary, and read-only that really is read-only

TL;DR

  • The plugin is now a single native binary, written in Rust with zero third-party dependencies. It replaces the Bash script, the Node.js companion and the PowerShell port, so Node.js is no longer needed.
  • It closes a security hole. On agy 1.5.7 and newer, the "read-only" commands (/agy:ask, /agy:review, …) could edit your files.
  • It brings over upstream's --model. Pick flash, pro, opus or sonnet and you always get the newest model in that family.

🔒 The security fix, in plain words

Before (0.8.1) Now (0.9.0)
What kept /agy:ask read-only agy ran in an empty temp folder and hopefully stayed there agy is explicitly forbidden to write files, run commands or read outside its folder
On agy 1.5.7+ agy's new default "Auto" mode approved writes anywhere in a git repo: reproduced, it overwrote a file in another repo Writes are denied and you see a note saying so. Tested live 4×: the target file was never touched
If agy can't be locked down — The plugin refuses to run instead of running unprotected

Three independent locks are passed to agy on every read-only run: Default mode + deny all shell commands + deny all file writes.

Other guards, tightened along the way:

  • 🔑 Secrets. The whole diff is checked for API keys, removed lines included (git rm .env used to send the keys to Gemini).
  • 🌐 /agy:scrape. The plugin downloads the page itself and blocks internal addresses, including tricks with DNS and redirects. agy only turns the saved page into Markdown.
  • 📄 /agy:doc-to-md. More credential folders are off-limits (Maven, FileZilla, keychains, browser profiles, …).
  • 🛑 /agy:cancel. It only ever stops jobs you started on this machine. A repo can no longer trick it into killing processes or deleting folders.

⚙️ How it works now

/agy:ask …  →  bin/agy-plugin (tiny launcher)  →  agy-plugin binary  →  agy
                       │
                       └─ downloads the binary for your OS once from GitHub Releases
                          and runs it only if its SHA-256 matches the one in this repo
  • Platforms: macOS (Apple silicon & Intel), Linux (x86_64 & arm64, static), Windows (x86_64 & arm64).
  • Size: about 0.6 MB per binary.

✨ What users will notice

Command Change
/agy:review One implementation; --base, --background, --wait and --model always work
--model flash etc. Resolved live against agy models; agy's settings file is never touched
/agy:scrape Works again on agy 1.5.x (agy has no web-fetch tool in read-only mode)
/agy:rescue --isolate Edits happen in a separate checkout; you get a patch
/agy:cancel Also stops the agy process itself, not only the plugin
Blocked actions Shown clearly ("agy tried to use X, which this read-only command blocks") instead of "no output"

Requires agy 1.2.0 or newer (/agy:setup checks this).

Bugs fixed:

  • --model was ignored by background commands.
  • --fresh did nothing.
  • An extra flag could swallow the task text.
  • Cancel left agy running.
  • A crashed agy was reported as success.

✅ How it was checked

Check Result
Unit + end-to-end tests (real binary vs a fake agy that records every call) 233 + 14 passing
Same behaviour as the old code secret patterns: 39,981 cases ✔︎ · JSON: 400k numbers ✔︎ · dates: 200k ✔︎
Lint (clippy -D warnings) on macOS, Linux, Windows clean
Live run against real agy 1.5.16: ask, model pick, review (found both planted bugs), background review, scrape, doc-to-md, isolate, cancel all pass
Write-escape attempt against a real agy target file untouched every time
Independent security review 3 serious + several minor findings, all fixed with tests
Released binaries (v0.9.0) 6 platforms built; every checksum re-verified; download → verify → ask = 42

📦 Release status

  • ✅ v0.9.0 is published, and its checksums are pinned in this PR, so the plugin works as soon as this merges.
  • 🔜 v0.9.1 will follow from main right after the merge. It ships two fixes that landed after the v0.9.0 tag: faster cancel on Linux, and Windows test fixes. From then on, the release workflow pins checksums automatically.
Commit map
  • feat!: rewrite agy-plugin as one std-only Rust binary
  • feat: SHA-256-pinned launcher and release pipeline
  • test: live end-to-end script against a real agy
  • docs: 0.9.0 — commands, security model, changelog
  • release: pin agy-plugin binaries to v0.9.0
  • follow-ups: release-workflow tweak, Linux zombie-aware liveness, Windows test fixes

🤖 Generated with Claude Code

limeflash and others added 9 commits November 24, 2026 21:31
Not for merge as-is: kept as the reference for the Rust rewrite.

- security: agy >= 1.5.7 starts headless -p runs in Auto mode, which
  approves writes outside the workspace. Verified on agy 1.5.16: 0.8.1's
  /agy:ask overwrote a file in a git repo outside its temp workspace.
  Pin Default mode per run with --settings '{"agentMode":""}' (bash +
  Node runner), fail closed when agy defaults to Auto but can't be pinned.
- model: port upstream simplybychris 0.5.0 — resolve aliases against
  `agy models`, pass agy's native --model, stop patching settings.json.
- fix(image): empty description under bash 3.2 (upstream d3b981f).
- fix(macos): symlinked prefixes in isSensitivePath and the image
  allowlist (/etc -> /private/etc slipped past doc-to-md's guard).
- tests: helpers.bash ran `set +e`, which made every bats assertion in
  tests that sourced the wrapper a no-op; restored errexit. New tests for
  model resolution and the mode pin; mutation-checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replaces the Bash wrapper, the Node.js companion and the PowerShell port
with a single Rust binary that has no dependencies at all (std only; OS
calls via extern in src/sys.rs). Node.js is no longer required.

Read-only commands (ask, review, adversarial-review, scrape, doc-to-md)
run agy from a throwaway dir, without auto-approval, pinned with ONE
last-place token:
  --settings={"agentMode":"","permissions":{"deny":["command(*)","write_file(*)"]}}
agy >= 1.5.7 otherwise starts headless runs in Auto mode, which approves
writes outside the workspace (reproduced on 1.5.16 with 0.8.1's ask).
Fails closed when agy defaults to Auto but can't be pinned.

Also: native --model resolved against `agy models` (upstream 0.5.0);
answers from --output-format json with denied actions reported; scrape
downloads the page itself (DNS-pinned, redirects re-checked) because a
read-only agy has no URL tool; secret scan over every diff line plus
staged files; cancel acts only through a private per-user registry and
an OS file lock (planted job records can't make it kill or delete);
isolate via `git clone --shared`; many job-control fixes.

233 unit + 14 end-to-end tests (real binary vs a recording stub agy).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
plugins/agy/bin/agy-plugin (POSIX sh) and agy-plugin.ps1 download the
binary for the platform from the GitHub release named in bin/VERSION and
run it only if its SHA-256 matches bin/SHA256SUMS, on every run.
release.yml builds six targets on tag, publishes them with SHA256SUMS
and opens the pin PR. CI: fmt, clippy -D warnings and tests on Ubuntu,
macOS and Windows, a zero-dependency check, and launcher tests (sh and
PowerShell 5.1, including quoted arguments).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scripts/e2e-live.sh drives every command through the launcher against a
logged-in agy, including the read-only write-escape attempt. Not run in
CI (uses model quota); run before each release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Slash commands, runner agent and skill call bin/agy-plugin; README,
SECURITY (incl. the agy 1.5.7+ read-only advisory), CONTRIBUTING
(std-only rule), CHANGELOG, NOTICE, templates; version 0.9.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first Rust release is tagged on the PR branch; main doesn't have
plugins/agy/bin until that PR merges, so pin by hand there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SHA256SUMS from the v0.9.0 release (workflow run 45460832563); every
asset re-verified locally against it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- sys: kill(pid, 0) succeeds on a zombie. An orphaned worker waits for
  its subreaper (slow on CI runners), so cancel spent the whole grace
  period on an already-dead worker. On Linux a zombie now counts as gone
  (/proc/<pid>/stat state Z).
- tests/cli.rs: assert the worker and the agy it started are gone,
  ignoring zombies, instead of probing the whole process group.
- guard test: Windows strips a trailing dot from file names.
- launcher test: on Windows Git Bash the fake release binary must be a
  real executable; CI passes the built stub_agy.exe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- the test temp-dir helper dropped Windows' verbatim \\?\ prefix from
  canonical paths (the plugin never produces it);
- Windows forbids '"' in file names: use an injection-shaped name without
  quotes there;
- launcher test: curl on Windows needs C:/... in file:// URLs (cygpath).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@limeflash limeflash changed the title feat!: 0.9.0 — std-only Rust rewrite; close read-only escape on agy 1.5.7+ 🦀 v0.9.0 — Rust rewrite: one small binary, read-only that really is read-only Nov 24, 2026
limeflash and others added 3 commits November 24, 2026 23:57
Quick start in three steps, commands split into read-only vs can-change-
files, the safety model in plain words, a diagram, and the details
(configuration, FAQ, development) folded away.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rror

Under ErrorActionPreference=Stop, Windows PowerShell 5.1 raises a
NativeCommandError for any stderr line of a native program, and the
launcher reports "downloading ..." on stderr. Run it with Continue in
the test; exit codes are still checked explicitly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Passing them on the command line crossed Windows PowerShell 5.1's own
native-argument boundary, which mangled embedded quotes and a trailing
backslash before the launcher saw them. The test now checks the
launcher's quoting, not PowerShell's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@limeflash
limeflash merged commit 05ff903 into main Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant