Skip to content

ci(frontend): make the gate blocking, and add the supply-chain half - #187

Merged
athvin merged 2 commits into
mainfrom
ci/frontend-gate
Oct 20, 2026
Merged

athvin merged 2 commits into
mainfrom
ci/frontend-gate

Conversation

@athvin

@athvin athvin commented Oct 20, 2026

Copy link
Copy Markdown
Owner

Why

The frontend has had a CI workflow since #97, but it never gated anything. Branch protection on main requires four contexts and all four are rust.yml's:

fmt + clippy + docs
test
DuckLake + extensions e2e
cargo-deny (advisories + licenses + bans)

lint + types + unit and playwright functional tier ran on every frontend PR and were then ignored at merge time. The paths: filter compounded it — #184, #185 and #186 never ran the frontend tier at all.

And the supply-chain half was missing outright: no pnpm audit, no license check, no SAST, and Dependabot covering only github-actions, so npm dependencies were never bumped. The repo's own notes flagged this (.claude/skills/security/references/secrets-iac.md:78).

What switching the gate on found

Package Was Now Why
next (+ both eslint packages) 16.3.6 16.3.8 6 advisories, incl. a HIGH SSRF in image optimization, cache poisoning, Draft Mode leakage
sharp 0.35.4 0.35.5 HIGH — librsvg CVE-2026-96889
source-map-js <1.2.2 1.2.2 HIGH — event-loop DoS

4 high / 5 moderate / 1 low → 1 high / 1 moderate. 16.3.8 rather than 16.4.2 on purpose: the minimum that clears the advisories while staying inside the pinned minor, which keeps the committed visual baselines in play.

The remaining HIGH is allowlisted with reasoning, following deny.toml's convention: [email protected] is the newest published version and the advisory records no patched release; it is reached only via @next/eslint-plugin-next at lint time, and the only glob patterns it sees are our own eslint config.

New gates — each verified to fail, not just pass

  • pnpm audit:check — HIGH/CRITICAL fail; moderate and below reported. Flags stale allowlist entries so exceptions can't accumulate.
  • pnpm licenses:check — an allowlist, not a denylist, so an unseen license fails and gets a human. deny.toml's 12 ids verbatim plus the npm tree's additions, each carrying why it's permissive enough (the two non-trivial ones are MPL-2.0 and LGPL-3.0-or-later).
  • pnpm authz:check — every tenant route calls requireOrgAccess, every admin route requireSuperAdmin. 54 handlers, all compliant.
  • semgrep — the three sink rules confirmed to fire: HTML injection, dynamic eval, NEXT_PUBLIC_* leakage.
  • gen:api drift — the gate frontend/README.md:11-13 has claimed since Scaffold the frontend sub-project with its dev stack, test rig, and CI job #38 but which never existed.

One thing worth reading

authz:check was written as a semgrep rule first. Semgrep rejected the pattern as invalid TypeScript while still reporting the rule as run with zero findings — two deliberately unauthorized route handlers passed it. A false green on the most important property in the app. It is now plain code with 8 tests that plant violations and require them to be caught.

Also

Restores the five make frontend-* targets dropped by 9a55504, whose message says the frontend targets were "retained". Their scripts were never deleted, and frontend/dev/run.sh:97 has been calling make frontend-seed ever since.

frontend-seed is deliberately not restored — its implementation went in 7cc444f with no replacement, which is why the full-stack e2e tier is dormant. Documented rather than silently broken.

Verification

pnpm check green: eslint, prettier, tsc, authz gate, 70 tests (up from 62). next build clean on 16.3.8.

Both supply-chain gates verified in both directions — empty the allowlist and the audit gate fails on braces; drop MPL-2.0 and the license gate fails on axe-core.

Playwright functional tier: 284 passed, with 3 wizard specs in grow.spec.ts failing. Those fail identically on pristine origin/main at next 16.3.6, and CI on main is green, so they are macOS-local and not from this change. Flagged as a follow-up — they hurt local iteration.

Follow-up, not in this PR

