Before you begin, ensure the following:
Once confirmed, a unique ZT_Token will be generated. This token is used to start scans CI/CD for its associated target from the Ci/CD.
.github/workflows/scan.yml
).Use the following example as a starting point for your workflow configuration. In this guide, for example purposes we're using the workflow_dispatch
trigger, which allows you to manually initiate the workflow from the GitHub interface. However, you're free to replace this with any other trigger supported by GitHub Actions, such as push
, pull_request
, or scheduled events, depending on your automation needs.
name: ZeroThreat Vulnerability Scan Action
on:
workflow_dispatch:
permissions:
contents: read
issues: write
pull-requests: write
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Custom Action for Vulnerability Scan
uses: zerothreatai/github-action@0.0.3
with:
ZT_TOKEN: ${{ secrets.ZT_TOKEN }}
WAIT_FOR_ANALYSIS: true
WAIT_FOR_ANALYSIS
Input:true
– The GitHub Action will wait for scan completion by polling every 5 minutes and the pipeline will keep running.false
(default) – The scan is triggered and the workflow ends immediately.It is recommended and advised to use the ZT_TOKEN as Github Secret and avoid hardcoding or exposing it.
ZT_TOKEN
and paste the value generated from ZeroThreat and click "Add Secret".Since this example uses workflow_dispatch
, you can manually start a scan:
The workflow will begin and a scan will be triggered in ZeroThreat portal.
To automate scans on every code change, you can replace the on:
block in the workflow with:
on:
push:
branches: [main]
pull_request:
branches: [main]
This will trigger ZeroThreat scans automatically for pushes or pull requests to the main
branch.
Issue | Solution |
---|---|
ZT_TOKEN not recognized | Make sure in the workflow yml file the input is named asZT_TOKEN . |
Scan doesn’t trigger | Check your on: conditions and CI permissions. |
Authenticated scan fails | Make sure a valid login template is selected in ZeroThreat and credentials are valid. |
Finished setting up your CI/CD integration?
Head over to our guide on Reviewing Scan Reports to learn and analyze different sections of the scan report.