Reusable CI/CD templates for integrating Kusari Inspector security scanning into your GitLab and GitHub workflows. These templates automatically scan pull requests and merge requests for security vulnerabilities and post results as comments.
- Automated Security Scanning: Runs on every pull/merge request
- Auto-commenting: Posts scan results directly to PRs/MRs when issues are found
- SARIF Output: Generates industry-standard SARIF reports
- Configurable: Control failure behavior and comment posting
- Zero Setup: Just add secrets and include the template
Location: gitlab/kusari-scan-v1.yml
Usage:
# .gitlab-ci.yml
include:
- remote: 'https://raw.githubusercontent.com/kusaridev/kusari-ci-templates/v1/gitlab/kusari-scan-v1.yml'Required Setup:
-
Add CI/CD variables in GitLab (Settings > CI/CD > Variables):
KUSARI_CLIENT_ID: Your Kusari client IDKUSARI_CLIENT_SECRET: Your Kusari client secret (mark as masked)
-
For MR comments, choose one option:
- Option A (Recommended): Create a Project Access Token with
apiscope and add asGITLAB_TOKENvariable - Option B: Enable CI job token API access in Settings > CI/CD > Token Access
- Option A (Recommended): Create a Project Access Token with
See gitlab/kusari-scan-v1.yml for detailed configuration options.
Location: .github/workflows/kusari-scan-v1.yml
Usage:
Create .github/workflows/kusari-scan.yml in your repository:
name: Kusari Security Scan
on:
pull_request:
branches: [main, master]
jobs:
kusari-scan:
uses: kusaridev/kusari-ci-templates/.github/workflows/kusari-scan-v1.yml@v1
permissions:
contents: read
pull-requests: write # Required for PR comments
secrets:
KUSARI_CLIENT_ID: ${{ secrets.KUSARI_CLIENT_ID }}
KUSARI_CLIENT_SECRET: ${{ secrets.KUSARI_CLIENT_SECRET }}
with:
fail_on_issues: false # Optional: fail workflow on security issues
post_comment: true # Optional: post results as PR commentRequired Setup:
-
Add repository secrets (Settings > Secrets and variables > Actions):
KUSARI_CLIENT_ID: Your Kusari client IDKUSARI_CLIENT_SECRET: Your Kusari client secret
-
Ensure the workflow has
pull-requests: writepermission for commenting
See .github/workflows/kusari-scan-v1.yml for detailed configuration options.
| Option | GitLab | GitHub | Description | Default |
|---|---|---|---|---|
| Fail on issues | KUSARI_FAIL_ON_ISSUES |
fail_on_issues |
Fail pipeline/workflow when security issues found | false |
| Post comment | KUSARI_POST_COMMENT |
post_comment |
Post scan results as MR/PR comment | true |
| CLI image | KUSARI_CLI_IMAGE |
kusari_cli_image |
Override default Kusari CLI container image | Latest stable |
To use these templates, you need Kusari Inspector credentials:
- Sign up at https://us.kusari.cloud/signup
- Go to API Keys and Create a New Key with all inspector permisions (inspector_bundle_scan, inspector_result_user_read, and inspector_result_workspace_read)
- Copy the ID and secret into your
KUSARI_CLIENT_IDandKUSARI_CLIENT_SECRETrespectively - Add them to your CI/CD platform's secrets/variables
For air-gapped or self-hosted environments:
- Mirror
ghcr.io/kusaridev/kusari-clito your internal container registry - Copy the template files to your internal Git repository
- Update the
KUSARI_CLI_IMAGE/kusari_cli_imageto point to your internal registry - Include/reference from your internal location
- Documentation: https://docs.us.kusari.cloud/Inspector/
- Website: https://www.kusari.dev/inspector
This repository uses major version tags for easy updates:
- Use
@v1to always get the latest v1.x.x release - Use
@v1.0.1to pin to a specific version