06 · The security floor
Every failure so far was soft: at observe the gate reports a broken rule and still passes. Two checks never work that way. A vulnerable dependency or a leaked secret fails the gate at every rung, and no label waives it.
You will learn
- What the security floor is, and why it blocks from day one
- What a failing dependency review looks like, and how to fix it
- Why the exemption label is ignored here
Why two checks are different
Most mistakes can wait. An untracked TODO that merges is fixed in the next pull request, and nobody is hurt in between. That is why the gate starts at observe and only reports them.
Two mistakes cannot wait, because merging them is the damage:
- A dependency with a known vulnerability. Once it is on
mainit can be deployed, and the advisory is public, so attackers know what to look for. Reverting afterwards does not undo what ran. - A secret in a commit. Once it is pushed it is in the history, and in every clone and fork. Deleting it does not help; the credential has to be rotated.
New term Security floor
The two checks in the gate that are not on the enforcement ladder: dependency review (does this pull request add a dependency with a known vulnerability?) and the secret scan (does it add a credential?). Both fail the gate at every rung, observe included, and no label waives them.
Add an old dependency
Group step 05's country table by initial with lodash, pinning an old version the way a copied snippet or a stale lockfile does:
$ git checkout -b feat/directory $ pnpm add [email protected] --save-exact $ pnpm add -D @types/lodash $ curl -fsSL --remote-name-all --output-dir src "https://raw.githubusercontent.com/moelzanaty3/redline-demo/step-06/src/{directory,directory.test}.ts" $ pnpm test
The file you downloaded:
import groupBy from 'lodash/groupBy.js'
import { COUNTRIES, type Country } from './countries.js'
export function countriesByInitial(): Record<string, Country[]> {
return groupBy(COUNTRIES, (country) => country.name.charAt(0))
}
The tests pass. Nothing about the code is wrong; the version is. Commit, push and open a pull request:
$ git add -A $ git commit -m "feat: group countries by initial" $ git push -u origin feat/directory $ gh pr create --title "feat: group countries by initial" --body-file .github/pull_request_template.md $ gh pr checks --watch
Tick the ## Launch readiness boxes that hold, as in step 02.
What the pipeline says
$ gh pr checks ✓ test ✓ redline-gate / Deterministic policy ✓ redline-gate / PR checklist ✓ redline-gate / ADR required for significant changes X redline-gate / Dependency review ✓ redline-gate / Secret scan (diff) X redline-gate / gate
Open redline-gate / Dependency review. The job is GitHub's dependency-review-action, and its log has three parts:
# from the Dependency review job ▼ Vulnerabilities package.json » [email protected] – Command Injection in lodash (high severity) ↪ https://github.com/advisories/GHSA-35jh-r3h4-6jhm package.json » [email protected] – lodash vulnerable to Code Injection via `_.template` imports key names (high severity) ↪ https://github.com/advisories/GHSA-r5fr-rjxr-66jc Error: Dependency review detected vulnerable packages. ▼ Scorecard npm/lodash: OpenSSF Scorecard Score: 6.5 npm/@types/lodash: OpenSSF Scorecard Score: undefined ▼ Dependency Changes File: package.json + [email protected] + @types/lodash@^4.17.26
- Vulnerabilities is the verdict: every package the pull request adds or changes, checked against GitHub's advisory database. Two
highadvisories, each with a link that says what an attacker can do and which version fixes it. - Scorecard is context, not a verdict: the OpenSSF Scorecard rates how a package is maintained, out of 10.
undefinedmeans it has not been scored. - Dependency Changes is what the pull request changed in
package.json, so you can see exactly what the verdict is about.
fail-on-dependency-severity: high in .github/workflows/redline.yml sets the threshold: moderate advisories are reported without failing.
# from the gate job Error: Redline gate failed on security checks (not label-exemptible, and not on the enforcement ladder): dependency-review
Compare step 02: there, a failing job left the gate green. Same rung, opposite result, because this failure is on the floor.
redline-exempt is the label that waives a failing process check. Step 01's init created it in your repository. Add it, and let the gate run again:
$ gh pr edit --add-label redline-exempt $ gh pr checks --watch
# from the gate job Soft-fail label present: redline-exempt Error: Redline gate failed on security checks (not label-exemptible, and not on the enforcement ladder): dependency-review
The gate sees the label and fails anyway. Exemptions (step 08) cover process checks only. Take the label off again:
$ gh pr edit --remove-label redline-exempt
Private repository Dependency review says Skipped
If you handed dependency checks to Dependabot in step 01, the job does not run, and the pull request is green:
$ gh pr checks ✓ test ✓ redline-gate / Deterministic policy ✓ redline-gate / PR checklist ✓ redline-gate / ADR required for significant changes - redline-gate / Dependency review skipping ✓ redline-gate / Secret scan (diff) ✓ redline-gate / gate
This is the trade-off step 01 described, now on a real change. Nothing in the pull request stops lodash 4.17.20. If it merged, Dependabot would raise an alert on main and open a pull request for a safe version, after the vulnerable one could already have shipped. You know the version is vulnerable, so fix it before merging anyway.
The dependency graph and Dependabot alerts being on in Settings → Advanced Security does not change this: the gate's dependency review needs GitHub Code Security on a private repository. To watch it block, make the repository public, or switch on Code Security, then put the job back and push:
$ pnpm redline init --integrations "" --no-commit $ git add -A $ git commit -m "chore: run dependency review in the gate again" $ git push
$ npx redlinegate init --integrations "" --no-commit $ git add -A $ git commit -m "chore: run dependency review in the gate again" $ git push
$ yarn redline init --integrations "" --no-commit $ git add -A $ git commit -m "chore: run dependency review in the gate again" $ git push
$ bun run redline init --integrations "" --no-commit $ git add -A $ git commit -m "chore: run dependency review in the gate again" $ git push
Fix it
Upgrade past both advisories, on the same branch:
$ pnpm add [email protected] --save-exact $ pnpm test $ git commit -am "fix(deps): lodash 4.18.1" $ git push $ gh pr checks --watch ✓ test ✓ redline-gate / Deterministic policy ✓ redline-gate / PR checklist ✓ redline-gate / ADR required for significant changes ✓ redline-gate / Dependency review ✓ redline-gate / Secret scan (diff) ✓ redline-gate / gate
Deleting the dependency would have fixed it too: Object.groupBy, in Node 21 and later, does the same job with no package at all.
Merge it
$ gh pr merge --squash $ git checkout main $ git pull
The other half: the secret scan
redline-gate / Secret scan (diff) runs TruffleHog over the commits in the pull request and behaves the same way: it fails at every rung, and no label waives it. It runs on every repository, private ones included, with no licence. Where GitHub's push protection is on, it usually stops a recognised token before it is even pushed, so the gate is the second line, not the first.
This path does not commit a fake secret to show it. A credential in a repository's history stays there, even after a revert, and that is exactly the lesson.
Check your understanding
A repository is at observe. A pull request adds a dependency with a high-severity advisory and has the redline-exempt label. Can it pass the gate?