fix(slm): replace shell denylist with allowlist to prevent command injection (#3421)#3444
Merged
mrveiss merged 1 commit intoDev_new_guifrom Apr 4, 2026
Merged
fix(slm): replace shell denylist with allowlist to prevent command injection (#3421)#3444mrveiss merged 1 commit intoDev_new_guifrom
mrveiss merged 1 commit intoDev_new_guifrom
Conversation
AutoBot Phase Validation ResultsSystem Maturity: 0.0% Phase Status:Recommendations: |
✅ SSOT Configuration Compliance: Passing🎉 No hardcoded values detected that have SSOT config equivalents! |
Owner
Author
Code reviewFound 1 issue:
AutoBot-AI/autobot-slm-backend/api/nodes_execution.py Lines 291 to 305 in 6a18eaf Fix: when the known_hosts file does not exist, create it (or use a writable path) so SSH can actually persist the accepted key, or fail hard rather than degrading silently to the same security level as 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
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.
Summary
_INJECTION_PATTERNSdenylist withALLOWED_EXECUTABLES— a strictfrozensetof ~30 permitted executable names_validate_command()usesshlex.split()and checksPath(tokens[0]).nameagainst the allowlist; anything not listed returns HTTP 400_run_command()passes the pre-split token list toasyncio.create_subprocess_exec(*tokens)—shell=Falseby construction, no interpreter string_run_via_ssh()likewise passes tokens as individual SSH arguments, never a shell stringStrictHostKeyChecking=noreplaced withyes(known_hosts present) oraccept-new(first contact)get_current_user→require_adminlanguagefield removed from request schema (interpreter selection was another injection vector)Closes #3421
Security
The prior denylist was bypassed by semicolons,
&&, shell newlines,python3 -c,eval, and dozens of other vectors. An allowlist withshlex.split()+shell=Falseeliminates the entire class.Test plan
pytest autobot-slm-backend/api/nodes_execution_test.py -v— all tests passbash -c whoami) returns HTTP 400