Skip to content

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

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#7
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

The safest fix without changing intended functionality is to strictly validate substituted argument values using a positive allowlist before building shell command strings. The existing blacklist is too weak and shell-specific bypasses remain.
Best approach in this codebase:

  • In core/engine.py (inside run_test, where input_args is validated), replace the current metacharacter blacklist with:
    • same type checks,
    • length check for string inputs,
    • strict allowlist regex for permitted characters (letters, digits, space, underscore, dot, colon, slash, backslash, plus, equals, comma, at, percent, and hyphen),
    • reject control characters.
  • Keep behavior otherwise unchanged (still supports variable substitution and existing execution paths), but fail closed on unsafe input.

No other files need modification for this specific CodeQL path because the taint source is neutralized before command construction.

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 13, 2026
@Rootless-Ghost Rootless-Ghost marked this pull request as ready for review April 13, 2026 14:57
@Rootless-Ghost Rootless-Ghost merged commit b429084 into master Apr 13, 2026
6 checks passed
@Rootless-Ghost Rootless-Ghost deleted the alert-autofix-2 branch April 13, 2026 14:57
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