Skip to content

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

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

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

Conversation

@Rootless-Ghost
Copy link
Copy Markdown
Owner

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

General fix: ensure that commands reaching execution are validated against a known-safe template from embedded atomics, rather than trusting any already-substituted string. The safest approach is to validate at the engine layer (where the selected test definition is available) that the final command is exactly the result of substituting only declared placeholders into the selected test template.

Best concrete fix (without changing intended functionality):

  • In core/engine.py, after computing command and optional cleanup_command, add a strict verifier that:
    1. Reconstructs expected command text from test["command"] and test["cleanup_command"] using the same substitute_variables_safe.
    2. Rejects execution if reconstructed command does not match actual command/cleanup_command.
  • This creates an explicit integrity check that ties execution to the selected embedded atomic template and blocks tampered/free-form command strings.
  • No new dependencies are needed.

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 21:13
@Rootless-Ghost Rootless-Ghost merged commit 5c4dfd4 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-234 branch April 13, 2026 21:14
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