> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/cortex-cloud-posture-management/cortex-cli/cortex-cli-for-code-security/cortex-cli-cortex-cloud-application-security-command-line-reference.md).

# Cortex CLI Cortex Cloud Application Security command line reference

This reference guide documents the commands and flags unique to the Cortex Cloud Application Security CLI. For CLI commands common to all supported modules refer to [Cortex CLI common command line reference guide](/cortex-cloud-posture-management/cortex-cli/cortex-cli-common-command-line-reference-guide.md).

{% hint style="info" %}

### Important

The Cortex CLI Cortex Cloud Application Security only supports single occurrences of each flag. If the same flag is passed multiple times, only the last provided value will be used. For example, in the following command, only TF CloudFormation will be the scanned framework.

EXAMPLE

`cortexcli --api-base-url <YOUR_API_URL> --api-key <YOUR_API_KEY> --api-key-id <YOUR_API_KEY_ID> code scan --framework terraform --framework "terraform cloudformation`
{% endhint %}

| Command/Variable                                                                                                                 | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| -------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p><code>--source</code></p><p><code>$CORTEX\_CODE\_SOURCE</code></p>                                                            | <p>(Optional, default <code>CORTEX\_CLI</code>)</p><p>The execution environment that launched the scan.</p><p>Use one of the following values: <code>CORTEX\_CLI</code>, <code>IDE\_VSCODE</code>, <code>JENKINS</code>, <code>GITHUB\_ACTIONS</code>, <code>CIRCLE\_CI</code>, <code>AWS\_CODE\_BUILD</code>, <code>GIT\_HOOK</code>, <code>GIT\_HOOK\_COMMITS</code>.</p><p>EXAMPLE: In a GitHub Actions pipeline, pass <code>--source GITHUB\_ACTIONS</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| <p><code>--repo-id</code></p><p><code>$CORTEX\_CODE\_REPO\_ID</code></p>                                                         | <p>The unique identifier used to associate scan results with the correct repository in Cortex.</p><ul><li><strong>Value:</strong> <code>owner/repo</code> (for example, <code>my-org/my-repo</code>). Value must contain a forward slash <code>/</code>.</li><li><strong>Requirement:</strong> Required for upload mode; otherwise, optional</li><li><strong>Auto-detection:</strong> If omitted, the CLI automatically extracts this value from your Git remote URL using the last two segments of the path</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| <p><code>--repo-url</code><br><code>$CORTEX\_CODE\_REPO\_URL</code></p>                                                          | Optional: URL of the repository being scanned (for example, `https://github.com/org/repo`). If omitted, the CLI attempts to auto-detect the URL from the local Git remote of the scanned directory                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| <p><code>--branch</code></p><p><code>$CORTEX\_CODE\_BRANCH</code></p>                                                            | <p>The branch name associated with the scan.</p><p>Default: The branch detected from your local Git checkout in <code>upload</code> mode when upload permissions are valid</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| <p><code>--directory</code></p><p><code>$CORTEX\_CODE\_DIRECTORY</code></p>                                                      | <p>Required.</p><p>The directory path to scan. Cannot be used together with <code>--file</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| <p><code>--file</code></p><p><code>$CORTEX\_CODE\_FILE</code></p>                                                                | The file path to scan. Cannot be used together with `--directory`. When using this option, the Cortex CLI will filter runners based on the file type provided. For example, if you specify a `.tf` file, only the Terraform and secrets frameworks will be included. You can further limit this (for example; skip secrets) by using the `--skip-framework` argument                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| <p><code>--var-file</code></p><p><code>$CORTEX\_CODE\_VAR\_FILE</code></p>                                                       | Variable files to load in addition to the default files. This feature is currently supported for both source Terraform (.tfvars files) and Helm chart scans (for providing custom values or variable overrides). Refer to <https://www.terraform.io/docs/language/values/variables.html#variable-definitions-tfvars-files>) for more information                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| <p><code>--framework</code></p><p><code>$CORTEX\_CODE\_FRAMEWORK</code></p>                                                      | <p>Filter to scan specific frameworks. Example: <code>--framework arm</code>.</p><p>Syntax: Use a single flag with comma-separated values for multiple frameworks. Both quoted (<code>"arm,ansible"</code>) and unquoted (<code>arm,ansible</code>) formats are supported. Example: <code>--framework arm,ansible</code>.</p><p>Constraint: <strong>Do not</strong> use multiple --framework flags: <code>--framework terraform --framework sca\_package</code>.</p><p>Environment variables: <code>export CORTEX\_CODE\_FRAMEWORK=arm,ansible</code>.</p><p>Supported frameworks: <code>ARM</code>, <code>ANSIBLE</code>, <code>BICEP</code>, <code>CLOUDFORMATION</code>, <code>DOCKER</code>, <code>DOCKERFILE</code>, <code>HELM</code>, <code>KUBERNETES</code>, <code>KUSTOMIZE</code>, <code>OPENAPI</code>, <code>SCA</code>, <code>SECRETS</code>, <code>SERVERLESS</code>, <code>TERRAFORM</code>, <code>TERRAFORMJSON</code>, <code>TERRAFORMPLAN</code></p> |
| <p><code>--skip-framework</code></p><p><code>$CORTEX\_CODE\_SKIP\_FRAMEWORK</code></p>                                           | <p>Skip specific frameworks. Example: <code>--skip-framework terraform</code>.</p><p>Syntax: Use a single flag with comma-separated values for multiple frameworks. Both quoted (<code>"arm,ansible"</code>) and unquoted (<code>arm,ansible</code>) formats are supported. Example: <code>--skip-framework terraform, sca\_package</code>.</p><p>Constraint: <strong>Do not</strong> use multiple skip --framework flags: <code>--skip-framework terraform --skip-framework sca\_package</code>.</p><p>Environment variables: <code>export CORTEX\_CODE\_SKIP\_FRAMEWORK="tf,sca"</code></p>                                                                                                                                                                                                                                                                                                                                                                           |
| <p><code>--rule</code></p><p><code>$CORTEX\_CODE\_RULE</code></p>                                                                | Restrict the scan to specific check IDs; all other checks are skipped. Enter one or more comma-separated check IDs, for example `--rule APPSEC_AWS_79,APPSEC_SECRET_80`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| <p><code>--severity</code><br><code>$CORTEX\_CODE\_SEVERITY</code></p>                                                           | <p>Filters scan results by severity level. Accepts one or more comma-separated values: unknown, low, medium, high, critical. Repeat the flag or use comma separation to specify multiple levels (for example, <code>--severity high,critical</code>).</p><p><strong>Constraint</strong>: Only effective when <code>--upload-mode</code> is set to <code>no-upload</code>. When upload mode is active, the flag is ignored and an informational message is displayed</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| <p><code>--blocked-only</code></p><p><code>$CORTEX\_CODE\_BLOCKED\_ONLY</code></p>                                               | Boolean flag. When set, shows only blocked findings in the output. Available only in `upload` mode                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| <p><code>--summary-position</code></p><p><code>$CORTEX\_CODE\_SUMMARY\_POSITION</code></p>                                       | Sets the position for displaying the summary information relative to the findings. Values: `top`, `bottom`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| <p><code>--upload-mode</code></p><p><code>$CORTEX\_UPLOAD\_MODE</code></p>                                                       | Upload mode determines the method or mode used to upload data. See common flags for more information                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| <p><code>--download-external-modules</code><br><em><code>$</code></em><code>CORTEX\_CODE\_DOWNLOAD\_EXTERNAL\_MODULES</code></p> | <p>(Optional, default <code>False</code>)<br>Download external Terraform modules from public Git repositories and the Terraform Registry so they are included in the IaC scan. . Use <code>--external-modules-download-path</code> to control the download location (defaults to <code>.external\_modules</code>). Requires outbound network access</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| <p><code>--external-modules-download-path</code></p><p><code>$CORTEX\_CODE\_EXTERNAL\_MODULES\_DOWNLOAD\_PATH</code></p>         | Specifies the directory to download external modules to. Defaults to `.external_modules`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| <p><code>--external-checks-dir</code></p><p><code>$CORTEX\_CODE\_EXTERNAL\_CHECKS\_DIR</code></p>                                | Local directory containing custom checks. The directory must be a Python package. This flag is repeatable and cannot be used with `--external-checks-git`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| <p><code>--external-checks-git</code></p><p><code>$CORTEX\_CODE\_EXTERNAL\_CHECKS\_GIT</code></p>                                | Git URL containing custom checks. Supports `//subdir` and `?ref=...`. This flag cannot be used with `--external-checks-dir`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| <p><code>--external-checks-public-key</code></p><p><code>$CORTEX\_CODE\_EXTERNAL\_CHECKS\_PUBLIC\_KEY</code></p>                 | <p>Path to a PEM-encoded ECDSA P-256 public key used to verify signatures for custom-check <code>.py</code> files.</p><p>When set, any tampered or unsigned file <strong>aborts the scan with exit code 2</strong> before any check runs.</p><p>Unset means no verification (backward-compatible)</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| <p><code>--output</code></p><p><code>$CORTEX\_CODE\_OUTPUT</code></p>                                                            | <p>Output format for reporting.</p><p>Supported formats: <code>cli</code>, <code>json</code>, <code>spdx</code>, <code>junitxml</code>, <code>sarif</code>, <code>cyclonedx</code>, <code>cyclonedx\_json</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| <p><code>--output-file-path</code></p><p><code>$CORTEX\_CODE\_OUTPUT\_FILE\_PATH</code></p>                                      | Specifies the output path for the scan result file                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| <p><code>--deep-analysis</code></p><p><code>$CORTEX\_CODE\_DEEP\_ANALYSIS</code></p>                                             | Enables or disables deep analysis of the Terraform plan and related files                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| <p><code>--repo-root-for-plan-enrichment</code></p><p><code>$CORTEX\_CODE\_REPO\_ROOT\_FOR\_PLAN\_ENRICHMENT</code></p>          | Enriches Terraform plan findings by mapping them to their original `.tf` files                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| <p><code>--skip-path</code></p><p><code>$CORTEX\_CODE\_SKIP\_PATH</code></p>                                                     | Specifies a path (file or directory) that should be skipped during the scanning process. This option is useful for excluding specific files or directories that are not relevant to the scanning analysis, increasing the efficiency and accuracy of scan results                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| <p><code>--compact</code></p><p><code>$CORTEX\_CODE\_COMPACT</code></p>                                                          | Do not display code blocks in the output                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| <p><code>--no-fail-on-crash</code></p><p><code>$CORTEX\_NO\_FAIL\_ON\_CRASH</code></p>                                           | See common flags for a description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| <p><code>--validate-secrets</code></p><p><code>CORTEX\_APPSEC\_VALIDATE\_SECRETS</code></p>                                      | Validate detected secrets against their respective services to confirm they are active. By default, this feature is disabled. Set `CORTEX_APPSEC_VALIDATE_SECRETS = true` to enable it                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| <p><code>--timeout</code><br><code>$CORTEX\_CODE\_TIMEOUT</code></p>                                                             | <p>Sets the maximum time the Cortex CLI will wait for triggered local scan processes to complete. Default value: 15 minutes.</p><p>Syntax:</p><ul><li><strong>To specify a duration</strong>: Use a numeric value followed by a unit (for example <code>--timeout 10m</code>)</li><li><strong>Default unit</strong>: Numeric values entered without a unit are interpreted as seconds. For example, <code>30</code> is equal to 30 seconds.</li><li><strong>Supported units</strong>: Milliseconds, seconds, minutes and hours</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `--start-commit`                                                                                                                 | Starting commit hash for git history scanning (Git Hook flag)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `--commit-list`                                                                                                                  | Comma-separated list of commit hashes to scan (Git Hook flag)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `--hook-event`                                                                                                                   | Git hook event type - pre-commit (Git Hook flag)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `--help`                                                                                                                         | See common flags for a description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/cortex-cloud-posture-management/cortex-cli/cortex-cli-for-code-security/cortex-cli-cortex-cloud-application-security-command-line-reference.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
