Repository navigation
Security scanning explained
What this is. security.yml runs eight kinds of scan, plus Trivy inside the
container release. Each catches a different class of problem, and none of them
catches what another does. This page says what each one finds, where the result
lands, how to dismiss a finding without lying to yourself, and what has been
measured about the awkward parts. The inputs are on the
security workflow page.
The threat is a secret or a compromise leaving a CI job, and the ways in differ: a vulnerable line of your own code, a credential committed years ago, a dependency with a published advisory, a dependency added today under a licence you cannot ship, a workflow file that can be injected, a project whose practices an outsider would distrust. One tool per class, each reporting to the same place.
| Scan | What it catches | Misses | Where it lands |
|---|---|---|---|
| CodeQL | Flaws in your own code by data flow: injection, unsafe deserialization, path traversal. The actions language reads your workflow files for the same, such as an untrusted value reaching a shell |
Anything that is not a pattern its queries know; logic bugs | Code scanning, category /language:<lang>
|
| gitleaks | A credential shape anywhere in the full git history, not just the latest commit. The pinned binary (MIT; no licence key under any account) exits 1 on a finding and uploads SARIF | A secret in a shape it has no rule for; a secret outside git | Code scanning, category gitleaks
|
| Dependency audit | A dependency version with a published advisory. pip-audit reads your requirements file with --strict; audit-command runs npm audit, govulncheck, cargo audit or similar |
An advisory not yet published; your own code | The job log and exit code (a gate) |
| Dependency review | On a pull request only: a dependency the change adds or bumps that is vulnerable at moderate or above, or under a denied licence (AGPL, GPL, LGPL-3.0, SSPL by default) |
Anything already in the base branch | A comment on the pull request |
| Semgrep | Pattern rules: p/github-actions, p/secrets, and p/python when Python exists. Catches things like a world-writable chmod or a risky workflow construct |
What no rule describes. There is no p/bash pack (measured, issue #66: a 404), so ShellCheck in bash-ci covers shell |
Code scanning, category semgrep
|
| Snyk Code | A second opinion on your source, from a different engine | Needs SNYK_TOKEN; runs on a trusted ref only |
Code scanning (SARIF) |
| Snyk Open Source | Vulnerable dependencies, scanned from a pip freeze of what the lock installed |
Same token; see below | Code scanning (SARIF) |
| OpenSSF Scorecard | An outside opinion of the repository's practices: pinned dependencies, branch protection, a security policy, fuzzing, signed releases | It scores the repository, not the code | Code scanning and the public Scorecard record; default branch only |
Trivy (an image scan for CRITICAL and HIGH findings) lives in container-release, and a configuration scan in tofu-ci; both upload SARIF too. Fuzzing is python-fuzz.
Every scan above looks at the code as it was when it merged. An advisory published next month
is not in any of those results. verify-published takes it up
with rescan: true: a pinned Trivy reads today's vulnerability database and scans each
platform of the published image and the release's sbom.cdx.json, failing at rescan-severity.
It finds known advisories against the packages the image or the SBOM names. It cannot find a
flaw nobody has reported, a package the SBOM leaves out, or anything in code you wrote
yourself. It is off by default and is only a rescan when the caller schedules it. The accepted
advisories it skips are the ones in the risk register, and
the weekly audit fails on one that is not there.
The checks above look at code and dependencies. A skill, a role file or an MCP tool description is neither: it is text an agent
obeys. agent-scan is an optional, advisory pass over that text with two static scanners from Cisco AI
Defense. It catches the blunt cases (a planted injection phrase, curl | bash, a credential read, a hidden instruction in a tool
description) and is blind to text that is harmful only in meaning. Off until you name paths; reports to code scanning under the
categories agent-scan-skill and agent-scan-mcp.
Everything in the table reads code or metadata. dast is the one check that starts the service and talks to it, with OWASP ZAP, and it is three scans in one workflow because each sees a different class of problem:
scan-type |
Sees | Blind to | Cost |
|---|---|---|---|
baseline |
What a client sees: headers, cookies, banners, information in responses. Passive; no attack traffic | What the server does with its input | About a minute |
full |
The baseline, then every URL and parameter the spider found under ZAP's active rules: cross-site scripting, SQL and command injection, path traversal and the rest | Operations no link reaches; anything behind a login, unless a context file and user sign the scan in | Minutes; bounded by active-scan-minutes
|
api |
Every operation an OpenAPI, SOAP or GraphQL definition declares, under the active rules, plus unexpected status codes and content types | Operations the definition leaves out | Minutes |
The reason to run it beside CodeQL and Semgrep is that they match patterns in code
they can see, and ZAP's active scan needs no pattern: it does what an attacker does
to the running service, with its real framework, configuration and middleware in the
path. A reflected cross-site scripting hole in fixture/dast/server.py passes the
baseline (every header is right) and fails the full scan at high; that is the proof
the dast-live CI job holds. Findings land in code scanning under category zap (or the
sarif-category the caller sets), tagged zap-<scan-type> so the tab says which scan
found each one.
A login hides most of a real application from the spider, and the active rules cannot attack a page the
spider never saw. context-file and context-user hand ZAP a committed context (the URLs in scope, the login
method, the users) and the name of the user to scan as, and the spider and the active scan run signed in; all
three scan types take them, which was read from ZAP's scripts in the pinned image and then shown with a live
test. The fixture proves it both ways: with --login the same reflected cross-site scripting hole sits behind
a form login, the anonymous full scan passes it at high, and the signed-in one fails at high. The credentials
in a context file are committed, so they are a throwaway account's on the service the job started and nothing else. Because
ZAP sends them to the URLs the file names, the file is parsed as XML (a grep for the URL is how a CDATA section got past an
earlier version) and refused unless every sign-in URL is loopback after decoding and normalising, with no credential in a URL,
and the credentials are masked in the log and redacted from every uploaded report.
The scans send attack payloads, which is why the workflow refuses any target that is not loopback: the service under test is the one the job started, never a shared staging host and never production. A scan of a deployed environment, with real integrations behind its login, is a different thing with different risks; it is on the Roadmap as work for a self-hosted runner.
Snyk is a reporter here, not a gate: its findings go to the Security tab and the
job fails only when Snyk did not run (an expired token, a project it could not read).
CodeQL and the dependency audit are the gates. It runs weekly and on manual dispatch
by default (snyk-on: schedule): the free plan meters tests per month across the
account, and a push-triggered run in each of ten repositories spent a month's Snyk
Code tests in one day (2026-10-04, 34 runs).
Every job has contents: read and a few have more:
| Job | Extra grant | Why |
|---|---|---|
| CodeQL, gitleaks, Semgrep | security-events: write |
To upload SARIF |
| Dependency review | pull-requests: write |
To post its summary comment |
| Snyk |
security-events: write, id-token: write
|
SARIF, and the Doppler fetch for SNYK_TOKEN
|
| Scorecard |
security-events: write, id-token: write
|
SARIF, and publishing the result with the job's identity |
| Dependency audit | none | Reads a file |
gitleaks holds no id-token and fetches nothing from Doppler: since issue #90 it
runs the binary, not the licence-gated action, so there is no credential in that job.
Open the repository's Security tab, then Code scanning. Each scanner uploads a
SARIF file under its own category (gitleaks, semgrep, the CodeQL language
categories, and so on). GitHub tracks an alert per category and per ref, and closes it
only when a later analysis of the same category and ref omits it.
That last sentence has a consequence measured on 2026-10-04 in a repository that
had moved to this workflow: 29 alerts showed as open on main after every underlying
issue was fixed. 25 of them belonged to the old, deleted CodeQL workflow's categories
(/language:python and the like). A retired category is never analysed again, so its
alerts never close. Fix: list the open alerts' analysis_key, find keys of
workflows that no longer exist, and delete that category's last analysis on main
(gh api -X DELETE "repos/O/R/code-scanning/analyses/<id>?confirm_delete"). The same
README lesson: the pull request check summary says "1 configuration not found" until
the deletion has happened; trust that, not the analysis list.
A finding has three honest outcomes: fix it, mark it as accepted with a reason, or dismiss it as not applicable with a reason. A dismissal is a statement other people will read months later, so it must cite the code, not the mood.
- Fix at the root cause, with a test that fails first. The 2026-10-04 sweep fixed every real finding this way across five repositories.
- Dismiss in the Security tab with one of GitHub's reasons (false positive, won't fix, used in tests) and a comment of at most 280 characters that names the file, the line and why the pattern is intended ("0660 because GeoClue reads this socket as a different user; decision D-069"). "Not a real issue" is not a reason.
-
For Semgrep, also mark the source so the next scan does not re-raise it.
Measured with Semgrep 1.179 against a real rule on 2026-10-05:
- The bare
# nosemgrep,# nosemgrep: <rule-id>and the previous-line form all work and arrive in the SARIF assuppressions: inSource. -
# nosemgrep: <free text>suppresses nothing: the text is read as a rule id. Put the reason in a separate comment. - An alert that was opened before the marker existed stays open until it is dismissed by hand. Add the marker with its reason, then dismiss the old alert citing it.
-
Not settled: whether GitHub opens a new alert for a result the SARIF marks as
suppressed. In two callers a marker was present and an alert still appeared on the
next run (issue #83, open). Local Semgrep honours the marker; what GitHub does with
the
suppressionsfield was not measured in the reusable workflow. Until it is, a caller dismisses such an alert by hand with the reason.
- The bare
- For an advisory that cannot be fixed yet (the newest release is the affected one), use the risk register: a reason, what limits the exposure, an owner and an expiry at most 90 days out. An ignore flag in a workflow with no register entry fails the weekly audit.
CodeQL has no in-source suppression marker comparable to nosemgrep that this repository
relies on; dismissal in the Security tab is the route. Whether a dismissed CodeQL alert
re-opens after a refactor moves the line was not measured for this page.
By default a pull request's gitleaks scan covers that pull request's own commits plus the tree
(gitleaks-scope: pr-commits). The opt-in gitleaks-scope: all-refs reads every ref in the clone, and then one
key-shaped fixture on an unmerged branch fails the scan on every other pull request in the repository:
| Event |
all-refs (opt-in) |
pr-commits (default) |
|---|---|---|
pull_request |
every ref | the commits of the pull request (base..head) plus the checked-out tree |
push (the default branch included) |
every ref | every ref |
schedule, workflow_dispatch, anything else |
every ref | every ref |
| any event, any other value of the input | the job fails | the job fails |
base..head is the commits reachable from the head and not from the base. A key committed and then reverted inside the
pull request is in that range, so it stays caught. The narrowing never applies to a push or a schedule, so the default
branch is still scanned in full. If the base or head is not a full commit id present in the clone, the job fails rather
than scanning less.
A tree scan has no commit, so it matches only the path-and-rule form of a .gitleaksignore entry (file:rule:line). The form
gitleaks writes for a history finding, commit:file:rule:line, hides the finding in the history scan but not in the tree scan,
and a rebase or squash changes the commit id. The scan is as strict as before; what changed is which entries can match. The
job lists the commit-bound entries it finds in the base commit's .gitleaksignore (line number, file, rule; never the commit
or a value) and never rewrites them. Migrate by dropping the commit id, by allowlisting the path and rule in .gitleaks.toml
with a reason, or by setting gitleaks-scope: all-refs.
| Event | Configuration and ignore file the scans use | Root .gitleaksignore of the checkout |
|---|---|---|
pull_request (either scope) |
the base commit's .gitleaks.toml (scanner defaults if none) and .gitleaksignore, copied outside the workspace |
replaced by the base's copy, or removed |
| any other event | the checked-out .gitleaks.toml, as before |
left as checked out |
Configuration source, in both scopes: on a pull_request event the scan reads .gitleaks.toml and .gitleaksignore from the base commit (copied outside the workspace and passed explicitly), never from the pull request's own tree, so a pull request cannot allowlist its own secret. With no config on the base, the scanner defaults apply. gitleaks also applies a .gitleaksignore at the root of the scanned tree whatever the ignore-path option says (measured with the pinned binary, for the git and the dir scan), so on a pull request that root file in the throwaway checkout is replaced by the base's copy, or removed when the base has none; both scans then use the base's. A pull request that changes either file gets a warning naming it. A pull request that edits those files is scanned with the old version until it merges; a base config that extends another file by relative path is not supported on a pull request. Other events use the checked-out file, as before. The canary runs the same command shape and the same configuration as the real scan, so a config that hides the planted key fails it.
What pr-commits does not see, so that nobody assumes more: a key in a commit that is already in the base history
(the scan after the merge, or an earlier scan of that branch, covers it); a key on another unmerged branch (found when that
branch has its own pull request); a key that only a merge-conflict resolution introduces and a later commit removes (git
shows no patch for a merge commit; the tree scan sees it only while it is still in the tree); and a commit force-pushed away
before the scan ran. Also: an empty range (base equal to head, or a head already in the base) leaves only the tree scan; tags and notes outside base..head; a workflow re-run uses the original event payload; an inline gitleaks:allow comment in the pull request's own files is honored (the scanner's --ignore-gitleaks-allow would also fail legitimate allow comments, so it is not passed); the generated gitleaks.sarif lies in the workspace while the tree scan walks it (redacted); and the tree scanned is GitHub's merge-preview checkout, not the literal head tree. The tree scan reports in the job log and is not uploaded as SARIF. Protect .gitleaks.toml and .gitleaksignore with CODEOWNERS and branch protection, because a change to them takes effect after the merge.
The default gitleaks rule discord-api-token matches a 64-character hex value on a line that mentions discord. A
SHA-256 in an asset manifest ("discord.svg": "<sha256>") has exactly that shape, so any repository that records asset
hashes can hit it (seen on 2026-11-05 in a static-site repository). gitleaks-hash-manifest-paths lists the manifest
files, one repository-relative path per line (default empty: no allowlist), and the job adds one allowlist for them:
Condition (all must hold, condition = "AND") |
Value |
|---|---|
| rule |
discord-api-token only (targetRules) |
| value | exactly 64 lowercase hex characters (^[a-f0-9]{64}$) |
| path | one of the listed files, matched whole (^path$, dots escaped, no globs) |
So the same hash in an unlisted file and any other rule in a listed file are still reported, in the history scan and the
tree scan. The allowlist is a small overlay config that extends the configuration the scan
already uses, which on a pull request is the base commit's .gitleaks.toml (see the table above): a pull request cannot
allowlist itself by editing its own config. Note what it does not protect: the list is an input of the caller's workflow
file, and a pull request can edit that file in the same-repository case, so protect the workflow files with CODEOWNERS and
branch protection as for any other input. An unusable line (a glob, a space, .., an absolute path, a quote) or more than
100 paths fails the job; the error never echoes the value.
- It never runs Snyk (or any token-holding scanner) on a pull request.
- It never reports "skipped" as "scanned": a repository with nothing Snyk can read gets a
warning, and a missing
fuzz/directory for a caller that opted into fuzzing is a failure. - It never skips the scan's own test: the gitleaks job plants an AWS-shaped key in a scratch repository first and fails if its own invocation does not exit 1 on it, because a check nobody can see fail is worse than none.
Generated from docs/wiki/ at commit f3af2fa0bae3. Do not edit this wiki: the next push to main replaces every page. Corrections go to docs/wiki/ by pull request.
GYST
- Home
- Why GYST exists
- Getting started
- Design rules
- Secrets: Doppler and OIDC
- Security scanning explained
- The baseline and the weekly audit
- Releases and supply chain
- Keeping a project board current
- Adopting GYST in your own project
- Glossary
- Roadmap
Learn and contribute
- Learning path
- Which workflow do I need?
- Repository map
- Egress control
- Troubleshooting
- Lessons learned
- Testing and the contract
- Contributing and developing
- Maintaining this wiki
- Verify main
- FAQ
CI
Security
Release
- container-release
- python-docker-release
- python-package-release
- artifact-release
- verify-published
- base-image-digest
Docs and project
- docs-pages
- wiki-publish
- project-sync
- threat-model
- lory-audit
- agent-scan
- token-drift
- node-typecheck
- pr-title-lint
- vendored-drift
- upstream-sync
- repin
- pin-comments
Tools