Skip to content

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

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

Potential fix for code scanning alert no. 13: Uncontrolled command line#12
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

The safest fix without changing intended functionality is to enforce strict command allowlisting before building ps_script in execute_remote_winrm, using the already-imported _is_allowed_atomic_command. This keeps the endpoint behavior (running allowed atomic commands remotely) while blocking arbitrary user input from reaching the PowerShell interpreter.

Make the change in core/remote_executor.py inside execute_remote_winrm, before ps_script is constructed (before line 161 in the provided snippet). If command is not allowed, return an ExecutionResult error immediately. This prevents tainted/unapproved input from flowing into subprocess.run.

No new imports or dependencies are required, since _is_allowed_atomic_command is already imported in that file.

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 15, 2026
@Rootless-Ghost Rootless-Ghost marked this pull request as ready for review April 15, 2026 05:10
@Rootless-Ghost Rootless-Ghost merged commit ce8f632 into master Apr 15, 2026
4 checks passed
@Rootless-Ghost Rootless-Ghost deleted the alert-autofix-13 branch April 15, 2026 05:10
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