Repository navigation
Quote bridge commands so a fish login shell cannot reopen them - #14
Merged
Merged
Conversation
The server's sshd hands the whole command line to the account's login shell. Values were embedded in POSIX single quotes, where nothing is special. fish reads a backslash inside single quotes as an escape, so a value ending in a backslash escaped its closing quote and the rest of the line could be re-read by the shell. Paths and file-name patterns come from the assistant, so on a host whose login shell is fish a read-only tool could be made to run text the app did not intend. The outer command line is now quoted so that no backslash is ever left inside single quotes. Text read by /bin/sh inside the wrapper keeps POSIX quoting, which is correct there. A comment says which shell reads which layer. Tested against real sh and bash with hostile values. fish is not installed where this was written, so its rules are checked against a model; a test runs the same check through real fish when it is present.
This was referenced Nov 16, 2026
The test ran the supervised wrapper with its input already at end-of-file. That is the wrapper's stop signal, so on a slow runner the command was ended before it printed and the test failed. Run it as the app does, with the input held open until the command has finished.
The backup fix, the fish quoting fix and the departed-peer fix all ship in 1.6.0, so their notes move from docs/changes into the 1.6.0 section of CHANGELOG.md. The release date is 16 November 2026 in the changelog, the Debian changelog, the Flatpak metadata and the privacy policy.
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.
The bug
A security fix for the AI Bridge's read tools in 1.6.0.
The server's sshd hands the whole command line to the account's login
shell. The bridge embedded values in POSIX single quotes, where nothing
is special. fish reads a backslash inside single quotes as an escape,
so a value ending in a backslash escaped its closing quote, and the
rest of the line could be re-read by the shell.
Paths and file-name patterns come from the assistant. On a host whose
login shell is fish, a read-only tool could therefore be made to run
text the app did not intend. Hosts with sh, bash or zsh as the login
shell are not affected.
The fix
BridgeCommands.loginShellQuote: no backslash is ever left insidesingle quotes. For a value without a backslash the output is identical
to the old quoting.
supervised, and it now uses that quoting. Values inside a templateare read by
/bin/shonly and keep POSIX quoting, which is correctthere. A comment says which shell reads which layer.
Tested
shandbash, each read tool's command with hostile values(trailing backslash, quote runs,
$(), backticks,;, a leading-): the inner command receives exactly the value and a marker filethe value tries to create never appears.
SSGO_SSHD=1): 8 passed.release build and the launcher build.
Not tested
fish itself. It is not installed where this was written. The quoting is
checked against a model of fish's single-quote rules, and
test/bridge_shell_quoting_test.darthas a test that runs the samecheck through real fish when it is installed. Worth running once on a
machine that has fish.
Related, not changed here
FleetExecService.wrap(the user's own "run a command on many servers")quotes the same way. There the command is the user's, so under a fish
login shell it is a correctness bug rather than a security one.
Before tagging 1.6.0
1.6.0 is merged but not tagged. If this lands first, the line in
docs/changes/bridge-shell-quoting.mdbelongs in the changelog's 1.6.0Security section.