HawkScan CI Skill
This skill graduates a working local HawkScan setup into a CI/CD
pipeline. It is a wrapper around the local-scan path the hawkscan
skill owns — it never generates stackhawk.yml, never picks auth
recipes, never parses findings. Its scope is the pipeline file alone.
Hand-off rule: if stackhawk.yml doesn't exist or doesn't validate,
the agent must invoke the hawkscan skill first. This skill does not
onboard apps from scratch.
Step 0: Hand-off Check
Before doing anything CI-specific, confirm the local scan path is in
place. Run:
test -f stackhawk.yml || echo "MISSING_CONFIG"
timeout 30 hawk validate config stackhawk.yml 2>&1 | head -20
If stackhawk.yml is missing, validation fails, or applicationId is
still a placeholder (${APP_ID} with no real value, or literal
your-app-id):
"I need a working local scan first. Run the hawkscan skill (or
invoke it explicitly) to generate and validate
stackhawk.yml, then
come back here."
Stop. Do not proceed. That message is the entire output: do not preview
the pipeline (no action names, images, secrets, triggers, or workflow
snippets) — the provider and shape are decided only once stackhawk.yml validates.
Step 1: Detect the CI Provider
Glob the repo for known CI config locations:
ls .github/workflows/*.yml .github/workflows/*.yaml 2>/dev/null
ls .gitlab-ci.yml 2>/dev/null
ls Jenkinsfile* 2>/dev/null
ls .circleci/config.yml 2>/dev/null
ls azure-pipelines*.yml 2>/dev/null
ls bitbucket-pipelines.yml 2>/dev/null
ls .buildkite/pipeline.yml 2>/dev/null
ls .travis.yml 2>/dev/null
ls -d bamboo-specs 2>/dev/null
ls concourse/*.yml 2>/dev/null
ls -d harness 2>/dev/null
ls appspec.yml buildspec.yml 2>/dev/null
| Match | Provider |
|---|---|
| .github/workflows/*.yml, *.yaml | GitHub Actions |
| .gitlab-ci.yml | GitLab CI/CD |
| Jenkinsfile, Jenkinsfile.* | Jenkins |
| .circleci/config.yml | CircleCI |
| azure-pipelines*.yml | Azure Pipelines |
| bitbucket-pipelines.yml | Bitbucket Pipelines |
| .buildkite/pipeline.yml | Buildkite |
| .travis.yml | Travis CI |
| bamboo-specs/ | Bamboo |
| appspec.yml, buildspec.yml | AWS CodeBuild / CodeDeploy |
| concourse/*.yml (heuristic — confirm with user) | Concourse |
| harness/ | Harness |
- One match → use it.
- Multiple matches → ask: "I see CI config for both X and Y in this repo. Which one should HawkScan run from?"
- No matches → ask: "I don't see any CI config in this repo. Which provider do you want to add HawkScan to? (GitHub Actions, GitLab, Jenkins, CircleCI, ...)"
Step 2: Plan the Integration
Three planning questions. Use the defaults if the user just says "sounds good".
2a. Trigger — when should the scan run?
"On pull requests, on pushes to main, on a daily schedule, or all three? Default: PRs + push to main."
2b. Blocking behavior — what happens on findings?
"Should findings above the configured threshold fail the pipeline (exit code 42 → build failure), or warn-only (log the result, exit 0)? Default: fail the pipeline."
2c. Job placement — where does the scan fit?
"Standalone parallel job (scans an ephemeral env or already-deployed preview), or chained after build (starts the app in the same job and scans it)? Default: chained-after-build."
These answers parameterize Step 5.
Step 3: Establish the API Key Secret
The skill never sets the secret itself. Prompt the user and tell
them exactly where to put it.
Ask once:
*"Where should
HAWK_API_KEYcome from at runtime? Most teams use
their CI provider's built-in secret store (recommended). If your org
requires an external secrets manager (Vault, AWS Secrets Manager,
GCP Secret Manager, Azure Key Vault, 1Password, Doppler), tell me
which one and I'll generate the workflow to fetch from it instead."*
Path A — CI-native secret store (default)
Print the exact command/UI step the user needs to run:
| Provider | Command / UI |
|---|---|
| GitHub Actions | gh secret set HAWK_API_KEY (paste interactively), or Settings → Secrets and variables → Actions |
| GitLab CI/CD | glab variable set HAWK_API_ID <id> --masked --protected AND glab variable set HAWK_API_SECRET <secret> --masked --protected — mandatory key split (GitLab's masker can't handle the . separators in hawk.<id>.<secret>). Reassemble in the job: API_KEY="hawk.${HAWK_API_ID}.${HAWK_API_SECRET}" |
| Jenkins | Credentials Store → Add credential → "Secret text", ID HAWK_API_KEY (UI only) |
| CircleCI | circleci context store-secret <context-name> HAWK_API_KEY (org-scoped Contexts), or Project Settings → Environment Variables (UI) |
| Azure Pipelines | az pipelines variable create --name HAWK_API_KEY --secret true, or variable group |
| Bitbucket | Repository Settings → Repository variables → add HAWK_API_KEY, check "Secured" |