Repository navigation
Conversation
…pback daemon `fuseraft serve --a2a` on loopback with no FUSERAFT_A2A_TOKEN accepted any Host header and any request body type, so a page the user opened could run a hosted agent: a cross-site text/plain POST of SendMessage ran it blind, and a page that rebinds its domain to 127.0.0.1 could also read the reply. The HTTP/MCP listener already guards against both; A2A did not. - On loopback without a token, require a loopback Host (the same check ServeHttpHost uses), before the forwarded headers a same-origin page could set itself. - Refuse any request carrying Origin (403) and any POST that isn't JSON (415): A2A callers are programs, and a request a browser sends without a preflight is never application/json.
ResolveSafe and ResolveSafeDirectory compared paths only as spelled, so a symlink inside the sandbox reached past it: with sandbox `sb/`, a link `sb/link -> ../outside` let read_file and write_file read and create files outside the sandbox, and a link `sb/notes.txt -> .env` read a file the `**/.env` deny rule blocks. A cloned repo can carry such links, and an agent with a shell can make them. After the spelled path passes, follow every symlink along it (the part that doesn't exist yet, such as a file about to be written, is kept as spelled) and check that real path against the real sandbox, included roots and exempted prefixes, and against the deny rules. Roots that are themselves links (macOS's /tmp) keep working; a link cycle is denied.
ContractEngine started `bash` with the raw argument string `-c <command>`. .NET splits that into words, so bash got `-c <first word>` and the rest became its positional parameters: `npm test` ran `npm`, `dotnet test ...` ran `dotnet` (exit 129), and `cargo test` ran `cargo`, which exits 0, so the contract passed without running a test. Pass the command as the one argument after -c, as ShellPlugin and ProbePlugin already do; cmd.exe keeps the raw string it needs.
An empty file (or one holding only `~`) in ~/.fuseraft/schedule deserializes to null. `schedule run` dereferenced it outside any try/catch, so one such file threw a NullReferenceException and no job after it ran. Report the file and move on, as `schedule list` and `schedule enable/disable` already do.
`fuseraft schedule run` printed "✗ Failed (exit N)" but always exited 0, so cron mail, a systemd timer or a CI step never saw a failed job. Exit 1 when any job that ran failed, or a job file couldn't be read (so its job never ran). "Job not found" for --name already exits 1. The command takes the executable that runs each job through an internal constructor, so tests can run jobs with a stand-in script.
…ll save its run When `fuseraft schedule run` was cancelled (Ctrl+C, a service manager stopping it), WaitForExitAsync threw and the job's process was left running. The lock file was still deleted, so the next tick could start the same job alongside it, and the state update used the cancelled token, so LastRun, LastExitCode and NextRun were never saved and the job stayed due. On cancellation, kill the job's process tree, record the run as failed and save its state with CancellationToken.None; don't start further jobs.
…x root ResolveSafeDirectory full-pathed a relative directory against the process's working directory, while ResolveSafe resolves relative paths against the sandbox root. Whenever the two differ, a shell_run workingDirectory or a git repoPath of `src` was denied as outside the sandbox, or pointed somewhere else. Resolve it with ResolveAgainstRoot, as ResolveSafe does.
…ommands
Now that bash gets the whole command, an unquoted {file} or selector target
was run as shell code: a file named `x;cmd;.cs` ran `cmd`. Each now reaches
the shell as one quoted word; a value cmd.exe can't quote safely falls back
to the full suite.
…e it Path.GetFullPath folded `..` into the text first, so `L -> a/../secret` with `a` pointing outside the sandbox was judged to stay inside. The walk now steps up from the real path built so far, as the kernel does.
With a token set, the Origin and JSON checks blocked browser-based clients that held the token. They now run with the Host check, only on a tokenless (loopback) daemon. Document that a reverse proxy or browser client needs FUSERAFT_A2A_TOKEN.
A cancelled run moved NextRun to the next cron time, so the job was skipped until then, and output it wrote before being stopped was lost.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes found during a bug hunt at
2d6ee5f. Each commit fixes one bug and adds tests that fail on the old code and pass with the fix.Fixes
text/plainPOST or a DNS-rebinding Host header could run the agent. The A2A endpoint now applies the same loopback Host check as HTTP/MCP (421), and rejects requests that carryOrigin(403) or a non-JSON body (415)..envdespite a**/.envdeny rule, and could read or write files outside the sandbox. The real path is now checked against the sandbox root, the included roots, the exemptions and the deny rules. Links that stay inside still work, a root that is itself a link (macOS/tmp) still works, and link loops are denied.RelatedTestsPasscommands whole on Linux and macOS.bash -creceived the command as one argument string, so only its first word ran. Arguments are now passed throughArgumentList.nulljob file instead of crashing with a NullReferenceException and running no jobs.CancellationToken.None.ResolveSafeDirectoryresolves relative folders against the sandbox root instead of the process's current folder.Behaviour changes to review
schedule runcan now exit non-zero, and a dry run with a bad job file exits 1.ScheduleRunCommandhas a new internal constructor so tests can inject the program to run. The public constructor is unchanged.Tests
4,214 of 4,222 pass. The 8 failures are the existing Docker-dependent
CodeExecutionPluginTests, which fail on machines without Docker. The new tests that start processes or create symlinks return early on Windows. Not tested: Windows junctions, and A2A behind a real TLS proxy.Not in this PR (found, still open)
-w <secret>shows keys inps.dotnethost, a scheduled job starts the wrong program.--configpaths in jobs break when cron runs them.schedule addwith a name that has no letters or digits.