Skip to content

False positive: Incorrect CodeQL model for step-security/harden-runner action #21568

@XinyuZhangXvX

Description

@XinyuZhangXvX

The CodeQL model for step-security/harden-runner ([model file]) flags input.allowed-endpoints as flowing to a command injection sink.

However, examining the actual source code, the call is:

cp.execFileSync("echo", [content]);

This is not a command injection vulnerability because:

  1. The first argument (the command) is a hardcoded string "echo" — it is not user-controlled.
  2. execFileSync does not pass arguments through a shell by default. It invokes the executable directly via execvp, so shell metacharacters in content (e.g., ; rm -rf /, $(cmd), `cmd`) are treated as literal strings and passed as-is to the echo program.
  3. The user-controlled input (content) only flows into the argument array (the second parameter), which cannot cause command injection without shell: true being set in the options.

Therefore, this is a false positive — the tainted data does not reach a position where it can alter which command is executed or be interpreted by a shell.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions