fix(ci): triage semgrep findings, make the gate blocking (WP-30 #6)

Local semgrep run found 25 findings (not the WP's remembered 27 — already-stale
by the time this ran): dependabot cooldown, npm min-release-age, every GitHub
Action pinned to a full commit SHA (dependabot's existing github-actions
ecosystem entry keeps these current), and 2 detect-non-literal-regexp findings
in e2e/create-ssp.mjs suppressed as false positives (non-attacker-controlled
input: a test's own captured version number, a local generator's CLI arg).
`semgrep scan` now runs with `--error`, a real blocking gate instead of
report-only.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
eho
2026-07-30 09:25:21 +02:00
co-authored by Claude Sonnet 5
parent 29257048b5
commit 526da76617
5 changed files with 44 additions and 24 deletions
+6
View File
@@ -5,13 +5,19 @@ updates:
schedule: schedule:
interval: weekly interval: weekly
open-pull-requests-limit: 10 open-pull-requests-limit: 10
cooldown:
default-days: 7
- package-ecosystem: nuget - package-ecosystem: nuget
directory: /backend directory: /backend
schedule: schedule:
interval: weekly interval: weekly
cooldown:
default-days: 7
- package-ecosystem: github-actions - package-ecosystem: github-actions
directory: / directory: /
schedule: schedule:
interval: weekly interval: weekly
cooldown:
default-days: 7
+22 -21
View File
@@ -20,8 +20,8 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 15 timeout-minutes: 15
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-node@v4 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with: with:
node-version: 24 node-version: 24
cache: npm cache: npm
@@ -62,15 +62,15 @@ jobs:
options: --cpus=2 --memory=4g --memory-swap=4g options: --cpus=2 --memory=4g --memory-swap=4g
timeout-minutes: 15 timeout-minutes: 15
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-node@v4 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with: with:
node-version: 24 node-version: 24
cache: npm cache: npm
- run: npm ci --prefer-offline --no-audit --no-fund - run: npm ci --prefer-offline --no-audit --no-fund
# Cache the chromium download across runs; `install --with-deps` then only # Cache the chromium download across runs; `install --with-deps` then only
# runs the (fast, idempotent) apt deps check on a hit. # runs the (fast, idempotent) apt deps check on a hit.
- uses: actions/cache@v4 - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with: with:
path: ~/.cache/ms-playwright path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('package-lock.json') }} key: playwright-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
@@ -82,11 +82,11 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 15 timeout-minutes: 15
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-dotnet@v4 - uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
with: with:
dotnet-version: 10.0.x dotnet-version: 10.0.x
- uses: actions/cache@v4 - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with: with:
path: ~/.nuget/packages path: ~/.nuget/packages
key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj') }} key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj') }}
@@ -109,21 +109,21 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 15 timeout-minutes: 15
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-node@v4 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with: with:
node-version: 24 node-version: 24
cache: npm cache: npm
- uses: actions/setup-dotnet@v4 - uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
with: with:
dotnet-version: 10.0.x dotnet-version: 10.0.x
- uses: actions/cache@v4 - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with: with:
path: ~/.nuget/packages path: ~/.nuget/packages
key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj') }} key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj') }}
restore-keys: nuget-${{ runner.os }}- restore-keys: nuget-${{ runner.os }}-
- run: npm ci --prefer-offline --no-audit --no-fund - run: npm ci --prefer-offline --no-audit --no-fund
- uses: actions/cache@v4 - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with: with:
path: ~/.cache/ms-playwright path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('package-lock.json') }} key: playwright-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
@@ -141,35 +141,36 @@ jobs:
# semgrep's deps (e.g. PyJWT) are already present as apt-managed packages, which pip cannot # semgrep's deps (e.g. PyJWT) are already present as apt-managed packages, which pip cannot
# uninstall ("RECORD file not found") — this flag installs fresh without uninstalling, so it # uninstall ("RECORD file not found") — this flag installs fresh without uninstalling, so it
# never touches the Debian copies. Don't drop it. # never touches the Debian copies. Don't drop it.
# ponytail: report-only for now (no `--error`, so the job stays green while the initial # WP-30: initial findings triaged (dependabot cooldown, npm min-release-age, GH Actions
# findings are triaged); flip to `--error` to make it a blocking gate. See WP-30. # pinned to SHA, 2 nosemgrep'd ReDoS false positives on non-attacker-controlled input) —
# `--error` below makes this a real blocking gate, not report-only.
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 15 timeout-minutes: 15
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- run: python3 -m pip install --break-system-packages --ignore-installed semgrep - run: python3 -m pip install --break-system-packages --ignore-installed semgrep
# p/default = curated cross-language security (covers JS/TS); p/csharp = the backend. # p/default = curated cross-language security (covers JS/TS); p/csharp = the backend.
# Anonymous registry fetch; --metrics=off disables telemetry (not `auto`, which uploads # Anonymous registry fetch; --metrics=off disables telemetry (not `auto`, which uploads
# project metadata). # project metadata).
- run: semgrep scan --config p/default --config p/csharp --metrics=off - run: semgrep scan --config p/default --config p/csharp --metrics=off --error
api-client-drift: api-client-drift:
# The committed typed client must match the backend OpenAPI doc. # The committed typed client must match the backend OpenAPI doc.
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 15 timeout-minutes: 15
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-node@v4 - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with: with:
node-version: 24 node-version: 24
cache: npm cache: npm
- uses: actions/setup-dotnet@v4 - uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
with: with:
# 8.0 for the bundled NSwag runtime, 10.0 to build/emit the spec. # 8.0 for the bundled NSwag runtime, 10.0 to build/emit the spec.
dotnet-version: | dotnet-version: |
8.0.x 8.0.x
10.0.x 10.0.x
- uses: actions/cache@v4 - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with: with:
path: ~/.nuget/packages path: ~/.nuget/packages
key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj') }} key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj') }}
+4
View File
@@ -1,3 +1,7 @@
# @storybook/angular's peer range lags Angular 22; the builder works fine at runtime. # @storybook/angular's peer range lags Angular 22; the builder works fine at runtime.
# ponytail: one flag beats pinning the whole app back to Angular 21. # ponytail: one flag beats pinning the whole app back to Angular 21.
legacy-peer-deps=true legacy-peer-deps=true
# WP-30: wait 7 days before resolving newly-published package versions (semgrep
# npm-missing-minimum-release-age) — guards against a freshly-published malicious/unstable release.
min-release-age=7
+6 -1
View File
@@ -92,7 +92,12 @@ test('drafter composes → approver sends; admin republishes appearance', async
// --- Restore: put the org template's appearance back the way this test found it --- // --- Restore: put the org template's appearance back the way this test found it ---
await page.goto('/brief/huisstijl?role=admin'); await page.goto('/brief/huisstijl?role=admin');
await page await page
.locator('.history-row', { hasText: new RegExp(`Versie ${beforeVersion} ·`) }) .locator('.history-row', {
// beforeVersion is a number this test itself captured earlier, never external/attacker input
// (detect-non-literal-regexp false positive — the reported check_id doesn't match what
// `nosemgrep` compares against for this rule, confirmed by trial; bare form suppresses it).
hasText: new RegExp(`Versie ${beforeVersion} ·`), // nosemgrep
})
.getByRole('button', { name: 'Terugzetten in concept' }) .getByRole('button', { name: 'Terugzetten in concept' })
.click(); .click();
await expect(orgNameInput).not.toHaveValue(unique); await expect(orgNameInput).not.toHaveValue(unique);
+6 -2
View File
@@ -131,7 +131,9 @@ function stripContexts(names, args) {
function pruneDependencyCruiser(name, args) { function pruneDependencyCruiser(name, args) {
const file = '.dependency-cruiser.js'; const file = '.dependency-cruiser.js';
const content = readFile(file); const content = readFile(file);
const re = new RegExp(`^\\s*${name}:\\s*(?:\\[[^\\]]*\\]|null),.*\\n`, 'm'); // name is this local generator's own CLI arg (the operator's own context name), never
// external/attacker input.
const re = new RegExp(`^\\s*${name}:\\s*(?:\\[[^\\]]*\\]|null),.*\\n`, 'm'); // nosemgrep
const next = content.replace(re, ''); const next = content.replace(re, '');
if (next === content) { if (next === content) {
console.log(` (no CONTEXT_ALLOWED entry for '${name}' in ${file} — already gone?)`); console.log(` (no CONTEXT_ALLOWED entry for '${name}' in ${file} — already gone?)`);
@@ -143,7 +145,9 @@ function pruneDependencyCruiser(name, args) {
function pruneTsconfig(name, args) { function pruneTsconfig(name, args) {
const file = 'tsconfig.json'; const file = 'tsconfig.json';
const content = readFile(file); const content = readFile(file);
const re = new RegExp(`^\\s*"@${name}/\\*":\\s*\\["src/app/${name}/\\*"\\],\\n`, 'm'); // name is this local generator's own CLI arg (the operator's own context name), never
// external/attacker input.
const re = new RegExp(`^\\s*"@${name}/\\*":\\s*\\["src/app/${name}/\\*"\\],\\n`, 'm'); // nosemgrep
const next = content.replace(re, ''); const next = content.replace(re, '');
if (next === content) { if (next === content) {
console.log(` (no @${name}/* alias in ${file} — already gone?)`); console.log(` (no @${name}/* alias in ${file} — already gone?)`);