This repository demonstrates how to integrate the Lacework FortiCNAPP Inline Scanner into a GitHub Actions CI pipeline to scan Docker images for vulnerabilities, enforce security policies, and block risky images from being published.
This demo shows how to:
- Scan Docker images automatically during PRs
- Comment scan results directly on pull requests
- Enforce vulnerability policies (warn or block)
- Push only secure images to GitHub Container Registry (GHCR)
- Click "Use this template" at the top-right of this repo.
- Name your new repository.
- Clone it or start editing online.
Before you can scan images, create an Inline Scanner integration in Lacework:
- Go to your Lacework console.
- Navigate to:
Settings→Container Registries. - Click + Add New, and choose Inline Scanner.
- After creating it, click the entry to reveal your access token.
Set the following secrets in your GitHub repo under Settings → Secrets and variables → Actions:
| Secret | Description |
|---|---|
LW_ACCOUNT_NAME |
Your tenant name (e.g. <tenant>.lacework.net) |
LW_ACCESS_TOKEN |
The access token from the scanner integration |
To enforce secure workflows:
- Go to Settings > Branches.
- Add a branch protection rule for
main. - Enable:
- ✅ Require pull request before merging
- ✅ Require status checks to pass
- ✅ Include your Lacework scan job name (e.g.,
build-scan-push)
In your Dockerfile, set a known vulnerable base:
FROM alpine:3.10Commit this to a new branch and open a pull request.
The GitHub Action will:
- Build the image
- Scan it with Lacework
- Comment the scan results on the PR
To make GitHub Action fail on policy violations:
- In the Lacework console, go to
Policiesand filter forVulnerabilities: Build Time. - Locate
LW_CONTAINER_POLICY_3: Critical, fixable CVEs. - set Action on failure to
Block
Now, when you push to the PR again (e.g. minor edit), the scan will:
- Still comment results
- Now fail the CI job
- Block merging
Update the Dockerfile to a patched base image:
FROM alpine:3.19This version includes a fixed version of zlib and other patched packages.
Push the change. The scan should:
- Detect no policy violations
- Pass the job
- Allow merging the PR
Note: there are still vulnerabilities found, but none in violation of my FortiCNAPP Policy set in Block for Criticial CVE's with available Fixes.
Once merged to main, GitHub Actions will:
- Re-scan the image
- Log in to GHCR
- Push it with tags like
:latest,:v1.0.0, and the commit SHA
- Scans run for every PR, but images are pushed only on merge to
main. - Comments are posted regardless of scan pass/fail.
- Builds are blocked if policy detects fixable critical CVEs.
Open an issue in this repo or contact your internal security team to set up Lacework integrations and policies.



