Day 12: Security and supply chain
Goal: Renovate reports known vulnerabilities as dedicated security PRs, lets new releases mature, pins Actions and images by digest and runs with minimal permissions. · Duration: approx. 120 min · Prerequisite: Day 4, Day 6, Day 9
Briefing
osvVulnerabilityAlertsmatches direct dependencies against the OSV database and creates security PRs with[SECURITY]in the title – independent of schedule and limits.vulnerabilityAlertsreads the platform’s alerts. Only GitHub can do that (Dependabot alerts), Forgejo cannot.minimumReleaseAgeprotects against freshly compromised releases, a digest pin against re-pointed tags.postUpgradeTasksrun commands inside the bot. Only what the operator allows globally viaallowedCommandsis permitted.
OSV DB ──► direct deps with lockfile version ──► affected? ──► security PR
(no schedule,
Registry ──► release time ──► mature? ──► normal update no limits)
Tag v3 ──► Digest a37ce91… ──► uses: actions/checkout@a37ce91… # v3
Drill 1: A vulnerable starting point
A fresh shop-api, lodash in the lockfile back to
4.17.20. Plus a config that almost never allows normal
updates: only on January 1, at most one PR. You only see the GitHub
Actions updates with RENOVATE_GITHUB_COM_TOKEN set (Day
0).
source ~/renovate-lab/setup/env.sh
curl -s -o /dev/null -w '%{http_code}\n' -u "$ADMIN" \
-X DELETE "$FORGEJO/api/v1/repos/shop/shop-api"
git -C ~/renovate-lab/shop-api push -q forgejo:shop/shop-api.git main
export RENOVATE_GITHUB_COM_TOKEN=$(gh auth token) # optional, see Day 0
mkdir -p ~/renovate-lab/tag12 && cd ~/renovate-lab/tag12
R="$FORGEJO/api/v1/repos/shop/shop-api"
rm -rf shop-api
git clone -q forgejo:shop/shop-api.git
cd shop-api
npm install -s --package-lock-only [email protected]
npm pkg set dependencies.lodash=^4.17.20
npm install -s --package-lock-only
cp ~/renovate-lab/code/tag12/renovate-start.json renovate.json
jq -c '{schedule, prHourlyLimit, prConcurrentLimit}' renovate.json
renovate-config-validator --no-global renovate.json >/dev/null
git add -A
git commit -qm "Altes Lockfile, Updates nur am 1. Januar"
git push -q origin mainExpected (abridged):
204
{"schedule":["* * 1 1 *"],"prHourlyLimit":1,"prConcurrentLimit":1}
Because renovate.json is directly on main,
there is no onboarding. First run:
renovate shop/shop-api > ../lauf-plan.log 2>&1
grep -hoE 'Branch (created|updated)|PR (created|updated)|Autoclosing PR' \
../lauf-plan.log | sort | uniq -c
curl -s -u "$ADMIN" "$R/pulls" \
| jq -r 'sort_by(.number)[] | "#\(.number) \(.head.ref): \(.title)"'
curl -s -u "$ADMIN" "$R/issues?type=issues" \
| jq -r '.[] | select(.title == "Dependency Dashboard") | .body' > dashboard.md
grep -E '^## dashboard.md |branch=' | cut -c1-88Expected (abridged; your target versions will be newer):
## Awaiting Schedule
- [ ] <!-- unschedule-branch=renovate/express-4.x -->Update dependency express to v4.22
- [ ] <!-- unschedule-branch=renovate/lodash-monorepo -->Update dependency lodash to v4
- [ ] <!-- unschedule-branch=renovate/prettier-3.x -->Update dependency prettier to v3.
- [ ] <!-- unschedule-branch=renovate/node-20.x -->Update Node.js to v20.20.2
...
## Detected Dependencies
No PR; everything waits for January 1. This is exactly what a repo looks like that someone has “quieted down”.
Save your progress? Sign up for free
Drill 2: Turning on OSV
On the first run, Renovate downloads the OSV database as an offline
copy (around 80 MB, a good 600 MB unpacked in the temp directory
osv-offline). The first run therefore takes one to two
minutes longer.
jq '.osvVulnerabilityAlerts = true' renovate.json > tmp.json \
&& mv tmp.json renovate.json
renovate-config-validator --no-global renovate.json >/dev/null
git add -A
git commit -qm "OSV-Sicherheitswarnungen an"
git push -q origin main
LOG_LEVEL=debug run osv
curl -s -u "$ADMIN" "$R/pulls" \
| jq -r 'sort_by(.number)[] | "#\(.number) \(.head.ref): \(.title)"'Expected:
2 Branch created
2 PR created
#2 npm-express-vulnerability: Update dependency express to v4.20.0 [SECURITY]
#3 npm-lodash-vulnerability: Update dependency lodash to v4.18.1 [SECURITY]
Two PRs, even though schedule and
prConcurrentLimit: 1 apply. The reason lies in the default
of vulnerabilityAlerts: schedule: [],
prConcurrentLimit: 0, minimumReleaseAge: null,
commitMessageSuffix: "[SECURITY]". In addition, Renovate
skips the hourly and commit limits for security branches. The log proves
it:
grep -E "affects|No vulnerability alerts" ../lauf-osv.log \
| cut -c8-88 | sort -u | head -3
grep "Checking schedule" ../lauf-osv.log | grep -oE "schedule=[^,]*|branch=[^)]+"Expected (abridged, seven advisories in total):
No vulnerability alerts found (repository=shop/shop-api)
Vulnerability GHSA-29mw-wpgm-hmr9 affects lodash 4.17.20 (repository=shop/shop-ap
Vulnerability GHSA-35jh-r3h4-6jhm affects lodash 4.17.20 (repository=shop/shop-ap
schedule=
branch=renovate/npm-express-vulnerability
schedule=
branch=renovate/npm-lodash-vulnerability
For lodash, Renovate checks the lockfile version
4.17.20, not the range ^4.17.20. The security
branches run with an empty schedule.
No vulnerability alerts found comes from
vulnerabilityAlerts, the platform alerts. Renovate queries
them via platform.getVulnerabilityAlerts(), and only the
GitHub platform implements that (Dependabot alerts). On Forgejo, GitLab
and the like, OSV is your only source.
Tip: On GitHub, Dependabot alerts need the dependency graph, “Dependabot alerts” turned on and, for the bot, read access to “Dependabot alerts” (GitHub App) (abridged, may differ depending on the version). OSV and platform alerts can be combined.
Save your progress? Sign up for free
Drill 3: Label, CVE overview and fix strategy
Security PRs get no label by default. Forgejo silently discards
unknown labels, so you create security first:
curl -s -u "$ADMIN" -X POST "$R/labels" --json '{"name":"security","color":"#d73a4a"}' | jq -r .name
jq '.vulnerabilityAlerts = {"labels": ["security"]}
| .dependencyDashboardOSVVulnerabilitySummary = "unresolved"' renovate.json \
> tmp.json && mv tmp.json renovate.json
renovate-config-validator --no-global renovate.json >/dev/null
git add -A
git commit -qm "Security-Label und CVE-Übersicht"
git push -q origin main
renovate shop/shop-api > ../lauf-label.log 2>&1
grep -hoE 'Branch (created|updated)|PR (created|updated)|Autoclosing PR' \
../lauf-label.log | sort | uniq -c
curl -s -u "$ADMIN" "$R/pulls" \
| jq -r 'sort_by(.number)[] | "#\(.number) \(.head.ref): \(.title)"'
curl -s -u "$ADMIN" "$R/issues?type=issues" \
| jq -r '.[] | select(.title == "Dependency Dashboard") | .body' > dashboard.md
grep -E '^## dashboard.md |CVEs'
curl -s -u "$ADMIN" "$R/pulls" \
| jq -r '.[] | select(.head.ref == "renovate/npm-express-vulnerability") | .body' > pr.md
grep -E '^\[CVE' | cut -c1-80 pr.mdExpected (abridged):
security
1 Branch updated
2 PR updated
#2 npm-express-vulnerability: Update dependency express to v4.20.0 [SECURITY] [security]
#3 npm-lodash-vulnerability: Update dependency lodash to v4.18.1 [SECURITY] [security]
## Rate-Limited
## Open
## Vulnerabilities
> `7`/`7` CVEs have Renovate fixes.
## Detected Dependencies
[CVE-2024-29041](https://nvd.nist.gov/vuln/detail/CVE-2024-29041) / [G
[CVE-2024-43796](https://nvd.nist.gov/vuln/detail/CVE-2024-43796) / [G
The PR body contains a description, CVSS score and links per
advisory. The new dashboard section “Vulnerabilities” counts the CVEs.
With "all" instead of "unresolved" it lists
every GHSA ID individually; "unresolved" only shows what
Renovate knows no fix for.
Express only jumps to 4.20.0:
vulnerabilityFixStrategy: "lowest" (default) takes the
smallest version that fixes all known CVEs of express
itself. What npm audit has to say about
it:
npm audit --package-lock-only | grep -E 'vulnerabilities \('
git fetch -q && git checkout -q origin/renovate/npm-express-vulnerability
npm audit --package-lock-only | grep -E '^[a-z-]+ |vulnerabilities \('
git checkout -q mainExpected:
8 vulnerabilities (3 low, 1 moderate, 4 high)
body-parser <=1.20.6 || 2.0.0-beta.1 - 2.0.2
cookie <0.7.0
lodash <=4.17.23
path-to-regexp <=0.1.12
qs <=6.15.3
send <0.19.0
8 vulnerabilities (3 low, 2 moderate, 3 high)
In Renovate, OSV only checks direct dependencies.
The transitive packages of express 4.20.0 remain vulnerable. With
highest, the security PR moves to the newest version, and
that brings current sub-dependencies along:
jq '.vulnerabilityAlerts.vulnerabilityFixStrategy = "highest"' renovate.json \
> tmp.json && mv tmp.json renovate.json
renovate-config-validator --no-global renovate.json >/dev/null
git add -A
git commit -qm "Security-Fix auf neueste Version"
git push -q origin main
renovate shop/shop-api > ../lauf-highest.log 2>&1
grep -hoE 'Branch (created|updated)|PR (created|updated)|Autoclosing PR' \
../lauf-highest.log | sort | uniq -c
curl -s -u "$ADMIN" "$R/pulls" \
| jq -r 'sort_by(.number)[] | "#\(.number) \(.head.ref): \(.title)"' | grep express
git fetch -q && git checkout -q origin/renovate/npm-express-vulnerability
npm audit --package-lock-only | grep -E '^[a-z-]+ |vulnerabilit'
git checkout -q mainExpected:
2 Branch updated
1 PR updated
#2 npm-express-vulnerability: Update dependency express to v4.22.3 [SECURITY] [security]
lodash <=4.17.23
1 high severity vulnerability
What remains is lodash, which the second security PR takes care of.
Why 4.18.1 and not 4.18.0? 4.18.0
is deprecated on npm as a “Bad release”, and Renovate skips it.
Warning: For transitive npm dependencies without a direct entry, OSV creates no PR. Add
npm audit/OSV-Scanner to CI and uselockFileMaintenance(Day 13), which bumps all lockfile versions.
Save your progress? Sign up for free
Drill 4: Maturity period against compromised releases
Compromised npm releases are usually discovered and pulled within
hours to days. The preset security:minimumReleaseAgeNpm
lets npm releases mature for three days. In the preset code
(security.preset.js) there is a rule for this with
matchDatasources: ["npm"],
minimumReleaseAge: "3 days" and
internalChecksFilter: "strict".
internalChecksFilter: "strict" (default, Day 4) means:
immature versions are not proposed at all; Renovate takes the newest
mature one. The preset only applies to the datasource npm –
Docker images remain untouched. Good thing, because the Docker
datasource delivers no release timestamp for node, and with
the default
minimumReleaseAgeBehaviour: "timestamp-required" the
updates would silently disappear (Day 4).
Now the test of whether security fixes have to wait. For the demo, 60 days for npm:
cp ~/renovate-lab/code/tag12/renovate-reife.json renovate.json
renovate-config-validator --no-global renovate.json >/dev/null
git add -A
git commit -qm "Reifezeit 60 Tage für npm"
git push -q origin main
renovate shop/shop-api > ../lauf-reife.log 2>&1
grep -hoE 'Branch (created|updated)|PR (created|updated)|Autoclosing PR' \
../lauf-reife.log | sort | uniq -c
curl -s -u "$ADMIN" "$R/pulls" \
| jq -r 'sort_by(.number)[] | "#\(.number) \(.head.ref): \(.title)"' | grep -E 'vulnerab|prettier'
SHA=$(curl -s -u "$ADMIN" "$R/branches/renovate/prettier-3.x" | jq -r .commit.id)
curl -s -u "$ADMIN" "$R/commits/$SHA/status" \
| jq -r '.statuses[] | "\(.context): \(.status) – \(.description)"' | grep renovate/
SHA=$(curl -s -u "$ADMIN" "$R/branches/renovate/npm-express-vulnerability" | jq -r .commit.id)
curl -s -u "$ADMIN" "$R/commits/$SHA/status" \
| jq -r '.statuses[] | "\(.context): \(.status) – \(.description)"' | grep renovate/ || echo "(kein stability-days)"
npm view express time --json | jq -r '."4.22.3"'Expected (abridged):
5 Branch created
1 Branch updated
5 PR created
#2 npm-express-vulnerability: Update dependency express to v4.22.3 [SECURITY] [security]
#3 npm-lodash-vulnerability: Update dependency lodash to v4.18.1 [SECURITY] [security]
#4 prettier-3.x: Update dependency prettier to v3.9.6
renovate/stability-days: success – Updates have met minimum release age requirement
(kein stability-days)
2026-09-14T06:46:38.631Z
prettier only gets the latest version older than 60 days (3.9.6). The
security PR for express targets 4.22.3, only 28 days old on
the test day: security fixes ignore minimumReleaseAge
(default vulnerabilityAlerts.minimumReleaseAge: null). If
you want fixes to mature as well, set
vulnerabilityAlerts.minimumReleaseAge. That is a trade-off
between an open CVE and a fresh release.
Save your progress? Sign up for free
Drill 5: Pinning GitHub Actions by SHA
A tag like v3 can be re-pointed at any time. Whoever
takes over the repo of an action runs in your CI afterwards. A commit
SHA is immutable. helpers:pinGitHubActionDigests pins all
uses:. Renovate fetches the SHAs from github.com; without
RENOVATE_GITHUB_COM_TOKEN it skips Actions
(github-token-required, Day 0).
jq '.extends += ["helpers:pinGitHubActionDigests"]' renovate.json > tmp.json
mv tmp.json renovate.json
renovate-config-validator --no-global renovate.json >/dev/null
git add -A
git commit -qm "GitHub Actions per Digest pinnen"
git push -q origin main
renovate shop/shop-api > ../lauf-pin.log 2>&1
grep -hoE 'Branch (created|updated)|PR (created|updated)|Autoclosing PR' \
../lauf-pin.log | sort | uniq -c
curl -s -u "$ADMIN" "$R/pulls" \
| jq -r 'sort_by(.number)[] | "#\(.number) \(.head.ref): \(.title)"' | grep -E 'pin|actions'
git fetch -q --prune origin
git diff origin/main...origin/renovate/pin-dependencies -- . ':!package-lock.json' \
| grep -E '^[-+][^-+]'Expected:
1 Branch created
1 Branch updated
1 PR created
#6 actions-checkout-7.x: Update actions/checkout action to v7
#7 actions-setup-node-7.x: Update actions/setup-node action to v7
#9 pin-dependencies: Pin dependencies
- - uses: actions/checkout@v3
- - uses: actions/setup-node@v3
+ - uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3
+ - uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3
The comment # v3 stays readable and is Renovate’s anchor
for later updates. Check the SHA yourself and merge the pin PR:
git ls-remote https://github.com/actions/checkout refs/tags/v3
N=$(curl -s -u "$ADMIN" "$R/pulls" \
| jq -r '.[] | select(.head.ref == "renovate/pin-dependencies") | .number')
curl -s -o /dev/null -w '%{http_code}\n' -u "$ADMIN" -X POST "$R/pulls/$N/merge" \
--json '{"Do":"merge","delete_branch_after_merge":true}'
git pull -q
renovate shop/shop-api > ../lauf-nachpin.log 2>&1
grep -hoE 'Branch (created|updated)|PR (created|updated)|Autoclosing PR' \
../lauf-nachpin.log | sort | uniq -c
git fetch -q --prune origin
git diff origin/main...origin/renovate/actions-checkout-7.x -- . ':!package-lock.json' \
| grep -E '^[-+][^-+]'Expected:
a37ce9120846195fa4ece8f58b268e6043cb2f26 refs/tags/v3
200
3 Branch updated
- - uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
From now on, every action update writes the SHA and the tag together.
Tip:
helpers:pinGitHubActionDigestsToSemverwrites the full version into the comment instead of# v3, in the lab for exampleactions/checkout@3d3c42e…ba90b1 # v7.0.1. Then every reviewer sees the exact state.
Save your progress? Sign up for free
Drill 6: config:best-practices and Docker digests
What config:best-practices adds on top of
config:recommended is in the preset code:
P=~/renovate-lab/tools/node_modules/renovate/dist/config/presets/internal
grep -A 12 '"best-practices"' $P/config.preset.jsExpected (abridged):
"best-practices": {
description: "Preset with best practices from the Renovate maintainers. ...",
extends: [
"config:recommended",
"docker:pinDigests",
"helpers:pinGitHubActionDigests",
":configMigration",
":pinDevDependencies",
"abandonments:recommended",
"security:minimumReleaseAgeNpm",
":maintainLockFilesWeekly"
]
},
New compared with Drill 5 are Docker digests (Day 6), config migration PRs, exactly pinned devDependencies, detection of abandoned packages and weekly lockfile maintenance (Day 13).
Switch over. So that the “Abandoned Dependencies” section shows
something, the demo sets the threshold to three months
(abandonmentThreshold):
cp ~/renovate-lab/code/tag12/renovate-best-practices.json renovate.json
renovate-config-validator --no-global renovate.json >/dev/null
git add -A
git commit -qm "config:best-practices"
git push -q origin main
renovate shop/shop-api > ../lauf-best.log 2>&1
grep -hoE 'Branch (created|updated)|PR (created|updated)|Autoclosing PR' \
../lauf-best.log | sort | uniq -c
curl -s -u "$ADMIN" "$R/pulls" \
| jq -r 'sort_by(.number)[] | "#\(.number) \(.head.ref): \(.title)"' | grep -E 'pin|prettier'
git fetch -q --prune origin
git diff origin/main...origin/renovate/pin-dependencies -- . ':!package-lock.json' \
| grep -E '^[-+][^-+]' | cut -c1-88
curl -s -u "$ADMIN" "$R/issues?type=issues" \
| jq -r '.[] | select(.title == "Dependency Dashboard") | .body' > dashboard.md
grep -A12 '^## Abandoned' dashboard.md | grep -E '^## |^\| npm|View'Expected:
1 Branch created
2 Branch updated
1 PR created
1 PR updated
#4 prettier-3.x: Update dependency prettier to v3.9.9
#10 pin-dependencies: Pin Node.js to 2f46fd4
-FROM node:20.11.0-alpine
+FROM node:20.11.0-alpine@sha256:2f46fd49c767554c089a5eb219115313b72748d8f62f5eccb58ef52
## Abandoned Dependencies
<summary>View abandoned dependencies (1)</summary>
| npm | [lodash](https://github.com/lodash/lodash) | `2026-04-01` |
prettier jumps to 3.9.9: the 60-day demo is gone, and the three days from the preset apply. The Node image is pinned by digest; details on digests are in Day 6. lodash counts as abandoned after three months without a release. With the default threshold of one year, nothing would be listed here. Abandoned packages have nobody to deliver a fix at the next CVE.
Save your progress? Sign up for free
Drill 7: postUpgradeTasks and allowedCommands
After a Prettier update, Renovate should format the code with the new version and commit the result along with it. For this, a format script and a deliberately unformatted file:
npm pkg set scripts.format="prettier --write '**/*.js'"
cat > preise.js <<'EOF'
const preise = {apfel: 1, birne: 2}
module.exports = preise
EOF
cp ~/renovate-lab/code/tag12/renovate-post-upgrade.json renovate.json
jq -c '.packageRules[1].postUpgradeTasks' renovate.json
renovate-config-validator --no-global renovate.json >/dev/null
git add -A
git commit -qm "Format-Skript und postUpgradeTasks"
git push -q origin main
N=$(curl -s -u "$ADMIN" "$R/pulls" \
| jq -r '.[] | select(.head.ref == "renovate/prettier-3.x") | .number')
curl -s -u "$ADMIN" "$R/pulls/$N" | jq -r .body > pr.md
sed -i '' 's/- \[ \] <!-- rebase-check/- [x] <!-- rebase-check/' pr.md
jq -Rs '{body: .}' pr.md > pr.json
curl -s -u "$ADMIN" -X PATCH --json @pr.json "$R/pulls/$N" | jq -r .number
renovate shop/shop-api > ../lauf-ohne-allowlist.log 2>&1
grep -hoE 'Branch (created|updated)|PR (created|updated)|Autoclosing PR' \
../lauf-ohne-allowlist.log | sort | uniq -c
grep -E "^ WARN" ../lauf-ohne-allowlist.log | cut -c1-88
SHA=$(curl -s -u "$ADMIN" "$R/branches/renovate/prettier-3.x" | jq -r .commit.id)
curl -s -u "$ADMIN" "$R/commits/$SHA/status" \
| jq -r '.statuses[] | "\(.context): \(.status) – \(.description)"' | grep renovate/
N=$(curl -s -u "$ADMIN" "$R/pulls" \
| jq -r '.[] | select(.head.ref == "renovate/prettier-3.x") | .number')
curl -s -u "$ADMIN" "$R/issues/$N/comments" | jq -r '.[].body' | grep "^Post-upgrade" | cut -c1-88Expected:
{"commands":["npm ci --ignore-scripts","npm run format"],"fileFilters":["**/*.js"]}
2 Branch updated
1 PR updated
WARN: Post-upgrade task did not match any on allowedCommands list (repository=shop/shop
WARN: Post-upgrade task did not match any on allowedCommands list (repository=shop/shop
WARN: artifactErrors (repository=shop/shop-api, branch=renovate/prettier-3.x)
renovate/stability-days: success – Updates have met minimum release age requirement
renovate/artifacts: failure – Artifact file update failure
Post-upgrade command 'npm ci --ignore-scripts' has not been added to the allowed list i
Post-upgrade command 'npm run format' has not been added to the allowed list in allowedC
Blocked. Otherwise anyone who is allowed to change
renovate.json could run arbitrary commands with the bot
token in the working directory. allowedCommands is
therefore global-only and a list of regexes, default
[]. Allow them as the operator, anchored with
^…$:
export RENOVATE_ALLOWED_COMMANDS='["^npm ci --ignore-scripts$", "^npm run format$"]'
N=$(curl -s -u "$ADMIN" "$R/pulls" \
| jq -r '.[] | select(.head.ref == "renovate/prettier-3.x") | .number')
curl -s -u "$ADMIN" "$R/pulls/$N" | jq -r .body > pr.md
sed -i '' 's/- \[ \] <!-- rebase-check/- [x] <!-- rebase-check/' pr.md
jq -Rs '{body: .}' pr.md > pr.json
curl -s -u "$ADMIN" -X PATCH --json @pr.json "$R/pulls/$N" | jq -r .number
renovate shop/shop-api > ../lauf-mit-allowlist.log 2>&1
grep -hoE 'Branch (created|updated)|PR (created|updated)|Autoclosing PR' \
../lauf-mit-allowlist.log | sort | uniq -c
SHA=$(curl -s -u "$ADMIN" "$R/branches/renovate/prettier-3.x" | jq -r .commit.id)
curl -s -u "$ADMIN" "$R/commits/$SHA/status" \
| jq -r '.statuses[] | "\(.context): \(.status) – \(.description)"' | grep renovate/
git fetch -q --prune origin
git diff origin/main...origin/renovate/prettier-3.x -- . ':!package-lock.json' \
| grep -E '^[-+][^-+]'
N=$(curl -s -u "$ADMIN" "$R/pulls" \
| jq -r '.[] | select(.head.ref == "renovate/prettier-3.x") | .number')
curl -s -u "$ADMIN" "$R/issues/$N/comments" | jq -r '.[].body' | wc -lExpected:
1 Branch updated
1 PR updated
renovate/stability-days: success – Updates have met minimum release age requirement
- "prettier": "3.0.0"
+ "prettier": "3.9.9"
-const preise = {apfel: 1, birne: 2}
-module.exports = preise
+const preise = { apfel: 1, birne: 2 };
+module.exports = preise;
0
The branch now contains the update and the formatted file; the
renovate/artifacts status and the error comment are gone.
fileFilters limits which changed files may go into the
commit. Commands run without a shell
(allowShellExecutorForPostUpgradeCommands: false), so
&& or ; do not work – hence two
entries. --ignore-scripts prevents install
scripts of third-party packages from running inside the bot.
Security: Without
^and$,"npm run format"also allows"npm run format -- --plugin=./boese.js". Do not allow generic patterns like"^npm "or".*".
Save your progress? Sign up for free
Drill 8: Minimal bot permissions
What is renovate-bot allowed to do in the lab? Token
scopes, admin flag, repo permission:
curl -s -u renovate-bot:lab-bot-pw-123 "$FORGEJO/api/v1/users/renovate-bot/tokens" \
| jq -r '.[].scopes | join(",")'
curl -s -H "Authorization: token $RENOVATE_TOKEN" "$FORGEJO/api/v1/user" \
| jq -c '{login, is_admin}'
curl -s -u "$ADMIN" "$R/collaborators/renovate-bot/permission" | jq -c '{permission}'Expected:
read:organization,read:package,write:issue,write:repository,read:user
{"login":"renovate-bot","is_admin":false}
{"permission":"write"}
It needs write:repository for branches, PRs and
statuses, write:issue for the dashboard, labels and
comments, and the read: scopes for the account, org presets
(Day 11) and package registry (Day 8). No admin, no
write:organization.
Now you protect main: no direct push, one review,
Renovate checks mandatory. The bot is not on an
exception list.
curl -s -u "$ADMIN" -X POST "$R/branch_protections" --json '{
"rule_name": "main",
"enable_push": false,
"required_approvals": 1,
"enable_status_check": true,
"status_check_contexts": ["renovate/*"]
}' | jq -c '{enable_push, push_whitelist_usernames, required_approvals}'
git push -q "http://renovate-bot:$RENOVATE_TOKEN@127.0.0.1:3000/shop/shop-api.git" \
origin/renovate/prettier-3.x:refs/heads/main 2>&1 | grep -E "Forgejo|rejected"
curl -s -H "Authorization: token $RENOVATE_TOKEN" -H 'Content-Type: application/json' \
-X POST "$R/pulls/$(_pr prettier-3.x | jq -r .number)/merge" \
-d '{"Do":"merge"}' | jq -r .message
renovate shop/shop-api > ../lauf-geschuetzt.log 2>&1
grep -hoE 'Branch (created|updated)|PR (created|updated)|Autoclosing PR' \
../lauf-geschuetzt.log | sort | uniq -c
grep -cE "^ (WARN|ERROR)" ../lauf-geschuetzt.logExpected:
{"enable_push":false,"push_whitelist_usernames":[],"required_approvals":1}
remote: Forgejo: Not allowed to push to protected branch main
! [remote rejected] origin/renovate/prettier-3.x -> main (pre-receive hook declined)
not allowed to merge [reason: Does not have enough approvals]
0
With the bot token, nobody gets past review and checks, not even with
a hijacked token. Renovate itself carries on without a warning, because
it only pushes renovate/* branches. Under this rule,
automerge only works after a review. If you want automerge, relax the
rule via status checks (Day 5), not via a bot exception.
Security: The bot sees everything it is allowed to clone, and it runs
postUpgradeTasksand package managers (lockfile updates). Give it only the repos it is supposed to maintain, and treat its token like a deploy credential.
Save your progress? Sign up for free
Checkpoint
OSV alerts and config:best-practices are on:
cd ~/renovate-lab/tag12/shop-api
git pull -q
jq .osvVulnerabilityAlerts renovate.json
jq -c .extends renovate.jsonExpected:
R12_KP1
The security PRs are open and carry the label:
curl -s -u "$ADMIN" "$R/pulls" | jq -r '.[] | "\(.title) \([.labels[].name])"' \
| grep SECURITYExpected:
R12_KP2
actions/checkout is pinned by SHA, and the
postUpgradeTask has formatted preise.js:
grep 'actions/checkout@' .github/workflows/ci.yml | cut -c1-70
git fetch -q --prune origin
git diff origin/main...origin/renovate/prettier-3.x -- preise.js | grep '^+const'Expected:
R12_KP3
main is protected, and the bot has no exception:
curl -s -u "$ADMIN" "$R/branch_protections/main" | jq .enable_push
curl -s -u "$ADMIN" "$R/branch_protections/main" | jq -c .push_whitelist_usernamesExpected:
false
[]
Challenge
A legacy repo shop/shop-legacy (a copy of
shop-api with lodash 4.17.20 in the lockfile)
should only get security PRs from now on, with the label
security. There are no more normal updates there. Prove
that exactly the security PRs are created.
Hint: The security: namespace has a
ready-made preset for this, and default: has one for the
label.
Solution
cd ~/renovate-lab/tag12
rm -rf shop-legacy && cp -R ~/renovate-lab/setup/shop-api shop-legacy
cd shop-legacy
npm install -s --package-lock-only [email protected]
npm pkg set dependencies.lodash=^4.17.20
npm install -s --package-lock-only
cp ~/renovate-lab/code/tag12/challenge/renovate.json .
jq -c .extends renovate.json
renovate-config-validator --no-global renovate.json | tail -1
git init -q -b main
git add -A
git commit -qm "Initialer Stand"
git push -q forgejo:shop/shop-legacy.git main
curl -s -u "$ADMIN" -X POST "$FORGEJO/api/v1/repos/shop/shop-legacy/labels" \
--json '{"name":"security","color":"#d73a4a"}' | jq -r .name
renovate shop/shop-legacy 2>&1 | grep -E "PR created|WARN|ERROR" | cut -c1-88
curl -s -u "$ADMIN" "$FORGEJO/api/v1/repos/shop/shop-legacy/pulls?state=open" \
| jq -r '.[] | "#\(.number) \(.title) [\([.labels[].name] | join(","))]"'Expected:
["security:only-security-updates",":enableVulnerabilityAlertsWithLabel(security)"]
INFO: Config validated successfully against 1 file(s)
security
INFO: PR created (repository=shop/shop-legacy, branch=renovate/npm-express-vulnerabilit
INFO: PR created (repository=shop/shop-legacy, branch=renovate/npm-lodash-vulnerabilit
#2 Update dependency lodash to v4.18.1 [SECURITY] [security]
#1 Update dependency express to v4.20.0 [SECURITY] [security]
security:only-security-updates extends
config:recommended, turns on
osvVulnerabilityAlerts and disables all packages via
packageRules. Security updates override that with
force. Without
vulnerabilityFixStrategy: "highest", express stays at the
minimal fix 4.20.0 (Drill 3).
Save your progress? Sign up for free
Enterprise Note
osvVulnerabilityAlertsbelongs in the org preset (Day 11). Plan disk space and network access for the OSV offline DB (github.comrelease download, around 600 MB unpacked). In an air gap, mirror it viaOSV_OFFLINE_DATABASE_URL.- Security PRs ignore schedule, limits and maturity period. Change
management must be aware of this. Limiting them only works selectively
via
vulnerabilityAlerts.prConcurrentLimit. - On GitHub, the bot needs read access to Dependabot alerts, and to
change
.github/workflows, the “Workflows” permission (PAT scopeworkflow). Without it, even the pin PR for Actions fails. - Maintain
allowedCommandscentrally in the global config, tightly anchored, with review by Security.allowShellExecutorForPostUpgradeCommandsstaysfalse. - Bot account: a dedicated technical user, no admin, a token with an expiry date and rotation, no exception in branch protection. Renovate PRs go through the same reviews and checks as human PRs.