Cortex CLI pre-receive hooks
Integrate the Application Security secrets scanner as pre-receive hook into your workflows installing the Cortex CLI. The hook runs on the remote server before changes are pushed, allowing you to enforce checks before code is accepted into version control.
Supported version control systems: Pre-receive hooks are supported for GitHub Enterprise, GitLab self-managed, and Bitbucket Data Center. To setup pre-receive hook on these platforms refer to Setup on third-party platforms below.
Pre-receive hook workflow setup
Install the pre-receive hook.
Setup requirements
Configure credentials
It is recommended to configure credentials for the Application Security Cortex CLI using a configuration file, instead of embedding them directly in the hook script.
Configure credentials: Open the
.cortex.yamlfile in the~/.cortexcli/directory and add the following configuration parameters:CORTEX_API_BASE_URL: <API base URL>CORTEX_API_KEY_ID: < API key ID >CORTEX_API_KEY: < API key>
Setup on third-party platforms
To set up the Cortex CLI as a pre-receive hook on supported third-party platforms, refer to the official vendor documentation:
GitHub Enterprise: About pre-receive hooks
GitLab self-managed: Git server hooks
Bitbucket Enterprise: Using repository hooks
Reference script
Use the script below as reference to extend or modify your existing pre-receive hooks in your VCS provider.
Last updated
Was this helpful?
