> 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-cli/cortex-cli-for-code-security/cortex-cli-application-security-command-line-reference.md).

# Cortex CLI Application Security command line reference

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

{% hint style="info" %}

### Important

The Cortex CLI 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 252.

./cortexcli --api-base-url \<YOUR\_API\_URL> --api-key \<YOUR\_API\_KEY> --auth-id \<YOUR\_AUTH\_ID> --framework terraform --framework "terraform cloudformation"
{% endhint %}

| Command/Variable                                                                               | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ---------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>--source</p><p>$CORTEX\_CODE\_SOURCE</p>                                                    | The source of execution. Default source: CLI. Examples: Jenkins, GitHub Actions, CLI                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| <p>--repo-id</p><p>$CORTEX\_CODE\_REPO\_ID</p>                                                 | <p>Required for upload mode.</p><p>Identity string of the repository. Format <code>repo\_owner/repo\_name</code>.</p><p><strong>Note</strong></p><p>The repo-id flag must not end with <code>.config</code>, <code>.log</code> or <code>.ini</code>. <code>-config</code> is acceptable.</p><p><strong>Example</strong></p><p><code>--repo-id foo.config</code> will be blocked</p><p><code>--repo-id foo-config</code> will pass</p><p>To retrieve the repository ID, under <strong>Inventory</strong>, navigate to <strong>All Assets</strong> → <strong>Repositories (under Code)</strong> → <strong>select a repository</strong> → <strong>copy the Asset ID value from the Properties section of the side card</strong>.</p>                                                                                                                                                                                                                                       |
| <p>--branch</p><p>$CORTEX\_CODE\_BRANCH</p>                                                    | <p>Required for upload mode.</p><p>Path to custom CA certificate (bundle) file for corporate proxy/TLS interception environments</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| <p>--directory</p><p>$CORTEX\_CODE\_DIRECTORY</p>                                              | <p>Required.</p><p>The directory path to scan. Cannot be used together with <code>--file</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| <p>--file</p><p>$CORTEX\_CODE\_FILE</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>--var-file</p><p>$CORTEX\_CODE\_VAR\_FILE</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 [Introduction to Terraform for Cloud service provider (CSP) onboarding](/cortex-cloud-posture-management/onboard-and-configure/deployment-steps-and-checklist/cloud-service-provider-csp-onboarding/introduction-to-terraform-for-cloud-service-provider-csp-onboarding.md) for more information                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| <p>--framework</p><p>$CORTEX\_CODE\_FRAMEWORK</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>--skip-framework</p><p>$CORTEX\_CODE\_SKIP\_FRAMEWORK</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>--ca-certificate</p><p>$CORTEX\_CODE\_CA\_CERTIFICATE</p>                                   | See common flags for more information                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| <p>--no-cert-verify</p><p>$CORTEX\_CODE\_NO\_CERT\_VERIFY / $NO\_CERT\_VERIFY</p>              | This flag disables TLS/SSL certificate verification (default: false). Skips TLS certificate verification when connecting to the API. **Not recommended for production**. Use only in test or development environments, as this reduces connection security                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| <p>--summary-position</p><p>$CORTEX\_CODE\_SUMMARY\_POSITION</p>                               | Sets a position for displaying the summary information relative to the findings. Values: `top`, `bottom`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| <p>--upload-mode</p><p>$CORTEX\_UPLOAD\_MODE</p>                                               | Upload mode determines the method or mode used to upload data. See common flags for more information                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| <p>--external-modules-download-path</p><p>$CORTEX\_CODE\_EXTERNAL\_MODULES\_DOWNLOAD\_PATH</p> | Specifies the directory to download external modules to. Defaults to `.external_modules`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| <p>--output</p><p>$CORTEX\_CODE\_OUTPUT</p>                                                    | <p>Output format for reporting.</p><p>Supported formats: cli, json, spdx, junitxml, sarif, cyclonedx, cyclonedx\_json</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| <p>--output-file-path</p><p>$CORTEX\_CODE\_OUTPUT\_FILE\_PATH</p>                              | Specifies the output path for the scan result file                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| <p>--deep-analysis</p><p>$CORTEX\_CODE\_DEEP\_ANALYSIS</p>                                     | Enables or disables deep analysis of the Terraform plan and related files                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| <p>--repo-root-for-plan-enrichment</p><p>$CORTEX\_CODE\_REPO\_ROOT\_FOR\_PLAN\_ENRICHMENT</p>  | Enriches Terraform plan findings by mapping them to their original `.tf` files                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| <p>--skip-path</p><p>$CORTEX\_CODE\_SKIP\_PATH</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>--create-repo-if-missing</p><p>$CORTEX\_CODE\_CREATE\_REPO\_IF\_MISSING</p>                 | <p>Determines whether the system should create a repository if it is missing. This option allows users to automate the creation of repositories as needed and ensure that all required repositories are available for scanning.</p><p>For example, when running automated scans or integrating with version control systems, enabling <code>--create-repo-if-missing</code> can help maintain consistency and prevent disruptions due to missing repositories</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| <p>--compact</p><p>$CORTEX\_CODE\_COMPACT</p>                                                  | Do not display code blocks in the output                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| <p>--no-fail-on-crash</p><p>$CORTEX\_NO\_FAIL\_ON\_CRASH</p>                                   | See common flags for a description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| <p>--var-file</p><p>$CORTEX\_CODE\_VAR\_FILE</p>                                               | Variable files to load in addition to the default files. Currently only supported for source Terraform (.tf file) and Helm chart scans                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| <p>--validate-secret</p><p>$CORTEX\_APPSEC\_VALIDATE\_SECRETS</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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| --timeout                                                                                      | <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-cli/cortex-cli-for-code-security/cortex-cli-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.
