Skip to content

Potential fix for code scanning alert no. 2: Uncontrolled command line#13

Merged
Rootless-Ghost merged 1 commit intomasterfrom
alert-autofix-23
Apr 25, 2026
Merged

Potential fix for code scanning alert no. 2: Uncontrolled command line#13
Rootless-Ghost merged 1 commit intomasterfrom
alert-autofix-23

Conversation

@Rootless-Ghost
Copy link
Copy Markdown
Owner

Potential fix for https://github.com/Rootless-Ghost/AtomicLoop/security/code-scanning/2

The best fix is to ensure only commands that are explicitly allowlisted by executor are accepted from the HTTP API, and reject anything else before calling execution routines. This preserves functionality (running known atomic commands) while preventing arbitrary user-supplied command content from reaching subprocess interpreters.

Implement this in app.py in the request handler shown (around lines 239–276):

  1. Import _is_allowed_atomic_command from core.executor alongside execute.
  2. After parsing command/executor_type and validating command is non-empty, add a guard:
    • if _is_allowed_atomic_command(command, executor_type) is false, return 400 with a clear error.
  3. Keep existing execution flow (local vs winrm) unchanged.

This is the least invasive change, keeps existing behavior for valid atomic commands, and adds a clear sanitization/validation step on untrusted input path so the sink is no longer directly fed arbitrary request data.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@Rootless-Ghost Rootless-Ghost self-assigned this Apr 25, 2026
@Rootless-Ghost Rootless-Ghost marked this pull request as ready for review April 25, 2026 20:26
@Rootless-Ghost Rootless-Ghost merged commit 9b5597d into master Apr 25, 2026
6 checks passed
@Rootless-Ghost Rootless-Ghost deleted the alert-autofix-23 branch April 25, 2026 20:27
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