Adding lint + types + unit, playwright functional tier and pnpm audit + licenses to the required contexts, once this is on main and reporting. semgrep (static analysis) stays out at first: its registry packs need network, and a flaky required check is worse than none.

🤖 Generated with Claude Code

bmoore813 and others added 2 commits October 20, 2026 00:44
The frontend has had a real CI workflow since #97, but it never gated
anything: branch protection on main requires four contexts and all four
are rust.yml's. `lint + types + unit` and `playwright functional tier`
ran and were then ignored at merge time. On top of that the `paths:`
filter meant #184, #185 and #186 did not run the frontend tier at all.

Making those jobs required needs the filter gone first: a workflow a
path filter skips never reports, so a required check would sit pending
forever on every backend-only PR. rust.yml already solved this for its
`.claude/**` skip — a `detect` job and an `if:` on each real job, since
a job skipped by `if:` reports "skipped", which branch protection
accepts. This mirrors that, filtering on `^frontend/` instead.

Then the half that was missing entirely. The Rust side runs cargo-deny
(advisories + licenses + bans) on every PR; the frontend ran nothing —
no `pnpm audit`, no license check, no SAST — and Dependabot covered only
`github-actions`, so npm dependencies were never bumped. The repo's own
notes flagged it (skills/security/references/secrets-iac.md: "Dependabot
does not cover cargo or npm").

Switching the gate on showed what that cost: 4 HIGH advisories, six of
them against `next` itself, including a HIGH SSRF in image optimization
fixed four patch releases earlier. So this also bumps next 16.3.6 →
16.3.8 (and the two eslint packages in lockstep), sharp → 0.35.5 and
source-map-js → 1.2.2, taking the tree from 4 high / 5 moderate / 1 low
to 1 high / 1 moderate. 16.3.8 rather than 16.4.2 deliberately: it is
the minimum that clears the advisories and stays inside the pinned
minor, which keeps the committed visual baselines in play.

The one remaining HIGH is allowlisted with its reasoning, following
deny.toml's convention of a prose justification per entry: [email protected]
is the newest published version and the advisory records no patched
release, it is reached only through @next/eslint-plugin-next at lint
time, and the only glob patterns it ever sees are our own eslint config.

New gates, each verified to fail as well as pass:

- `pnpm audit:check` — HIGH/CRITICAL fail, moderate and below reported.
  Reports stale allowlist entries so exceptions cannot accumulate.
- `pnpm licenses:check` — an allowlist, not a denylist, so an unseen
  license fails and gets looked at. deny.toml's 12 ids verbatim plus the
  npm tree's additions, each carrying why it is permissive enough.
- `pnpm authz:check` — every tenant route calls requireOrgAccess and
  every admin route requireSuperAdmin (54 handlers, all compliant).
  This was written as a semgrep rule first; semgrep rejected the pattern
  as invalid TypeScript while still reporting the rule as run with zero
  findings, so two deliberately unauthorized handlers passed. It is now
  code with tests that plant violations and require them to be caught.
- semgrep keeps the three sink rules confirmed to fire: HTML injection,
  dynamic eval, and NEXT_PUBLIC_* leakage.
- the `pnpm gen:api` drift gate frontend/README.md has claimed since #38
  but which never existed — the only related step was rust.yml's
  er-openapi-check, suffixed `|| true`.

Also restores the five `make frontend-*` targets dropped by 9a55504,
whose message says the frontend targets were retained. Their scripts
were never deleted, and frontend/dev/run.sh:97 has been calling
`make frontend-seed` since. `frontend-seed` itself is NOT restored: its
implementation went in 7cc444f with no replacement, which is why the
full-stack e2e tier is dormant.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The first run of the new semgrep gate found this
(javascript.node-crypto.security.gcm-no-tag-length), and it is a real if
modest hardening.

GCM accepts 4-16 byte authentication tags. `open()` slices the last
TAG_BYTES off the stored ciphertext, so a row whose ciphertext is
SHORTER than 16 bytes slices to a short tag — and without an explicit
authTagLength, Node accepts it. A short tag is correspondingly cheaper
to forge. The vault's whole premise is surviving someone who can write
the row (that is what the org+role AAD binding is for), so this is
exactly the threat model to care about.

Pinning authTagLength on both ends makes Node reject any tag that is not
16 bytes. The new test truncates a sealed ciphertext to 0/1/8/15 bytes
and requires each to throw.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin merged commit 13bbf28 into main Oct 20, 2026
14 checks passed
athvin pushed a commit that referenced this pull request Oct 20, 2026
Adding the cargo ecosystem in #187 closed a real gap — the repo's own
security notes flagged that nothing bumped Rust advisories — but it
opened five PRs at once, and that turned out to matter.

Each cargo PR carries a different Cargo.lock, so Swatinem/rust-cache
(keyed on the lockfile) misses and the workspace compiles near-cold.
Five of those in parallel starved the runners enough to push
`fmt + clippy + docs` past its 30-minute timeout — on the dependabot
branches and on main. The job takes ~16 minutes uncontended; #206 took
28m39s under this load, so the timeout was already marginal and the
burst tipped it over.

The grouping config batches minor/patch into one PR, but majors are
deliberately separate — a major is a migration to schedule, not a bump
to merge on green — so a week with several major releases is exactly
when this happens. arrow 59.3.1, rand 0.10.3 and two datafusion 55.2.0
bumps all landed together.

Capping at 2 fixes the cause rather than the symptom; Dependabot queues
the rest and opens them as these merge, so no update is lost. npm stays
at 5, since those PRs do not compile Rust.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
athvin added a commit that referenced this pull request Oct 20, 2026
* ci(frontend): filter pushes to main, not just PRs

Dropping the `paths:` filter was necessary to make the frontend jobs
required status checks — a workflow a path filter skips never reports, so
a required check sits pending forever. But `detect` only filtered
`pull_request`, so every push to main ran the whole gate, and the first
Rust-only merge after #206 duly spent ~5 minutes in the Playwright
container to re-test a tree it had already tested: a squash commit and
the PR head it came from are near-identical, and that PR ran this exact
gate to green minutes earlier.

rust.yml always runs on main for a good reason — it IS the gate
protecting that branch, so it must never self-skip there. That reasoning
does not transfer to this workflow, which was copied from it.

`push` now diffs `event.before...event.after` through the same
`^frontend/` filter the PR case uses. It fails SAFE: an all-zeroes
`before` (a branch's first push) or one git cannot resolve (after a
force-push) runs the gate rather than skipping it — a wasted run beats a
silent one. Nightly and manual runs are unchanged, and so is the
`pull_request` path, so required checks keep behaving exactly as
verified.

All eight event paths were exercised against real commits before pushing
— #206 as a frontend-touching merge, #207 as a Rust-only one — covering
push/PR × touching/not-touching plus the two degenerate `before` values
and schedule/dispatch.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: cap cargo Dependabot at 2 open PRs

Adding the cargo ecosystem in #187 closed a real gap — the repo's own
security notes flagged that nothing bumped Rust advisories — but it
opened five PRs at once, and that turned out to matter.

Each cargo PR carries a different Cargo.lock, so Swatinem/rust-cache
(keyed on the lockfile) misses and the workspace compiles near-cold.
Five of those in parallel starved the runners enough to push
`fmt + clippy + docs` past its 30-minute timeout — on the dependabot
branches and on main. The job takes ~16 minutes uncontended; #206 took
28m39s under this load, so the timeout was already marginal and the
burst tipped it over.

The grouping config batches minor/patch into one PR, but majors are
deliberately separate — a major is a migration to schedule, not a bump
to merge on green — so a week with several major releases is exactly
when this happens. arrow 59.3.1, rand 0.10.3 and two datafusion 55.2.0
bumps all landed together.

Capping at 2 fixes the cause rather than the symptom; Dependabot queues
the rest and opens them as these merge, so no update is lost. npm stays
at 5, since those PRs do not compile Rust.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants