Skip to content

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

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

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

Conversation

@Rootless-Ghost
Copy link
Copy Markdown
Owner

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

To fix this without changing intended functionality, enforce strict sink-side validation in core/executor.py before _build_command(...) / subprocess.run(...):

  1. Keep existing allowlist logic.
  2. Add a command safety validator that rejects clearly dangerous metacharacters and control characters for interpreter-based executors.
  3. Apply this validator in execute() after allowlist check and before building/running the command.

Best single approach here: add a private helper (e.g. _is_safe_command_text) in core/executor.py and gate execution with it. This preserves behavior for normal embedded atomic commands while preventing accidental execution of malformed/injected command strings and making trust boundaries explicit to CodeQL.

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 marked this pull request as ready for review April 25, 2026 20:43
@Rootless-Ghost Rootless-Ghost merged commit 4588ee9 into master Apr 25, 2026
6 checks passed
@Rootless-Ghost Rootless-Ghost deleted the alert-autofix-78 branch April 25, 2026 20:43
@Rootless-Ghost Rootless-Ghost self-assigned this Apr 25, 2026
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