-
Notifications
You must be signed in to change notification settings - Fork 162
feat(shell): one persistent shell per task so cwd and env survive #3398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a8d3e50
feat(shell): add a shell session whose cwd and environment persist
2466dc6
feat(shell): run_shell_command in a persistent session, with a probe ...
aaf277d
docs(shell): describe the persistent shell session and its new tools
c9c78c4
chore(security): justify the shell-session subprocess suppressions
5f62065
fix(shell): count the three new session tools in the published manifests
10b20ce
fix(shell): keep the registration tools_count in step with the manifest
077f505
fix(shell): repair the two seams the session refactor moved
940d62f
fix(shell): treat shell-owned variables as inherited, not as agent ch...
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,45 @@ | ||
| { | ||
| "_comment": "Approved security suppressions. Every '# noqa: S<n>' (flake8-bandit) and '# nosec' (bandit) comment in src/ or hub/ MUST be listed here with a justification, or CI fails (util/check_security_gates.py, run by util/lint.py). Adding an entry requires PR review — this is the gate that would have caught the GAIA hub tar-slip (CWE-22), where a '# noqa: S202 - hub artifacts are trusted' silenced an unvalidated tarfile.extractall. Keyed by (path, rule), not line number. See SECURITY.md.", | ||
| "suppressions": [ | ||
| {"path": "src/gaia/eval/scorecard_gate.py", "rule": "S603", "justification": "git is a fixed, trusted executable; args are a constructed list, never shell-interpreted"}, | ||
| {"path": "src/gaia/hub/installer.py", "rule": "S603", "justification": "'uv pip install' args are a constructed list (no user string), never shell-interpreted"}, | ||
| {"path": "src/gaia/hub/native_launcher.py", "rule": "S603", "justification": "native binary path is an installed hub artifact (operator-controlled); args are constructed, not shell"}, | ||
| {"path": "src/gaia/mcp/mcp_bridge.py", "rule": "B104", "justification": "binds 0.0.0.0 only on explicit caller opt-in (documented flag), never by default"}, | ||
| { | ||
| "path": "src/gaia/eval/scorecard_gate.py", | ||
| "rule": "S603", | ||
| "justification": "git is a fixed, trusted executable; args are a constructed list, never shell-interpreted" | ||
| }, | ||
| { | ||
| "path": "src/gaia/hub/installer.py", | ||
| "rule": "S603", | ||
| "justification": "'uv pip install' args are a constructed list (no user string), never shell-interpreted" | ||
| }, | ||
| { | ||
| "path": "src/gaia/hub/native_launcher.py", | ||
| "rule": "S603", | ||
| "justification": "native binary path is an installed hub artifact (operator-controlled); args are constructed, not shell" | ||
| }, | ||
| { | ||
| "path": "src/gaia/mcp/mcp_bridge.py", | ||
| "rule": "B104", | ||
| "justification": "binds 0.0.0.0 only on explicit caller opt-in (documented flag), never by default" | ||
| }, | ||
| { | ||
| "path": "src/gaia/agents/tools/shell_tools.py", | ||
| "rule": "B602", | ||
| "justification": "Sandboxed shell tool. Every command (and each pipeline segment) is validated against a whitelist via _validate_command before execution; shell=True is enabled ONLY on Windows so cmd.exe can resolve built-ins (dir/cd/type) and pipes that Git-for-Windows tools rely on. Converting to args-list would break piped/whitelisted commands the tool exists to run." | ||
| }, | ||
| { | ||
| "path": "src/gaia/agents/tools/shell_session.py", | ||
| "rule": "B404", | ||
| "justification": "Importing subprocess is this module's purpose: it exists to hold one long-lived shell per task. The import itself carries no risk; the execution sites below are where the review belongs." | ||
| }, | ||
| { | ||
| "path": "src/gaia/agents/tools/shell_session.py", | ||
| "rule": "B607", | ||
| "justification": "taskkill is resolved from PATH rather than an absolute path. It is a Windows system binary in System32, and hard-coding a path would break on non-default system roots. An attacker able to shadow taskkill on PATH already has code execution on the box, so this widens nothing." | ||
| }, | ||
| { | ||
| "path": "src/gaia/agents/tools/shell_session.py", | ||
| "rule": "B603", | ||
| "justification": "Two sites. The taskkill call is a fixed argv list with no shell, and its only variable is a PID taken from a child this process started. The Popen at the session's exec site DOES honour shell=True when the caller asks for it - that is the feature, not an oversight: the command has already passed _validate_shell_command (operator blocklist plus per-segment binary policy), and under --bypass-permissions it is deliberately unrestricted, which is the documented purpose of that mode. The gate to review is the validator and the bypass flag, not this call." | ||
| } | ||
| ] | ||
| } |
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.