Skip to content

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

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

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

Conversation

@Rootless-Ghost
Copy link
Copy Markdown
Owner

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

Best fix: enforce an execution allowlist in core/executor.py so execute() only runs command strings that exactly match the known atomic commands/cleanup commands for the selected executor type. This preserves existing behavior (running embedded tests) while blocking any command that is not part of the predefined catalog.

Implementation details:

  • File: core/executor.py
  • Add a private helper _is_allowed_atomic_command(command, executor_type) that imports ATOMICS locally and checks exact match against command and cleanup_command from catalog tests for that executor.
  • In execute(), after normalizing executor_type and before dry_run/execution, reject commands that are not allowlisted by returning ExecutionResult(..., error=...).
  • Keep all existing logic otherwise unchanged.

No new third-party dependencies are 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 marked this pull request as ready for review April 13, 2026 17:11
@Rootless-Ghost Rootless-Ghost merged commit 9c32b6e into master Apr 13, 2026
6 checks passed
@Rootless-Ghost Rootless-Ghost self-assigned this Apr 13, 2026
@Rootless-Ghost Rootless-Ghost deleted the alert-autofix-28 branch April 13, 2026 17:12
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