> ## Documentation Index
> Fetch the complete documentation index at: https://loadwise.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# circleci-script-injection

> A CircleCI run command pastes a branch name or commit text into its text, or passes it to eval or inline code.

## What it flags

A `run:` command (a string or `command:`) in a job or reusable command of `.circleci/config.yml`, including steps under `when:` and `unless:`, that pastes branch or commit text into its text with a pipeline value: `<< pipeline.git.branch >>`, `<< pipeline.git.commit.subject >>` or `.body` or `.author.name` or `.author.email`, and the `branch`, `commit_message`, `commit_title`, `commit_author_name` and `commit_author_email` fields of `pipeline.trigger_parameters.github_app` and `.gitlab`. CircleCI replaces pipeline values in the config text before the job runs, so quoting does not help. The `$CIRCLE_BRANCH` variable is also reported when the command hands it to `eval`, `sh -c` or inline interpreter code such as `python -c` or `node -e`, which parse it a second time. [CircleCI docs](https://circleci.com/docs/pipeline-variables/)

Not flagged: pipeline values under `environment:` or `name:`, trusted values such as `pipeline.git.revision` and `pipeline.number`, `<< parameters.* >>` values, and `$CIRCLE_BRANCH` read as shell data. For `$CIRCLE_BRANCH`, also not flagged: the variable in single quotes or escaped (`\$VAR`), so the inner shell reads it from the environment; the variable passed as a later argument (`sh -c 'echo "$1"' _ "$VAR"`); `eval` inside a string or after another command on the same line; text inside `$(...)` or backticks, unless an `echo` or `printf` there prints it back into the code; and scripts that span lines with a trailing backslash. YAML anchors and aliases are not expanded.

```yaml theme={null}
- run:
    environment:
      BRANCH: << pipeline.git.branch >>
    command: echo "$BRANCH"
```

## Configuration

Set the rule to `"off"` in `loadwise.config.json` to drop its findings:

```json theme={null}
{
  "rules": { "circleci-script-injection": "off" }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.