Skip to content

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

Merged
Rootless-Ghost merged 1 commit into
masterfrom
alert-autofix-2
Apr 13, 2026
Merged

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

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, add strict validation of input_arguments values before variable substitution. The best place is core/engine.py in run_test, right after input_args = input_arguments or {} and before substitute_variables(...).

Approach:

  • Enforce input_arguments is a dict.
  • Allow only scalar types (str, int, float, bool) and reject complex objects.
  • For string values, reject shell-dangerous metacharacters (;, &, |, backticks, $, <, >, newlines, etc.) using a regex allow/deny check.
  • Return a structured error instead of executing when validation fails.

This preserves the existing execution model while preventing attacker-controlled shell syntax from reaching subprocess.run through command interpolation.

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 14:35
@Rootless-Ghost
Rootless-Ghost merged commit 430da0c into master Apr 13, 2026
6 checks passed
@Rootless-Ghost
Rootless-Ghost deleted the alert-autofix-2 branch April 13, 2026 14:35
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