Skip to content

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

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

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

Conversation

@Rootless-Ghost
Copy link
Copy Markdown
Owner

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

General fix: never pass user-controlled command text directly into -Command script content. Instead, resolve user input to a predefined allowlisted command and only embed that resolved value.

Best fix here (without changing intended functionality): in core/remote_executor.py, after _is_allowed_atomic_command(command) succeeds, normalize and resolve the command through a local hardcoded allowlist mapping (allowed_commands) and use the resolved command in ps_script. This makes execution deterministic and removes direct use of tainted input in the command construction path. Keep existing behavior for disallowed commands by returning the same policy error.

Changes needed:

  • File: core/remote_executor.py
  • Region: around existing allowlist check (currently lines ~161–173).
  • Add a hardcoded allowed_commands map and resolve command to resolved_command.
  • Use resolved_command in Invoke-Command ... -ScriptBlock.
  • No new external dependencies required.

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:28
@Rootless-Ghost Rootless-Ghost merged commit 60d4fd7 into master Apr 25, 2026
6 checks passed
@Rootless-Ghost Rootless-Ghost deleted the alert-autofix-13 branch April 25, 2026 20:29
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