From 6aeb64aae86054fa2bc11c18006742c76c3998e8 Mon Sep 17 00:00:00 2001 From: Simon Axelsson Date: Sun, 15 Nov 2026 19:28:53 +0100 Subject: [PATCH 1/5] =?UTF-8?q?ci(security):=20sn=C3=A4v=20gitleaks-allowl?= =?UTF-8?q?ist=20=E2=80=94=2081=20dokumentplatsh=C3=A5llare/fixturer=20f?= =?UTF-8?q?=C3=A4llde=20gaten?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit security-gaten (--no-git i arbetsträdet) fällde varje PR med 81 fynd sedan länge. Alla granskade rad för rad: dokumentplatshållare som slutar på "..." (gnubok_sk_live_..., whsec_b3a7c9e2...), testfixturer (gnubok_inv_*, idem1234-*, UUID-formade testnycklar) samt två false positives från generic-api-key (desc_ink2_declaration, "SalesLoft/Drift" i löptext). Bevis att ingen är en drifthemlighet: sha256 för samtliga 81 värden jämfördes mot 225 miljövariabler i den körande accounted-stacken på server7 — 0 träffar. Reglerna är oförändrade (useDefault = true); bara de kända platshållar- och fixturformerna undantas, inte hela test-/dockataloger. Negativt test: en realistisk ghp_/AKIA-token i en .ts-fil ger fortfarande exit 1. --- .gitleaks.toml | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .gitleaks.toml diff --git a/.gitleaks.toml b/.gitleaks.toml new file mode 100644 index 00000000..9d15f379 --- /dev/null +++ b/.gitleaks.toml @@ -0,0 +1,43 @@ +# gitleaks-konfig (2026-11-15) — extend default + snäv allowlist +# +# Bakgrund: security-gaten (security.yml, steg "gitleaks secret scan", --no-git) +# fällde varje PR i admin/accounted med 81 fynd i arbetsträdet (upptäckt vid PR #43, +# merge 6921dc9). Alla 81 granskades rad för rad 2026-11-15: +# +# * dokumentplatshållare som slutar på "..." (gnubok_sk_live_..., gnubok_sk_..., whsec_b3a7c9e2...) +# * testfixturer (gnubok_inv_<16 tecken>, UUID-formade testnycklar +# som 36b2bf61-0514-4825-a8a5-08cf151176f2) +# * två false positives från generic-api-key (descKey: 'desc_ink2_declaration', +# "SalesLoft/Drift" i löptext) +# +# Maskinell kontroll: sha256 för samtliga 81 värden jämfördes mot 225 miljövariabler i +# den körande accounted-stacken på server7 — 0 träffar. Ingen av strängarna är en +# drifthemlighet. Reglerna är oförändrade (useDefault = true); bara de kända +# platshållar-/fixturformerna undantas, inte hela kataloger med test- eller dokkod. +# +# Owner: Simon Axelsson · Expiry: 2027-06-30 · Ref: APP CONFIG RT/SEC-01-avstämning 2026-11-15 +[extend] +useDefault = true + +[allowlist] +description = "Accounteds dokumentplatshållare (slutar på ...) och UUID-formade testfixturer; granskade 2026-11-15, inga riktiga hemligheter" +regexes = [ + # Documentation placeholders — published examples, never usable keys. + '''gnubok_sk_[a-z_]*\.\.\.''', + '''whsec_[a-z0-9]+\.\.\.''', + # Test fixtures: invite tokens and idempotency keys minted in tests only + # (gnubok_inv_tok123, idem1234-5050-4abc-8def-1234567890ab, acc_inv_price_inv-1_123456). + '''gnubok_inv_[A-Za-z0-9]+''', + '''idem[0-9]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}''', + '''acc_inv_price_[a-z0-9_-]+''', + # UUID-shaped values used as test fixtures. Accounted's real credential format is + # gnubok_sk_..., so a bare UUID is never an Accounted secret. + '''[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}''', + # Translation keys match the generic-api-key heuristic but carry no secret + # (the extracted Secret is the bare key, e.g. desc_ink2_declaration). + '''desc_[a-z0-9_]+''', +] +paths = [ + # Vendor names in prose (e.g. "SalesLoft/Drift OAuth supply chain") trip generic-api-key. + '''\.claude/skills/.*\.md''', +] -- 2.54.0 From 9d2805653159955ba410d64b5f4e8d431be4a14b Mon Sep 17 00:00:00 2001 From: Claude Code Date: Sun, 15 Nov 2026 19:39:58 +0100 Subject: [PATCH 2/5] =?UTF-8?q?fix(deps):=20Trivy-gaten=20gr=C3=B6n=20?= =?UTF-8?q?=E2=80=94=20dompurify/source-map-js/undici=20patchade,=20nodema?= =?UTF-8?q?iler=2010.0.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Säkerhetsgaten (security / scan) föll på Trivy fs, inte på gitleaks: 8 fynd i package-lock.json (1 CRITICAL, 7 HIGH). dompurify 3.4.14 -> 3.4.18 GHSA-cg2g-xh64-v4q7 (CRITICAL), GHSA-mrv2-3pqr-j5jr nodemailer 9.1.1 -> 10.0.6 CVE-2026-90776, GHSA-v53p-9fqp-m79j source-map-js 1.2.1 -> 1.2.2 CVE-2026-93749 undici 6.29.0 -> 6.29.1 CVE-2026-109383, CVE-2026-109869, CVE-2026-87018 dompurify, source-map-js och undici är transitiva (posthog-js, tailwind/postcss, @ai-sdk/provider-utils) och pinnas med overrides. nodemailer är en direkt dependency och bumpas till 10.x: de kvarvarande 9.x-advisories är bara fixade där, vilket PINNED_DEPS-posten redan slog fast som en separat granskad PR — det här är den PR:en. Den 10.0-API som används (createTransport/sendMail) är oförändrad; email-sviten (99 tester) och hela unit-sviten (22 339) är gröna, check:types/check:lint/check:guards likaså. Verifierat: trivy fs --severity HIGH,CRITICAL -> 0 vulnerabilities, 0 secrets, 0 misconfigurations. Revert: git revert (återställer package.json, package-lock.json och PINNED_DEPS-posten tillsammans). --- package-lock.json | 28 +++++++++++++------------- package.json | 7 +++++-- scripts/checks/no-new-antipatterns.mjs | 9 ++++++--- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/package-lock.json b/package-lock.json index 750fbab1..81fe95bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,7 +45,7 @@ "next": "^16.4.1", "next-intl": "^4.13.2", "next-themes": "^0.4.6", - "nodemailer": "9.1.1", + "nodemailer": "10.0.6", "pdf-lib": "^1.17.1", "posthog-js": "^1.407.3", "posthog-node": "^5.46.1", @@ -9946,9 +9946,9 @@ } }, "node_modules/dompurify": { - "version": "3.4.14", - "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.14.tgz", - "integrity": "sha512-dVoH9z+MY+C9IilgGCk3YfFqjLi3fChm2OiKJMzh6axrJ5qwxqWaZamgmHrpv22CN/KdbZJuGEGgfQoL00LTdg==", + "version": "3.4.18", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.18.tgz", + "integrity": "sha512-ofe3wI/uNm68HInABYFJYqQxRw1EaKAjNdrFVKqjUY+UZurvNd2L/HuQe097s/4RivWiZyP6tT7aoT8atjfhwg==", "license": "(MPL-2.0 OR Apache-2.0)", "optionalDependencies": { "@types/trusted-types": "^2.0.7" @@ -14003,12 +14003,12 @@ } }, "node_modules/nodemailer": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-9.1.1.tgz", - "integrity": "sha512-izw9mVKFix6YSnC9eLgV6g1opl9DUlRio9ZNcq+Wu9Ujn2UwF+8Nl0B8nz22kEC+CTZCvinkxwJ0DeFbb6NwcQ==", + "version": "10.0.6", + "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-10.0.6.tgz", + "integrity": "sha512-2u7OHvEQVVGvPo9Yhw/eN3xMO2Gnj2U2fGDP0BDpnRwJR//65AfGRQDiJqxix28gFRBvMqi2USA13x6RrfWuGg==", "license": "MIT-0", "engines": { - "node": ">=6.0.0" + "node": ">=20.0.0" } }, "node_modules/normalize-svg-path": { @@ -15659,9 +15659,9 @@ "license": "ISC" }, "node_modules/source-map-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", + "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" @@ -16937,9 +16937,9 @@ "license": "MIT" }, "node_modules/undici": { - "version": "6.29.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.29.0.tgz", - "integrity": "sha512-R+RODBqp6i2pPflGdq+xIOUkl+RNfGgHwoinecKu/JCuf2uO06cOKoDbI2P7Dn6KcswdKwrczbU6IYJ6K8X+wg==", + "version": "6.29.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.29.1.tgz", + "integrity": "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA==", "license": "MIT", "engines": { "node": ">=18.17" diff --git a/package.json b/package.json index bc4d6197..c6e88745 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "next": "^16.4.1", "next-intl": "^4.13.2", "next-themes": "^0.4.6", - "nodemailer": "9.1.1", + "nodemailer": "10.0.6", "pdf-lib": "^1.17.1", "posthog-js": "^1.407.3", "posthog-node": "^5.46.1", @@ -110,6 +110,9 @@ "overrides": { "html-to-text": "10.0.1", "sharp": "^0.35.3", - "postcss": "^8.5.18" + "postcss": "^8.5.18", + "dompurify": "^3.4.17", + "source-map-js": "^1.2.2", + "undici": "^6.29.1" } } diff --git a/scripts/checks/no-new-antipatterns.mjs b/scripts/checks/no-new-antipatterns.mjs index 60088b76..6a11dc70 100644 --- a/scripts/checks/no-new-antipatterns.mjs +++ b/scripts/checks/no-new-antipatterns.mjs @@ -758,12 +758,15 @@ const PINNED_DEPS = [ }, { name: 'nodemailer', - version: '9.1.1', + version: '10.0.6', reason: 'SMTP mailer for self-hosts (extensions/general/email/lib/smtp-service.ts). Zero-dependency MIT-0 ' + 'package on the outbound-mail path; bumps are deliberate, reviewed PRs (audit surface), never silent. ' + - 'Bumped 9.0.5 -> 9.1.1 (2026-09-30) for HIGH advisories GHSA-2x7j-588g-ccc2 / GHSA-8m3c-c648-2xjj, ' + - 'same major; the rest of the 9.x advisories are only fixed in 10.x (major, separate reviewed PR).', + 'Bumped 9.0.5 -> 9.1.1 (2026-09-30) for HIGH advisories GHSA-2x7j-588g-ccc2 / GHSA-8m3c-c648-2xjj. ' + + 'Bumped 9.1.1 -> 10.0.6 (2026-11-15): the remaining 9.x advisories (CVE-2026-90776 header DoS, ' + + 'GHSA-v53p-9fqp-m79j addressparser backtracking) are only fixed in 10.x, and Trivy failed the ' + + 'security gate on them. The 10.0 API used here (createTransport + sendMail) is unchanged; the ' + + 'smtp-service suite covers the transport options that matter (requireTLS, AUTH, envelope).', }, ] -- 2.54.0 From 9482d64aa27809d50fe84f4c717c902bf1313382 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Sun, 15 Nov 2026 19:56:30 +0100 Subject: [PATCH 3/5] =?UTF-8?q?fix(deps):=20OSV-gaten=20gr=C3=B6n=20?= =?UTF-8?q?=E2=80=94=2024=20s=C3=A5rbarheter=20st=C3=A4ngda,=20xlsx=20unda?= =?UTF-8?q?ntagen=20med=20bevis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OSV Scanner (steg 6 i security-gaten) fällde jobbet efter att Trivy blivit grönt: 43 advisory-poster över 10 paket. Samma skanning mot origin/main ger 9 av 10 paket — posterna publicerades mot versioner vi redan kör, så main hade blivit röd vid nästa nattliga skanning oavsett denna PR. Bumpat (alla verifierade med osv-scanner och hela unit-sviten): nodemailer 10.0.6/10.0.10 -> 10.1.4 (direkt + override för mailparser) zod 4.4.3 -> 4.6.7 (^4.6.6) vite 8.1.3 -> 8.3.8 (override ^8.1.6, dev via vitest) vitest 4.1.11 -> 4.1.12 (^4.1.12, tar @vitest/mocker 4.1.12) @babel/core 7.28.6 -> 7.29.13 (override, dev via eslint-plugin-react-hooks) fast-xml-parser 5.7.2 -> 5.12.1 (override, via @aws-sdk/xml-builder) minimatch 9.0.9 -> 11.0.8 (override, dev via typescript-eslint) postcss-selector-parser 6.0.10 -> 6.1.6 (override, via @tailwindcss/typography) python-multipart -> >=0.0.31 (explicit floor i mcp-builder-skillens requirements.txt; OSV kan inte lösa en otransitiv, opinnad requirement) xlsx 0.20.3 undantas i osv-scanner.toml med effectiveUntil 2027-05-15: GHSA-4r6h-8v6p-xvw6 och GHSA-5pgg-2g8v-p4x9 har introduced:0 och INGET fixed-event (kontrollerat mot api.osv.dev), eftersom SheetJS slutade publicera till npm efter 0.18.5. Vi pinnar 0.20.3 från cdn.sheetjs.com, som redan innehåller båda fixarna (0.19.3 / 0.20.2). Skanningen rapporterar alltså en versionsupplösningsartefakt. Filen varnar uttryckligen om att lib/import/* parsar användaruppladdade arbetsböcker, så undantaget får inte läsas som tillstånd att acceptera ofixade parser-CVE:er. Verifiering: osv-scanner --config=osv-scanner.toml -> "No issues found" rc=0; 1687 filer / 22 400 tester gröna; check:types 533/533; check:lint 0 fel; check:guards passed; Trivy 0 fynd. Revert: git revert . Enda beteendepåverkande posten är osv-scanner.toml (utan den blir gaten röd igen på xlsx); minimatch 9 -> 11 används bara av lint-kedjan och verifieras av check:lint + sviten. --- .../mcp-builder/scripts/requirements.txt | 4 + changes/2026-11-15-osv-gaten-gron.md | 84 ++ osv-scanner.toml | 34 + package-lock.json | 882 ++++++++++-------- package.json | 22 +- scripts/checks/no-new-antipatterns.mjs | 9 +- 6 files changed, 629 insertions(+), 406 deletions(-) create mode 100644 changes/2026-11-15-osv-gaten-gron.md create mode 100644 osv-scanner.toml diff --git a/.claude/skills/mcp-builder/scripts/requirements.txt b/.claude/skills/mcp-builder/scripts/requirements.txt index e73e5d1e..31652c0f 100644 --- a/.claude/skills/mcp-builder/scripts/requirements.txt +++ b/.claude/skills/mcp-builder/scripts/requirements.txt @@ -1,2 +1,6 @@ anthropic>=0.39.0 mcp>=1.1.0 +# Transitive via mcp (multipart form parsing). Pinned as a floor because the +# advisory scanner cannot resolve an unpinned requirement and reports the +# oldest version it can match; 0.0.31 carries the PYSEC-2026 multipart fixes. +python-multipart>=0.0.31 diff --git a/changes/2026-11-15-osv-gaten-gron.md b/changes/2026-11-15-osv-gaten-gron.md new file mode 100644 index 00000000..f997c1dd --- /dev/null +++ b/changes/2026-11-15-osv-gaten-gron.md @@ -0,0 +1,84 @@ +# Accounted: OSV-gaten grön — 24 sårbarheter stängda, xlsx undantagen med bevis (2026-11-15) + +`security / scan` var röd på PR #44 även efter att Trivy-steget blivit grönt. +Steg 6, **OSV Scanner**, fällde jobbet. + +## Fynd + +`ghcr.io/google/osv-scanner:v2.7.1` mot `package-lock.json` + +`.claude/skills/mcp-builder/scripts/requirements.txt`: **43 advisory-poster över +10 paket**. Viktigt för rotorsaken: samma skanning mot `origin/main`s låsfil ger +**9 av 10 paket** — det här var inte något PR:en införde. Nya GHSA/PYSEC-poster +publicerades mot versioner vi redan kör, så `main` hade blivit röd vid nästa +nattliga skanning (02:17) oavsett. + +| Paket | Före | Efter | Väg | +|---|---|---|---| +| nodemailer | 10.0.6 (direkt) + 10.0.10 (mailparser) | **10.1.4** | direkt dependency + override | +| zod | 4.4.3 | **4.6.7** | `^4.6.6` | +| vite | 8.1.3 | **8.3.8** | override `^8.1.6` (dev, via vitest) | +| vitest / @vitest/mocker | 4.1.11 / 4.1.11 | **4.1.12 / 4.1.12** | `^4.1.12` | +| @babel/core | 7.28.6 | **7.29.13** | override `^7.29.6` (dev, via eslint-plugin-react-hooks) | +| fast-xml-parser | 5.7.2 | **5.12.1** | override `^5.12.0` (via @aws-sdk/xml-builder) | +| minimatch | 9.0.9 | **11.0.8** | override `^11.0.1` (dev, via typescript-eslint) | +| postcss-selector-parser | 6.0.10 | **6.1.6** | override `^6.1.5` (via @tailwindcss/typography) | +| python-multipart | olöst (otransitiv, (ospecificerad) | **>=0.0.31** | explicit floor i skillens requirements.txt | +| xlsx | 0.20.3 | 0.20.3 | **undantagen** — se nedan | + +## xlsx: undantaget, inte bortförklarat + +Båda posterna (`GHSA-4r6h-8v6p-xvw6` = CVE-2023-30533 prototype pollution, +`GHSA-5pgg-2g8v-p4x9` = CVE-2024-22363 ReDoS) har `introduced: 0` och **inget +`fixed`-event** — kontrollerat direkt mot `api.osv.dev` 2026-11-15. Det betyder +inte "ofixat", det betyder "ingen npm-version bär fixen": SheetJS slutade +publicera till npm efter 0.18.5 och släpper 0.19+ från `cdn.sheetjs.com`. + +Repot konsumerar `xlsx` som URL-dependency +(`https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz`), och 0.20.3 innehåller +båda fixarna (0.19.3 respektive 0.20.2). Skanningen rapporterar alltså en +versionsupplösningsartefakt, inte en levande defekt. + +Hanteringen är inte en tyst tystnad: `osv-scanner.toml` med två `IgnoredVulns`, +`effectiveUntil = 2027-05-15` och full motivering, plus en uttrycklig varning i +filen om att `lib/import/*` parsar användaruppladdade arbetsböcker — undantaget +får aldrig läsas som tillstånd att acceptera ofixade parser-CVE:er. När SheetJS +publicerar 0.21+, eller vi migrerar till en underhållen parser, ska filen bort. + +## Ändring + +- `package.json`: nodemailer `10.1.4`; zod `^4.6.6`; vitest `^4.1.12`; overrides + utökade med `nodemailer` (mailparser-subträdet), `@babel/core`, + `fast-xml-parser`, `minimatch`, `postcss-selector-parser`, `vite`. +- `package-lock.json`: omgenererad med `npm install --no-audit --no-fund`. +- `.claude/skills/mcp-builder/scripts/requirements.txt`: explicit + `python-multipart>=0.0.31` med kommentar om varför en floor behövs (OSV kan + inte lösa en otransitiv, opinnad requirement och rapporterar den äldsta + version den kan matcha). +- `osv-scanner.toml`: ny, se ovan. +- `scripts/checks/no-new-antipatterns.mjs`: PINNED_DEPS nodemailer → `10.1.4` + med motiveringen uppdaterad (9.x → 10.1.4 i två steg samma dag). + +Notera att arbetsflödet redan skickar `--config` när `osv-scanner.toml` finns +(`.gitea/workflows/security.yml`), så ingen CI-ändring behövdes. + +## Verifiering + +- `osv-scanner scan source --recursive --config=osv-scanner.toml .` → + **No issues found**, rc=0 (2 filtrerade, båda xlsx, med utskriven motivering). +- `npx vitest run --project unit` → **1687 filer / 22 400 tester passed**, + 3 filer/5 tester skipped, 163 s (efter alla bumps: zod 4.6, vite 8.3, + vitest 4.1.12, minimatch 11, @babel 7.29). +- `npm run check:types` → OK (533 fel, baseline 533). `check:lint` → 0 fel. + `check:guards` → passed (pinned-dep 0). +- Trivy fs HIGH/CRITICAL: 0 vulnerabilitets-, secret- och misconfig-fynd. + +## Revert + +``` +git revert +``` + +Enda beteendepåverkande posten är `osv-scanner.toml` (om den tas bort blir +gaten röd igen på xlsx). Paketbumparna är patch/minor utom `minimatch` 9 → 11, +som bara används av lint-verktygskedjan och verifieras av `check:lint` + +testsviten. diff --git a/osv-scanner.toml b/osv-scanner.toml new file mode 100644 index 00000000..c76d764a --- /dev/null +++ b/osv-scanner.toml @@ -0,0 +1,34 @@ +# osv-scanner configuration. Read by .gitea/workflows/security.yml, which passes +# --config when this file exists. +# +# The two entries below are the SheetJS advisories. They are ignored because the +# fix is not obtainable from npm at any version: SheetJS stopped publishing to +# the npm registry after 0.18.5 and ships 0.19+ from cdn.sheetjs.com, so both +# GHSA records have `introduced: 0` and no `fixed` event (verified against +# api.osv.dev 2026-11-15). This repo consumes `xlsx` as a URL dependency, +# https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz, and 0.20.3 already +# contains both fixes: +# +# GHSA-4r6h-8v6p-xvw6 (CVE-2023-30533, prototype pollution) — fixed upstream in 0.19.3 +# GHSA-5pgg-2g8v-p4x9 (CVE-2024-22363, ReDoS) — fixed upstream in 0.20.2 +# +# So the scanner is reporting a version-resolution artefact, not a live defect. +# The entries still expire: if we ever pin an older tarball, or migrate to a +# maintained parser, this file must be revisited rather than inherited. Owner: +# admin/accounted maintainers. Expiry is deliberate; the nightly scan re-reports +# both advisories the day it passes. +# +# Deliberately NOT in scope here: the prototype-pollution and ReDoS classes are +# about parsing untrusted workbooks, and lib/import/* does exactly that. The +# mitigations are upstream (both fixed in our pinned version) — do not treat +# this file as permission to accept unfixed parser CVEs. + +[[IgnoredVulns]] +id = "GHSA-4r6h-8v6p-xvw6" +effectiveUntil = 2027-05-15 +reason = "CVE-2023-30533 fixed upstream in SheetJS 0.19.3; we pin 0.20.3 from cdn.sheetjs.com. No npm release carries the fix, so no version can satisfy the advisory." + +[[IgnoredVulns]] +id = "GHSA-5pgg-2g8v-p4x9" +effectiveUntil = 2027-05-15 +reason = "CVE-2024-22363 fixed upstream in SheetJS 0.20.2; we pin 0.20.3 from cdn.sheetjs.com. No npm release carries the fix, so no version can satisfy the advisory." diff --git a/package-lock.json b/package-lock.json index 81fe95bf..5ad5f508 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,7 +45,7 @@ "next": "^16.4.1", "next-intl": "^4.13.2", "next-themes": "^0.4.6", - "nodemailer": "10.0.6", + "nodemailer": "10.1.4", "pdf-lib": "^1.17.1", "posthog-js": "^1.407.3", "posthog-node": "^5.46.1", @@ -64,7 +64,7 @@ "tailwind-merge": "^3.6.0", "web-push": "^3.6.7", "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz", - "zod": "^4.4.3" + "zod": "^4.6.6" }, "devDependencies": { "@tailwindcss/postcss": "^4", @@ -84,7 +84,7 @@ "tailwindcss": "^4", "tsx": "4.20.5", "typescript": "^5", - "vitest": "^4.1.9" + "vitest": "^4.1.12" } }, "node_modules/@ai-sdk/gateway": { @@ -2171,13 +2171,13 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.28.6.tgz", - "integrity": "sha512-JYgintcMjRiCvS8mMECzaEn+m3PfoQiyqukOMCCVQtoJGYJw8j/8LBJEiqkHLkfwCcs74E3pbAUFNg7d9VNJ+Q==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", + "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-validator-identifier": "^7.28.5", + "@babel/helper-validator-identifier": "^7.29.7", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" }, @@ -2186,9 +2186,9 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.6.tgz", - "integrity": "sha512-2lfu57JtzctfIrcGMz992hyLlByuzgIk58+hhGCxjKZ3rWI82NnVLjXcaTqkI2NvlcvOskZaiZ5kjUALo3Lpxg==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz", + "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==", "dev": true, "license": "MIT", "engines": { @@ -2196,21 +2196,21 @@ } }, "node_modules/@babel/core": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.6.tgz", - "integrity": "sha512-H3mcG6ZDLTlYfaSNi0iOKkigqMFvkTKlGUYlD8GW7nNOYRrevuA46iTypPyv+06V3fEmvvazfntkBU34L0azAw==", + "version": "7.29.13", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.13.tgz", + "integrity": "sha512-j1nvOQCZYSgp7HLmisnCXFTpVvFODiijQ9QHkORfGKWH6YDtskTEeCJS7eV545GZ9UBzrq0e2xsOd5QQ5PjIqw==", "dev": true, "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.28.6", - "@babel/generator": "^7.28.6", - "@babel/helper-compilation-targets": "^7.28.6", - "@babel/helper-module-transforms": "^7.28.6", - "@babel/helpers": "^7.28.6", - "@babel/parser": "^7.28.6", - "@babel/template": "^7.28.6", - "@babel/traverse": "^7.28.6", - "@babel/types": "^7.28.6", + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.13", + "@babel/helper-compilation-targets": "^7.29.13", + "@babel/helper-module-transforms": "^7.29.13", + "@babel/helpers": "^7.29.13", + "@babel/parser": "^7.29.13", + "@babel/template": "^7.29.7", + "@babel/traverse": "^7.29.13", + "@babel/types": "^7.29.11", "@jridgewell/remapping": "^2.3.5", "convert-source-map": "^2.0.0", "debug": "^4.1.0", @@ -2227,14 +2227,14 @@ } }, "node_modules/@babel/generator": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.28.6.tgz", - "integrity": "sha512-lOoVRwADj8hjf7al89tvQ2a1lf53Z+7tiXMgpZJL3maQPDxh0DgLMN62B2MKUOFcoodBHLMbDM6WAbKgNy5Suw==", + "version": "7.29.14", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.14.tgz", + "integrity": "sha512-qSY56jgW5JnSXzuekLVil6zaOQxOCtOHidr65KkaMBw772IuAY28Qx4ZykAcDn8+FRF15qk80XzKwgSc/RYW6g==", "dev": true, "license": "MIT", "dependencies": { - "@babel/parser": "^7.28.6", - "@babel/types": "^7.28.6", + "@babel/parser": "^7.29.14", + "@babel/types": "^7.29.14", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" @@ -2244,14 +2244,14 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz", - "integrity": "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==", + "version": "7.29.13", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.13.tgz", + "integrity": "sha512-8WxJ4/Vmes3ghacj8VOJy3NW8eyHiFY/4thU/LSBuBE470+igjR/j1ZTNn8fV5VdNrLx6iXUwig526UdOvfP0w==", "dev": true, "license": "MIT", "dependencies": { - "@babel/compat-data": "^7.28.6", - "@babel/helper-validator-option": "^7.27.1", + "@babel/compat-data": "^7.29.7", + "@babel/helper-validator-option": "^7.29.7", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" @@ -2261,9 +2261,9 @@ } }, "node_modules/@babel/helper-globals": { - "version": "7.28.0", - "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", - "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz", + "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==", "dev": true, "license": "MIT", "engines": { @@ -2271,29 +2271,29 @@ } }, "node_modules/@babel/helper-module-imports": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.28.6.tgz", - "integrity": "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz", + "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==", "dev": true, "license": "MIT", "dependencies": { - "@babel/traverse": "^7.28.6", - "@babel/types": "^7.28.6" + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.6.tgz", - "integrity": "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==", + "version": "7.29.14", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.14.tgz", + "integrity": "sha512-2XDvQVd9JESaOgGc4jT2/jquTAO7ppA5noTZQqH+MmZ89yjCzScLwtCPbWtkPZylL+TLWR49IwWmk+QkRR4GsA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-module-imports": "^7.28.6", - "@babel/helper-validator-identifier": "^7.28.5", - "@babel/traverse": "^7.28.6" + "@babel/helper-module-imports": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7", + "@babel/traverse": "^7.29.14" }, "engines": { "node": ">=6.9.0" @@ -2303,9 +2303,9 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", - "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "version": "7.29.14", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.14.tgz", + "integrity": "sha512-CXvKMFvM80ihI7Vox9jb+kQjnyjESQNPM+vB7U0Zz6TWuZA+Z/FL0QPMH300h33qJtIx+REeBhXqWOPW48TcAQ==", "dev": true, "license": "MIT", "engines": { @@ -2313,9 +2313,9 @@ } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", - "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", "dev": true, "license": "MIT", "engines": { @@ -2323,9 +2323,9 @@ } }, "node_modules/@babel/helper-validator-option": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", - "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz", + "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==", "dev": true, "license": "MIT", "engines": { @@ -2333,27 +2333,27 @@ } }, "node_modules/@babel/helpers": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.28.6.tgz", - "integrity": "sha512-xOBvwq86HHdB7WUDTfKfT/Vuxh7gElQ+Sfti2Cy6yIWNW05P8iUslOVcZ4/sKbE+/jQaukQAdz/gf3724kYdqw==", + "version": "7.29.14", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.14.tgz", + "integrity": "sha512-6E3Mi1r0B0umq6vmZa4/78q+64fqO2YY0THUdjDPKUCKhNb0yQy5NQIaPHCSD3ryTgiTss//P4JsWS80AsZ6LQ==", "dev": true, "license": "MIT", "dependencies": { - "@babel/template": "^7.28.6", - "@babel/types": "^7.28.6" + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.14" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.6.tgz", - "integrity": "sha512-TeR9zWR18BvbfPmGbLampPMW+uW1NZnJlRuuHso8i87QZNq2JRF9i6RgxRqtEq+wQGsS19NNTWr2duhnE49mfQ==", + "version": "7.29.14", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.14.tgz", + "integrity": "sha512-VL220vXuyO2z3rNIQwY7ftj9UwpqOt+33sH+sBWkOekbsSR2g7EEMnOx24ZlCH0xOA3DM/33SifVFGbnJD8r/w==", "dev": true, "license": "MIT", "dependencies": { - "@babel/types": "^7.28.6" + "@babel/types": "^7.29.14" }, "bin": { "parser": "bin/babel-parser.js" @@ -2372,33 +2372,33 @@ } }, "node_modules/@babel/template": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.28.6.tgz", - "integrity": "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz", + "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.28.6", - "@babel/parser": "^7.28.6", - "@babel/types": "^7.28.6" + "@babel/code-frame": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/types": "^7.29.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.28.6.tgz", - "integrity": "sha512-fgWX62k02qtjqdSNTAGxmKYY/7FSL9WAS1o2Hu5+I5m9T0yxZzr4cnrfXQ/MX0rIifthCSs6FKTlzYbJcPtMNg==", + "version": "7.29.14", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.14.tgz", + "integrity": "sha512-RAdQJrBgmIH1FWvN0X+1hoDxzMzlP4cv/1Zi4dn4tG1H0cTb+rw7CzUxQJhp1f4ANd8j5vH3fy8BAWFGkBDEsA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.28.6", - "@babel/generator": "^7.28.6", - "@babel/helper-globals": "^7.28.0", - "@babel/parser": "^7.28.6", - "@babel/template": "^7.28.6", - "@babel/types": "^7.28.6", + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.14", + "@babel/helper-globals": "^7.29.7", + "@babel/parser": "^7.29.14", + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.14", "debug": "^4.3.1" }, "engines": { @@ -2406,14 +2406,14 @@ } }, "node_modules/@babel/types": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.6.tgz", - "integrity": "sha512-0ZrskXVEHSWIqZM/sQZ4EV3jZJXRkio/WCxaqKZP1g//CEWEPSfeZFcms4XeKBCHU0ZKnIkdJeU/kF+eRp5lBg==", + "version": "7.29.14", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.14.tgz", + "integrity": "sha512-UjI/dKmwJwT9pOszJitq2G6EObZPnsZUfdCr92z2TlF3EZK9J3EdfOKUrCzHl6wFthbzwhzl1Soc/UIwxRiq6w==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-string-parser": "^7.27.1", - "@babel/helper-validator-identifier": "^7.28.5" + "@babel/helper-string-parser": "^7.29.14", + "@babel/helper-validator-identifier": "^7.29.7" }, "engines": { "node": ">=6.9.0" @@ -3290,6 +3290,13 @@ "url": "https://opencollective.com/libvips" } }, + "node_modules/@isaacs/nonrecursive-glob-match": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@isaacs/nonrecursive-glob-match/-/nonrecursive-glob-match-1.1.0.tgz", + "integrity": "sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.13", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", @@ -3604,13 +3611,13 @@ } }, "node_modules/@oxc-project/types": { - "version": "0.138.0", - "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.138.0.tgz", - "integrity": "sha512-1a7ZKmrRTCoN1XMZ4L0PyyqrMnrNlLyPuOkdSX2MZg7IiIGRUyurNhAm73ptDOraoBcIordsIGKNPKUzy3ZmfA==", + "version": "0.156.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.156.0.tgz", + "integrity": "sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==", "dev": true, "license": "MIT", "funding": { - "url": "https://github.com/sponsors/Boshen" + "url": "https://github.com/sponsors/oxc-project" } }, "node_modules/@parcel/watcher": { @@ -5025,10 +5032,27 @@ } } }, + "node_modules/@rolldown/binding-android-arm-eabi": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.19.tgz", + "integrity": "sha512-e+Ebe0WT+9tbXmNKPIiC8YrWAHYwug3m6i4p3rZGGulfZri1jtI4HslT+OZnFf/OIHowWF71DTlHwXBP2SiA7A==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, "node_modules/@rolldown/binding-android-arm64": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.1.4.tgz", - "integrity": "sha512-EZLpf/8y7GXkkra90ML47kzik/GMP3EMcE9bPyHmRfxLC6z9+aW5A8poCsoxjrT5GfEcNAAvWwUHjvP1pUQkfw==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.19.tgz", + "integrity": "sha512-hOombrTJ+szt2ciEzS7oCA78lMPBgF5UMQWCJIyNfnrI7GLl8HYoFqCnpL2gcPOaXMqryGCU5ExdQKyDDcC+yA==", "cpu": [ "arm64" ], @@ -5043,9 +5067,9 @@ } }, "node_modules/@rolldown/binding-darwin-arm64": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.1.4.tgz", - "integrity": "sha512-aUi+HBvmYb7j8krl1+qJgkG8C17fO79gk3c+jPw4S8glRFc1DTija9S3EyaTSQUm5GJXYKDAsugBEhFHH2vYiQ==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.19.tgz", + "integrity": "sha512-XoMA2pwCKGTQzUjPgtRwkedH4WmXhdIPKT6l6oOxd1PUbNodGI6DcBekgN7EC//+x3pfBYX/qL1gNmZAqivw5g==", "cpu": [ "arm64" ], @@ -5060,9 +5084,9 @@ } }, "node_modules/@rolldown/binding-darwin-x64": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.1.4.tgz", - "integrity": "sha512-F7hHC3gwY11+vByKPRWqwGbeXWVgKmL+pTGCinaEhdihzBV2aQ0fvZOch9cXYUOKuKKq429HeYXOqQLc7wFCEg==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.19.tgz", + "integrity": "sha512-zo8EsSSwMZCY/e+fRnGaX02YGgvJD0yvhNi/9hpGPA2MJ9ZF8dPCw75UGfpI6OpQ/myR/dIYmogRvqiZD0TrXg==", "cpu": [ "x64" ], @@ -5077,9 +5101,9 @@ } }, "node_modules/@rolldown/binding-freebsd-x64": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.1.4.tgz", - "integrity": "sha512-sI5yw+7s92SK6odiEhD5lKCBlWcpjHS5qyqpVQbZAJ0fIzEUXrmbl3DH2ybR3PZogulNJF+COLtmA8hUfvkCCQ==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.19.tgz", + "integrity": "sha512-O8ISAOfI1nj7AuBPd30FSF47z7f7lzlk5poQVGgiikvQuGEBFYvW8ki+UEnT+YJPnNGjQzn304klt4O9FUE7mA==", "cpu": [ "x64" ], @@ -5094,9 +5118,9 @@ } }, "node_modules/@rolldown/binding-linux-arm-gnueabihf": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.1.4.tgz", - "integrity": "sha512-mCi0OKgEieFircrtVYmQAFGszRtMnZ6fpZAXrxanXAu7lqZcsK1E1RAaZNG0uKAnxox3B1f4EyQNnoyMfN1vAA==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.19.tgz", + "integrity": "sha512-/lYCba5NO0yq4S0jGMH8QTBtkvQxoXjoQWzF5BcWp9MjB9jxVRD1GQDNofkVjcOj30DWyhLIN/4Oe60JKzaONw==", "cpu": [ "arm" ], @@ -5111,13 +5135,16 @@ } }, "node_modules/@rolldown/binding-linux-arm64-gnu": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.1.4.tgz", - "integrity": "sha512-B9Ial3Kv5sh0SHnB1g/QWcUQCEvCF6QKGAl4zXypYj65mVI+B4AhFBwPtSN7pDrJeIx8Z7zdy4ntx+wQABom7w==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.19.tgz", + "integrity": "sha512-pm/apFMBnSbFb3O6nG5pHO1iqHhZrjGDFEjSm+ot9J17XXPvH9L90y5h+jgfHCE+Qdlsvy8qKEcU4VKxgjD+vA==", "cpu": [ "arm64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -5128,13 +5155,16 @@ } }, "node_modules/@rolldown/binding-linux-arm64-musl": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.1.4.tgz", - "integrity": "sha512-lZVym0PuHE1KZ22gmFTC15lAkrg9iTszR617oYRB/iPY1A56ywoJzVKOJBKaot5RiikCObmur6pogpse3gRcng==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.19.tgz", + "integrity": "sha512-K1SmQp3FFichn8oqrNIwvFoZ5wcvjC7goBzpaMNvLf9FZc+QB/QvLmnpJZgAAGHiD980tP8FZZnXk2K94rvlxg==", "cpu": [ "arm64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -5145,13 +5175,16 @@ } }, "node_modules/@rolldown/binding-linux-ppc64-gnu": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.1.4.tgz", - "integrity": "sha512-t2DNiLJWNTbnEHyUzTumldML6ET4/g16467LZoDDJ3tSxGvguL5/NyC2lCsNKuyRycg9XeDQF5SSv+TNOhQEXg==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.19.tgz", + "integrity": "sha512-I0xwD57jP/3A7+5UPZin2w8Y7XHEmEM5zqpYZOcQ45MlNW6tUJUziymV3yRr7rL4vwyfEcRsRksC4a7Kc08p5Q==", "cpu": [ "ppc64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -5162,13 +5195,16 @@ } }, "node_modules/@rolldown/binding-linux-s390x-gnu": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.1.4.tgz", - "integrity": "sha512-0WIRnL1Uw4BvTZRLQt+PVgo6ZKTJadlC2btP+/EOXv2f/DWbY0rEgl+y834mIVwP1FkTlWVTrGGJXf12lru7EQ==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.19.tgz", + "integrity": "sha512-BrtEHT24SNXj9HiXqy+s/kXiSiQGt6EKCPUlRirAoIioVxKGnbXBUEkbZASAei7iZJB0/Ynm+0JP00Ipx7AnSw==", "cpu": [ "s390x" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -5179,13 +5215,16 @@ } }, "node_modules/@rolldown/binding-linux-x64-gnu": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.1.4.tgz", - "integrity": "sha512-JWtGshGfX+oENAKonoNkqEJX+7hC8yfhi9GUyPX1VX4mdh1y5r+ZiJLR5XzAB0aoP6s/PcILsGjKq8O0mm24bw==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.19.tgz", + "integrity": "sha512-rm75/9DkHKeU2WnA8w4X94WGYgLlDCFCfkQC+4bguVJmC/jvDRv2B+2wLOYhyE0fVuv7//Ckk39OoOufyCu76Q==", "cpu": [ "x64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -5196,13 +5235,16 @@ } }, "node_modules/@rolldown/binding-linux-x64-musl": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.1.4.tgz", - "integrity": "sha512-rT6yQcxUuXs4CnbofqwHRRV0iem349rLMYpTjkgQGLjrY4ado/eDzwPZPTCgTOlF6Nkp8NEv70yLMTn6qkWxsQ==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.19.tgz", + "integrity": "sha512-irh/4+iYFM4GAzpluDErgjz89bj6NDtqqMAG/6O1LG38Ed3NpyebzCpcVNkFW8uhy+/3/BocUvnXDR33CXWe9A==", "cpu": [ "x64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -5213,9 +5255,9 @@ } }, "node_modules/@rolldown/binding-openharmony-arm64": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.1.4.tgz", - "integrity": "sha512-KXMGoboq5cyaCQjDA4GLuRiOwBQ0EyFnJoVViLeZ45/3rFItRODEr+NdsBcVpll40hhNArlm/speWGRvj08LzA==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.19.tgz", + "integrity": "sha512-+KWTWNoPt+CfSq94CiceWu3yPE+QzkaG+phPyz9G60tmZLwfQkcA4AeksafzvJAw4pvg1mcd5a1TkUqVv0s4JA==", "cpu": [ "arm64" ], @@ -5230,9 +5272,9 @@ } }, "node_modules/@rolldown/binding-wasm32-wasi": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.1.4.tgz", - "integrity": "sha512-5K83rb36oJiY7BCyE9zLZtGcPV4g5wvq+xwdO0XPIwDVZI8cyB/AUjkNXGb92/rnmezEkjMOpgY61rtwjQtFwg==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.2.19.tgz", + "integrity": "sha512-7EH+skOsl5qpWnK0vzamgJFhOv1cwxQpsxm8tI883K9fur5c27p8q87fzEO6BbBPabA2/+s/zR63/pLc137iOg==", "cpu": [ "wasm32" ], @@ -5240,18 +5282,41 @@ "license": "MIT", "optional": true, "dependencies": { - "@emnapi/core": "1.11.1", - "@emnapi/runtime": "1.11.1", - "@napi-rs/wasm-runtime": "^1.1.6" + "@emnapi/core": "2.0.0-beta.2", + "@emnapi/runtime": "2.0.0-beta.2", + "@napi-rs/wasm-runtime": "1.2.6" }, "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + } + }, + "node_modules/@rolldown/binding-wasm32-wasi/node_modules/@emnapi/core": { + "version": "2.0.0-beta.2", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-2.0.0-beta.2.tgz", + "integrity": "sha512-MzCVoWtcg4Pm2B3je5mMvYMvj3MmBKw+fU7vbsJc9/iT8ip6/eYIHo/Dsm/mr+wsHB6SEyJDuxB09Yy6r/8+4A==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "2.2.0", + "tslib": "^2.4.0" } }, "node_modules/@rolldown/binding-wasm32-wasi/node_modules/@emnapi/runtime": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.1.tgz", - "integrity": "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw==", + "version": "2.0.0-beta.2", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-2.0.0-beta.2.tgz", + "integrity": "sha512-JcrSPzPvZuNZvJqPTF9Fw25LbOJ8avzFVlaf2grmH4Cku0oGP47tRgqPZadcfj3YoZMHkFVnCYFbQM8I+i5QEw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@rolldown/binding-wasm32-wasi/node_modules/@emnapi/wasi-threads": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-2.2.0.tgz", + "integrity": "sha512-JP7OYH38Q7+pyTAe14raZHLQIK7BDKbdwji+Xi3pcd/6QkJYQH3SX4wu6EplGrGJWRepoNzedfm0G3B9Z4e9Rw==", "dev": true, "license": "MIT", "optional": true, @@ -5260,28 +5325,31 @@ } }, "node_modules/@rolldown/binding-wasm32-wasi/node_modules/@napi-rs/wasm-runtime": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.6.tgz", - "integrity": "sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.6.tgz", + "integrity": "sha512-mRyDmEw9/fCDXCGfL1sbgIw/GUK0PVxRW4YwgPN61F3LQ+fSyoBFarJVzgGyhF6kRzEQZ0FejDqm4WLXSeqQmw==", "dev": true, "license": "MIT", "optional": true, "dependencies": { "@tybys/wasm-util": "^0.10.3" }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + }, "funding": { "type": "github", "url": "https://github.com/sponsors/Brooooooklyn" }, "peerDependencies": { - "@emnapi/core": "^1.7.1", - "@emnapi/runtime": "^1.7.1" + "@emnapi/core": "^1.7.1 || 2.0.0-beta.2", + "@emnapi/runtime": "^1.7.1 || 2.0.0-beta.2" } }, "node_modules/@rolldown/binding-win32-arm64-msvc": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.1.4.tgz", - "integrity": "sha512-PnWBtw3TV5KOg69HQQDR0mnQuyCmSGR2pAB4DC1rPF808fgKeTUMj2EOEyKATpgiuxuR5APQmiDO7PDgEjTFSA==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.19.tgz", + "integrity": "sha512-3Q1Yg1Q7tEvBWoZf5rFvG/GKZQPgwfru+p4wBajDfJFBs0SHCpL++dfTjW9gyAKd1T7ZpIYvdaUax7Pa/IhFVQ==", "cpu": [ "arm64" ], @@ -5296,9 +5364,9 @@ } }, "node_modules/@rolldown/binding-win32-x64-msvc": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.1.4.tgz", - "integrity": "sha512-M1lpniBePobTfsa7Ks9a199e1akxsXn+GYBUKsEzv3YFzOm1HJAMNwKI3qr0Zq+mxwx9gOZoTdP1yXRYsZUocQ==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.19.tgz", + "integrity": "sha512-y/sqRRc6d7hECzOFc5n3LSeqctmIp9mMjY1Kq4s14uLPd/LZ4z7i1zrW6fMtp2mPeuQIC4e6ULMcwQzMomqQag==", "cpu": [ "x64" ], @@ -5313,9 +5381,9 @@ } }, "node_modules/@rolldown/pluginutils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", - "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.1.1.tgz", + "integrity": "sha512-glFIJDvLNDtJhT9qrMFWLPbvS+skxgt4L0K8Ei2YtnhPysAJnsI7nyxSJxKj4ADeKX0OLjC4ntRkwpLOoS3rwA==", "dev": true, "license": "MIT" }, @@ -8132,32 +8200,6 @@ "typescript": ">=4.8.4 <6.0.0" } }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { - "version": "2.1.7", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.7.tgz", - "integrity": "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { - "version": "9.0.9", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz", - "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.2" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { "version": "7.7.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", @@ -8569,16 +8611,16 @@ } }, "node_modules/@vitest/expect": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.11.tgz", - "integrity": "sha512-VX2x5vNJXET47KAFzwERI+KRMtTTCSWTfSMKsW7JsUsXV4psq++e3DvZpuTDOpHcxytiDs6p2nhVb2tVDiiUYw==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.12.tgz", + "integrity": "sha512-vFlTt+YEu9WBpNjdGayNmlMVzrWPi1+sv853/7t2FU7hpO5gAFBKHzQmkCq5Xjpr+evegF2994LQT3hF3mRlqQ==", "dev": true, "license": "MIT", "dependencies": { "@standard-schema/spec": "^1.1.0", "@types/chai": "^5.2.2", - "@vitest/spy": "4.1.11", - "@vitest/utils": "4.1.11", + "@vitest/spy": "4.1.12", + "@vitest/utils": "4.1.12", "chai": "^6.2.2", "tinyrainbow": "^3.1.0" }, @@ -8587,13 +8629,13 @@ } }, "node_modules/@vitest/mocker": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.11.tgz", - "integrity": "sha512-2XJVD55d1o5AZous5CCGKS74g/riOj9odEt2bQpCVZeblHyHdnMeFl4jl0XjU21stf4mbjUkew2eXQZt65g5CQ==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.12.tgz", + "integrity": "sha512-fKShNpKZzupWZuY0z7egydvL0sqW4INEZBEExMBMAa6izlENEVHwoXgdaTCaBZ5fwlr4xf2o1wXC83n9RpO+NA==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/spy": "4.1.11", + "@vitest/spy": "4.1.12", "estree-walker": "^3.0.3", "magic-string": "^0.30.21" }, @@ -8614,9 +8656,9 @@ } }, "node_modules/@vitest/pretty-format": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.11.tgz", - "integrity": "sha512-yiZzPbGTS9Sr/JpFl8zHrcIkAofNbFV6k21vIgQN/cY/oxZeXhJv5sc/MBJ5jFKWmWs+oJHw0UXLZjmf931+Vw==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.12.tgz", + "integrity": "sha512-XW9O8+Mxx4VpCtkYdMJLZQQwsVryP9wk7cPKDxtXFfwSak6yRh5+2fep/Y0XF/ElBvJHq8bcYdi6aeuai0opZA==", "dev": true, "license": "MIT", "dependencies": { @@ -8627,13 +8669,13 @@ } }, "node_modules/@vitest/runner": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.11.tgz", - "integrity": "sha512-LztvUgdwMNJMIkj3hQnnxiC2Xy1zNxq928W/xhjCLaNCzqTZOudjwbQf6v9IntZGPw132i2Lq2rgTRZHD3JHNw==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.12.tgz", + "integrity": "sha512-NKlVKCr5QnCe8jijdMnmkpHHU+WTqiLFR6G0pHji9uRjXK9xJl1k1nTw6F3pOOj2PDcsDt2GKQMI7wIsaT491w==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/utils": "4.1.11", + "@vitest/utils": "4.1.12", "pathe": "^2.0.3" }, "funding": { @@ -8641,14 +8683,14 @@ } }, "node_modules/@vitest/snapshot": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.11.tgz", - "integrity": "sha512-pN7ikn1ON7h8ee4gIAp4AzyK+zBtJPzVbqOgu5LCEh4VaJVbPQcgYQYJIMGQPXVeJJq1fnfazis7a5pFNPahog==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.12.tgz", + "integrity": "sha512-ko1y1Qgb/slzQ9mr+b89Cuqud8WG1TKtsPD8r7ZUBdvVOGt85Af2HwCqHujrhwJq95hs/9RM7fcAPg57o1vlzw==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "4.1.11", - "@vitest/utils": "4.1.11", + "@vitest/pretty-format": "4.1.12", + "@vitest/utils": "4.1.12", "magic-string": "^0.30.21", "pathe": "^2.0.3" }, @@ -8657,9 +8699,9 @@ } }, "node_modules/@vitest/spy": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.11.tgz", - "integrity": "sha512-apNa/prQy2qCeywhnixOHPRCgGNhvg7T4Dapfl1GahLp/R+uhBm5cPyFoNVyqsNd2h1nJxL6BqqdIjiABL60YA==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.12.tgz", + "integrity": "sha512-RGq9x4JNGNTZHEJxvN0oSiJjeSCExm0n2gZKKJZHY9cX5AVA6M7VJILBT3ZJ/tJ/0J9uWT7fETV9/btoi//vSg==", "dev": true, "license": "MIT", "funding": { @@ -8667,13 +8709,13 @@ } }, "node_modules/@vitest/utils": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.11.tgz", - "integrity": "sha512-zTCVGpyFsGWBhllOyKlTw/vnr6D9qxsfSDyfbyZmTyjHw5N/VuvzHpHoQjm2ZJzn4RJgx5w4r7V0er69CmLgPQ==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.12.tgz", + "integrity": "sha512-Q3awXrwOfEV+qc3WmO5ONyE0yO7Q1gQ9/oyHxGLZ/pl7N3NO/ZztqQwKLuwMkV+CA1JYSIeO3gkHnRDIo4AVaA==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "4.1.11", + "@vitest/pretty-format": "4.1.12", "convert-source-map": "^2.0.0", "tinyrainbow": "^3.1.0" }, @@ -8789,6 +8831,18 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/anynum": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/anynum/-/anynum-1.0.1.tgz", + "integrity": "sha512-N6//FLET/tXYNM/F6ABca1oH6fWB+KlTt909Le28WMDBk8oaT4vY17DCrwg2MvmuqUKt3Ni4N5dGJ/EoBgcO6A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT" + }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -9063,11 +9117,14 @@ } }, "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", "dev": true, - "license": "MIT" + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } }, "node_modules/base64-js": { "version": "1.5.1", @@ -9090,9 +9147,9 @@ "license": "MIT" }, "node_modules/baseline-browser-mapping": { - "version": "2.11.20", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.20.tgz", - "integrity": "sha512-H0ulySigv6icDJ1F7SjtdCD6PrhTpdYCmP0CactWy1+ekh0AFd0o1Wn5T8b+hnTmdBx19u9yhL6wvCylXMY7zw==", + "version": "2.11.37", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.37.tgz", + "integrity": "sha512-QYph+vfurmaxhNwi9FprfmtkT5cx2Keg8FzZ0vnjO8ukscIybVyZGMFwdllKGlTI6qyU8ck43OM9UXh+IFJihQ==", "license": "Apache-2.0", "bin": { "baseline-browser-mapping": "dist/cli.cjs" @@ -9123,14 +9180,16 @@ "license": "MIT" }, "node_modules/brace-expansion": { - "version": "1.1.21", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.21.tgz", - "integrity": "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==", + "version": "5.0.13", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.13.tgz", + "integrity": "sha512-Vh3dmFbc4wZeox7M9I/0L9GfFd83Su4+yCck/OF9Gi/P/dAHn0RT7X4K9R7gMNMhDck3DvhR6QXsnQdjjgwNvQ==", "dev": true, "license": "MIT", "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" } }, "node_modules/braces": { @@ -9165,9 +9224,9 @@ } }, "node_modules/browserslist": { - "version": "4.28.8", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.8.tgz", - "integrity": "sha512-V2NpofLblG64mfOtSgDhOJESZEGogzDMBv/q+W6oc4LXWP/q75eOXoOaaOu1EOadB9U4Bwx/e0yzbvwKH8zalA==", + "version": "4.29.5", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.5.tgz", + "integrity": "sha512-khTmKu5NGYTotqcYo8Bew2k4RAE9PuXRSFRXG2lQBrCEQHyeQ/vX6gKMxfokwywBsLiXZMnHsmWMG1pnO8J7uQ==", "dev": true, "funding": [ { @@ -9185,11 +9244,11 @@ ], "license": "MIT", "dependencies": { - "baseline-browser-mapping": "^2.11.12", - "caniuse-lite": "^1.0.30001809", - "electron-to-chromium": "^1.5.402", - "node-releases": "^2.0.53", - "update-browserslist-db": "^1.3.0" + "baseline-browser-mapping": "^2.11.33", + "caniuse-lite": "^1.0.30001819", + "electron-to-chromium": "^1.5.464", + "node-releases": "^2.0.60", + "update-browserslist-db": "^1.3.4" }, "bin": { "browserslist": "cli.js" @@ -9274,9 +9333,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001810", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz", - "integrity": "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==", + "version": "1.0.30001826", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001826.tgz", + "integrity": "sha512-wTB+9tIbLro/BCXwLuNV1meHE4L9dS6dArMDwgYfNBPMYScqClHyGunhkCSDtHhe/69Xl0sHlKgBVZ+fNsYtWA==", "funding": [ { "type": "opencollective", @@ -9304,9 +9363,9 @@ } }, "node_modules/chai": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz", - "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.3.0.tgz", + "integrity": "sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==", "dev": true, "license": "MIT", "engines": { @@ -9466,13 +9525,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true, - "license": "MIT" - }, "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", @@ -9525,18 +9577,6 @@ "node": ">= 8" } }, - "node_modules/cssesc": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", - "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", - "license": "MIT", - "bin": { - "cssesc": "bin/cssesc" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/csstype": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", @@ -10006,9 +10046,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.420", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.420.tgz", - "integrity": "sha512-2yD6XreGusOfNV+dUcvipJEXc3n/n7fgr7996aszTG+YY5E4mqM4tOq/3uhP129cazL9YHbVWSpc79ePotWtPA==", + "version": "1.5.486", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.486.tgz", + "integrity": "sha512-rpybw4Ac4ak/An6G1Me2+61xzwobowDGyuJe71QHHOVpkZv4fPVobsLl7WH6zHSKusAMpaHxGKTpOvpy7+r3dQ==", "dev": true, "license": "ISC" }, @@ -10819,9 +10859,9 @@ "license": "Unlicense" }, "node_modules/fast-xml-builder": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.1.9.tgz", - "integrity": "sha512-jcyKVSEX13iseJqg7n/KWw+xnu/7fdrZ333Fac54KjHDIELVCfDDJXYIm6DTJ0Su4gSzrhqiK0DzY/wZbF40mw==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.3.2.tgz", + "integrity": "sha512-OX91VSlShLPDgRZV7tk/YQ4l8tT75QziF5Ixg8g4PFbCVPjuTWwN+yQfAxLJ0dufJpprdOd6HlM74Jhd39TcBQ==", "funding": [ { "type": "github", @@ -10830,13 +10870,14 @@ ], "license": "MIT", "dependencies": { - "path-expression-matcher": "^1.1.3" + "path-expression-matcher": "^1.6.2", + "xml-naming": "^0.3.0" } }, "node_modules/fast-xml-parser": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.7.2.tgz", - "integrity": "sha512-P7oW7tLbYnhOLQk/Gv7cZgzgMPP/XN03K02/Jy6Y/NHzyIAIpxuZIM/YqAkfiXFPxA2CTm7NtCijK9EDu09u2w==", + "version": "5.12.1", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.12.1.tgz", + "integrity": "sha512-wR8dO/fx+z8C5exuem1e7BKOWvjsuzvjS/tvA/Xu3Z1zQqJGcXrPzXbcAiaMgp2KjreEROcTkmnnisrcmJ2hYQ==", "funding": [ { "type": "github", @@ -10845,15 +10886,29 @@ ], "license": "MIT", "dependencies": { - "@nodable/entities": "^2.1.0", - "fast-xml-builder": "^1.1.5", - "path-expression-matcher": "^1.5.0", - "strnum": "^2.2.3" + "@nodable/entities": "^3.1.0", + "fast-xml-builder": "^1.3.2", + "is-unsafe": "^2.0.3", + "path-expression-matcher": "^1.6.2", + "strnum": "^2.5.1", + "xml-naming": "^0.3.0" }, "bin": { "fxparser": "src/cli/cli.js" } }, + "node_modules/fast-xml-parser/node_modules/@nodable/entities": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@nodable/entities/-/entities-3.1.0.tgz", + "integrity": "sha512-LsS/DjHr+uDM647Gru/cA8+J3a3HfhttwCKLyuoyN7yXTFCxKBtSgMQBvrW9yNPa2/zDRUNuGPaH5QUFoa4arQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/nodable" + } + ], + "license": "MIT" + }, "node_modules/fastq": { "version": "1.20.1", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz", @@ -12085,6 +12140,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-unsafe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-unsafe/-/is-unsafe-2.0.3.tgz", + "integrity": "sha512-ZBllczCCO267vgdFb6Tq3pv+LhHaCiGMdr+ZsuL+OopruAg7S+3ZDs1vD0RPC0uSrkjzbraxaGjtX1YBxjPeFQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT" + }, "node_modules/is-url": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/is-url/-/is-url-1.2.4.tgz", @@ -12817,15 +12884,6 @@ "node": ">=20.0.0" } }, - "node_modules/mailparser/node_modules/nodemailer": { - "version": "10.0.10", - "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-10.0.10.tgz", - "integrity": "sha512-He9XskOFms62SyAKkLu8CcGcYHAo+BSHSsORI8s4PJH8qZgZY4L4lDfvyN0twvmbpyG+eGrxpyBlskj9d9rJ8A==", - "license": "MIT-0", - "engines": { - "node": ">=20.0.0" - } - }, "node_modules/markdown-table": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.4.tgz", @@ -13728,16 +13786,20 @@ "license": "ISC" }, "node_modules/minimatch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", - "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "version": "11.0.8", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.8.tgz", + "integrity": "sha512-nFQuYSTVrGvysVBps5Ih+0BdnYFN/Cj3C816r6+p7yK+FHrVLGE4O4N9AFwykrlNlvM2HYt+Rad1Uiro6h88Ig==", "dev": true, - "license": "ISC", + "license": "BlueOak-1.0.0", "dependencies": { - "brace-expansion": "^1.1.7" + "@isaacs/nonrecursive-glob-match": "^1.1.0", + "brace-expansion": "^5.0.12" }, "engines": { - "node": "*" + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/minimist": { @@ -13993,9 +14055,9 @@ "license": "MIT" }, "node_modules/node-releases": { - "version": "2.0.54", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.54.tgz", - "integrity": "sha512-YHs7BmmcsdAI5Ozuf8JZo6PT0mv2GIWC9vMfvUC3dp65M8hn7Ux8CPL+2oBI7juNuj9d0ndhTcznq2ODBps9cQ==", + "version": "2.0.64", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.64.tgz", + "integrity": "sha512-zAPCKqMcnqs2nGy6nlkm7JduFseiBJy3EXHGLh+8pFR+TxGCBxxiEN21+UROU5CKwX/f4TlUcYjiM+vs/tsyxw==", "dev": true, "license": "MIT", "engines": { @@ -14003,9 +14065,9 @@ } }, "node_modules/nodemailer": { - "version": "10.0.6", - "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-10.0.6.tgz", - "integrity": "sha512-2u7OHvEQVVGvPo9Yhw/eN3xMO2Gnj2U2fGDP0BDpnRwJR//65AfGRQDiJqxix28gFRBvMqi2USA13x6RrfWuGg==", + "version": "10.1.4", + "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-10.1.4.tgz", + "integrity": "sha512-EsMnOR2oRv4LGnWvHgcVYkkQ4O2j8KO4WTw6l+PHR4sOXo8SAgIraxtEnGDmotjbhv0hDsu3IuDIFZm8iXwO4A==", "license": "MIT-0", "engines": { "node": ">=20.0.0" @@ -14303,9 +14365,9 @@ } }, "node_modules/path-expression-matcher": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.5.0.tgz", - "integrity": "sha512-cbrerZV+6rvdQrrD+iGMcZFEiiSrbv9Tfdkvnusy6y0x0GKBXREFg/Y65GhIfm0tnLntThhzCnfKwp1WRjeCyQ==", + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.6.2.tgz", + "integrity": "sha512-enSlaiat05iasnzmgNxRj8reFdj3puY2QpNgP1aPIaVfT6nn9ICuPoFlKHk8EN22HcwewshO+mN2DGbkCEOtqQ==", "funding": [ { "type": "github", @@ -14552,12 +14614,11 @@ } }, "node_modules/postcss-selector-parser": { - "version": "6.0.10", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz", - "integrity": "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==", + "version": "6.1.6", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.6.tgz", + "integrity": "sha512-BK87/Qgti3DIcgS2PaCVoteFIkjIFvCJBizZDIVSjdlFNg4Jv+SRqbN2JONb/qQUH4ZFqfXYF+izg15W2HVRvA==", "license": "MIT", "dependencies": { - "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" }, "engines": { @@ -15252,13 +15313,13 @@ } }, "node_modules/rolldown": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.1.4.tgz", - "integrity": "sha512-IjZYiLxZwpnhwhdBH2ugdTGVSdhCQUmLxLoqyjiL0JxYjyRst+5a0P3xfrTxJ5F638j4Mvvw5FAX5XE6eHpXbA==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.19.tgz", + "integrity": "sha512-QIiV1J9d0pzN4jeeTH4sjPy0AZ6cAy2cG0ExeoE1+U8Rvj+hR3gYkokx0YbeUNGlZqiQJJ2utcETe0oKXwzsuA==", "dev": true, "license": "MIT", "dependencies": { - "@oxc-project/types": "=0.138.0", + "@oxc-project/types": "=0.156.0", "@rolldown/pluginutils": "^1.0.0" }, "bin": { @@ -15268,21 +15329,22 @@ "node": "^20.19.0 || >=22.12.0" }, "optionalDependencies": { - "@rolldown/binding-android-arm64": "1.1.4", - "@rolldown/binding-darwin-arm64": "1.1.4", - "@rolldown/binding-darwin-x64": "1.1.4", - "@rolldown/binding-freebsd-x64": "1.1.4", - "@rolldown/binding-linux-arm-gnueabihf": "1.1.4", - "@rolldown/binding-linux-arm64-gnu": "1.1.4", - "@rolldown/binding-linux-arm64-musl": "1.1.4", - "@rolldown/binding-linux-ppc64-gnu": "1.1.4", - "@rolldown/binding-linux-s390x-gnu": "1.1.4", - "@rolldown/binding-linux-x64-gnu": "1.1.4", - "@rolldown/binding-linux-x64-musl": "1.1.4", - "@rolldown/binding-openharmony-arm64": "1.1.4", - "@rolldown/binding-wasm32-wasi": "1.1.4", - "@rolldown/binding-win32-arm64-msvc": "1.1.4", - "@rolldown/binding-win32-x64-msvc": "1.1.4" + "@rolldown/binding-android-arm-eabi": "1.2.19", + "@rolldown/binding-android-arm64": "1.2.19", + "@rolldown/binding-darwin-arm64": "1.2.19", + "@rolldown/binding-darwin-x64": "1.2.19", + "@rolldown/binding-freebsd-x64": "1.2.19", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.19", + "@rolldown/binding-linux-arm64-gnu": "1.2.19", + "@rolldown/binding-linux-arm64-musl": "1.2.19", + "@rolldown/binding-linux-ppc64-gnu": "1.2.19", + "@rolldown/binding-linux-s390x-gnu": "1.2.19", + "@rolldown/binding-linux-x64-gnu": "1.2.19", + "@rolldown/binding-linux-x64-musl": "1.2.19", + "@rolldown/binding-openharmony-arm64": "1.2.19", + "@rolldown/binding-wasm32-wasi": "1.2.19", + "@rolldown/binding-win32-arm64-msvc": "1.2.19", + "@rolldown/binding-win32-x64-msvc": "1.2.19" } }, "node_modules/run-parallel": { @@ -15941,16 +16003,19 @@ } }, "node_modules/strnum": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/strnum/-/strnum-2.2.3.tgz", - "integrity": "sha512-oKx6RUCuHfT3oyVjtnrmn19H1SiCqgJSg+54XqURKp5aCMbrXrhLjRN9TjuwMjiYstZ0MzDrHqkGZ5dFTKd+zg==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-2.5.1.tgz", + "integrity": "sha512-UM4nTLWzQiDBseVxUGxN0wJzIk0UU89Qi7pKXz9qISo+lhviJikTuikBsK/oFRlpvYHvSdz0TVoLyQ+sEpYwxA==", "funding": [ { "type": "github", "url": "https://github.com/sponsors/NaturalIntelligence" } ], - "license": "MIT" + "license": "MIT", + "dependencies": { + "anynum": "^1.0.1" + } }, "node_modules/style-to-js": { "version": "1.1.21", @@ -16152,9 +16217,9 @@ } }, "node_modules/tinyrainbow": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.1.0.tgz", - "integrity": "sha512-Bf+ILmBgretUrdJxzXM0SgXLZ3XfiaUuOj/IKQHuTXip+05Xn+uyEYdVg0kYDipTBcLrCVyUzAPz7QmArb0mmw==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.2.0.tgz", + "integrity": "sha512-LgO3D9yZJjApUiuUfl9iFAwrtaX4+lok3wJIqttGoKCHlWUqHqbQpnxCf82L8FjgKsh4iGo78hqJwgL8F6To2A==", "dev": true, "license": "MIT", "engines": { @@ -17101,9 +17166,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.2.tgz", - "integrity": "sha512-UQ+MSxlhRm1bzjhU+DcuXfjFO1FzNtqhK5+9Yvlp90ItDLk5vT932A0rFu619nf7RVS+Y/VeaUW1jaRDqZ8VJw==", + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.4.tgz", + "integrity": "sha512-t8wonIOdQyOjtPd2VktlBu6QjTVTks6v8bSi7kd0r2Vll8TK1JYDZtRRdbmCHOAMphkZgrzK+L+vXK4pyZ8t4A==", "dev": true, "funding": [ { @@ -17271,16 +17336,16 @@ } }, "node_modules/vite": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/vite/-/vite-8.1.3.tgz", - "integrity": "sha512-Ds+gBRbj0lwRO2Y5hwnUBdxSwlAve9LeRyU4sNnAr0ewW0gWF0n5bgXgUzbgZ49MV9BVUAQUFYVcDUcilUExMA==", + "version": "8.3.8", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.8.tgz", + "integrity": "sha512-LzOn3h9rG/0vhLdXrV4yJ4QFA9eEoqCl+Yx+kGJd7aB9w6nfNgVHKSYwLPZUHrz4ZGa+t+kXjV9itvcHDLQouA==", "dev": true, "license": "MIT", "dependencies": { - "lightningcss": "^1.32.0", - "picomatch": "^4.0.4", - "postcss": "^8.5.16", - "rolldown": "~1.1.3", + "lightningcss": "^1.33.0", + "picomatch": "^4.0.7", + "postcss": "^8.5.32", + "rolldown": "~1.2.18", "tinyglobby": "^0.2.17" }, "bin": { @@ -17297,7 +17362,7 @@ }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", - "@vitejs/devtools": "^0.3.0", + "@vitejs/devtools": "^0.7.1 || ^0.8.0", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", @@ -17363,9 +17428,9 @@ } }, "node_modules/vite/node_modules/lightningcss": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz", - "integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", + "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", "dev": true, "license": "MPL-2.0", "dependencies": { @@ -17379,23 +17444,23 @@ "url": "https://opencollective.com/parcel" }, "optionalDependencies": { - "lightningcss-android-arm64": "1.32.0", - "lightningcss-darwin-arm64": "1.32.0", - "lightningcss-darwin-x64": "1.32.0", - "lightningcss-freebsd-x64": "1.32.0", - "lightningcss-linux-arm-gnueabihf": "1.32.0", - "lightningcss-linux-arm64-gnu": "1.32.0", - "lightningcss-linux-arm64-musl": "1.32.0", - "lightningcss-linux-x64-gnu": "1.32.0", - "lightningcss-linux-x64-musl": "1.32.0", - "lightningcss-win32-arm64-msvc": "1.32.0", - "lightningcss-win32-x64-msvc": "1.32.0" + "lightningcss-android-arm64": "1.33.0", + "lightningcss-darwin-arm64": "1.33.0", + "lightningcss-darwin-x64": "1.33.0", + "lightningcss-freebsd-x64": "1.33.0", + "lightningcss-linux-arm-gnueabihf": "1.33.0", + "lightningcss-linux-arm64-gnu": "1.33.0", + "lightningcss-linux-arm64-musl": "1.33.0", + "lightningcss-linux-x64-gnu": "1.33.0", + "lightningcss-linux-x64-musl": "1.33.0", + "lightningcss-win32-arm64-msvc": "1.33.0", + "lightningcss-win32-x64-msvc": "1.33.0" } }, "node_modules/vite/node_modules/lightningcss-android-arm64": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.32.0.tgz", - "integrity": "sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", + "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", "cpu": [ "arm64" ], @@ -17414,9 +17479,9 @@ } }, "node_modules/vite/node_modules/lightningcss-darwin-arm64": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.32.0.tgz", - "integrity": "sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", + "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", "cpu": [ "arm64" ], @@ -17435,9 +17500,9 @@ } }, "node_modules/vite/node_modules/lightningcss-darwin-x64": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.32.0.tgz", - "integrity": "sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", + "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", "cpu": [ "x64" ], @@ -17456,9 +17521,9 @@ } }, "node_modules/vite/node_modules/lightningcss-freebsd-x64": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.32.0.tgz", - "integrity": "sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", + "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", "cpu": [ "x64" ], @@ -17477,9 +17542,9 @@ } }, "node_modules/vite/node_modules/lightningcss-linux-arm-gnueabihf": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.32.0.tgz", - "integrity": "sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", + "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", "cpu": [ "arm" ], @@ -17498,13 +17563,16 @@ } }, "node_modules/vite/node_modules/lightningcss-linux-arm64-gnu": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.32.0.tgz", - "integrity": "sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", + "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", "cpu": [ "arm64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MPL-2.0", "optional": true, "os": [ @@ -17519,13 +17587,16 @@ } }, "node_modules/vite/node_modules/lightningcss-linux-arm64-musl": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.32.0.tgz", - "integrity": "sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", + "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", "cpu": [ "arm64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MPL-2.0", "optional": true, "os": [ @@ -17540,13 +17611,16 @@ } }, "node_modules/vite/node_modules/lightningcss-linux-x64-gnu": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.32.0.tgz", - "integrity": "sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", + "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", "cpu": [ "x64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MPL-2.0", "optional": true, "os": [ @@ -17561,13 +17635,16 @@ } }, "node_modules/vite/node_modules/lightningcss-linux-x64-musl": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.32.0.tgz", - "integrity": "sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", + "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", "cpu": [ "x64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MPL-2.0", "optional": true, "os": [ @@ -17582,9 +17659,9 @@ } }, "node_modules/vite/node_modules/lightningcss-win32-arm64-msvc": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.32.0.tgz", - "integrity": "sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", + "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", "cpu": [ "arm64" ], @@ -17603,9 +17680,9 @@ } }, "node_modules/vite/node_modules/lightningcss-win32-x64-msvc": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.32.0.tgz", - "integrity": "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", + "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", "cpu": [ "x64" ], @@ -17624,9 +17701,9 @@ } }, "node_modules/vite/node_modules/picomatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz", - "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", "dev": true, "license": "MIT", "engines": { @@ -17637,19 +17714,19 @@ } }, "node_modules/vitest": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.11.tgz", - "integrity": "sha512-fhACrNXUidIbGSBr5FlbuBkO7VWC1ZyLl0DO4CU2DrQoAPxX84Ysxs+HeGQpii5lZWV1Q4gBZTTu49mF+A6Edw==", + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.12.tgz", + "integrity": "sha512-5eWdz2yb3ajxWF3C8C4TjkXl7FGm3n2E/VlazALrQHzK7nYMSGFnCZto0bbPNl77AwkOZVLk0YnBAejUu0NiWA==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/expect": "4.1.11", - "@vitest/mocker": "4.1.11", - "@vitest/pretty-format": "4.1.11", - "@vitest/runner": "4.1.11", - "@vitest/snapshot": "4.1.11", - "@vitest/spy": "4.1.11", - "@vitest/utils": "4.1.11", + "@vitest/expect": "4.1.12", + "@vitest/mocker": "4.1.12", + "@vitest/pretty-format": "4.1.12", + "@vitest/runner": "4.1.12", + "@vitest/snapshot": "4.1.12", + "@vitest/spy": "4.1.12", + "@vitest/utils": "4.1.12", "es-module-lexer": "^2.0.0", "expect-type": "^1.3.0", "magic-string": "^0.30.21", @@ -17677,12 +17754,12 @@ "@edge-runtime/vm": "*", "@opentelemetry/api": "^1.9.0", "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", - "@vitest/browser-playwright": "4.1.11", - "@vitest/browser-preview": "4.1.11", - "@vitest/browser-webdriverio": "4.1.11", - "@vitest/coverage-istanbul": "4.1.11", - "@vitest/coverage-v8": "4.1.11", - "@vitest/ui": "4.1.11", + "@vitest/browser-playwright": "4.1.12", + "@vitest/browser-preview": "4.1.12", + "@vitest/browser-webdriverio": "^4.1.11", + "@vitest/coverage-istanbul": "4.1.12", + "@vitest/coverage-v8": "4.1.12", + "@vitest/ui": "4.1.12", "happy-dom": "*", "jsdom": "*", "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" @@ -17928,6 +18005,21 @@ "node": ">=0.8" } }, + "node_modules/xml-naming": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/xml-naming/-/xml-naming-0.3.0.tgz", + "integrity": "sha512-ghig2TBE/H11aOVgmahA3MhimvkBr6JIYknH/Dhdk10nXwdbIqBJsbfMxpvFPG8bAw77gN29aQWvKpmVoPlvPQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT", + "engines": { + "node": ">=16.0.0" + } + }, "node_modules/xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", @@ -18070,9 +18162,9 @@ } }, "node_modules/zod": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz", - "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==", + "version": "4.6.7", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz", + "integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" diff --git a/package.json b/package.json index c6e88745..394764ce 100644 --- a/package.json +++ b/package.json @@ -56,17 +56,17 @@ "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "date-fns": "^4.4.0", - "motion": "^12.42.2", "fuse.js": "^7.4.2", "ics": "^3.12.0", "js-yaml": "4.3.2", "jszip": "^3.10.1", "lucide-react": "^1.24.0", "mailparser": "^3.9.14", + "motion": "^12.42.2", "next": "^16.4.1", "next-intl": "^4.13.2", "next-themes": "^0.4.6", - "nodemailer": "10.0.6", + "nodemailer": "10.1.4", "pdf-lib": "^1.17.1", "posthog-js": "^1.407.3", "posthog-node": "^5.46.1", @@ -85,7 +85,7 @@ "tailwind-merge": "^3.6.0", "web-push": "^3.6.7", "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz", - "zod": "^4.4.3" + "zod": "^4.6.6" }, "devDependencies": { "@tailwindcss/postcss": "^4", @@ -105,14 +105,20 @@ "tailwindcss": "^4", "tsx": "4.20.5", "typescript": "^5", - "vitest": "^4.1.9" + "vitest": "^4.1.12" }, "overrides": { - "html-to-text": "10.0.1", - "sharp": "^0.35.3", - "postcss": "^8.5.18", + "@babel/core": "^7.29.6", "dompurify": "^3.4.17", + "fast-xml-parser": "^5.12.0", + "html-to-text": "10.0.1", + "minimatch": "^11.0.1", + "nodemailer": "10.1.4", + "postcss": "^8.5.18", + "postcss-selector-parser": "^6.1.5", + "sharp": "^0.35.3", "source-map-js": "^1.2.2", - "undici": "^6.29.1" + "undici": "^6.29.1", + "vite": "^8.1.6" } } diff --git a/scripts/checks/no-new-antipatterns.mjs b/scripts/checks/no-new-antipatterns.mjs index 6a11dc70..99227627 100644 --- a/scripts/checks/no-new-antipatterns.mjs +++ b/scripts/checks/no-new-antipatterns.mjs @@ -758,15 +758,18 @@ const PINNED_DEPS = [ }, { name: 'nodemailer', - version: '10.0.6', + version: '10.1.4', reason: 'SMTP mailer for self-hosts (extensions/general/email/lib/smtp-service.ts). Zero-dependency MIT-0 ' + 'package on the outbound-mail path; bumps are deliberate, reviewed PRs (audit surface), never silent. ' + 'Bumped 9.0.5 -> 9.1.1 (2026-09-30) for HIGH advisories GHSA-2x7j-588g-ccc2 / GHSA-8m3c-c648-2xjj. ' + - 'Bumped 9.1.1 -> 10.0.6 (2026-11-15): the remaining 9.x advisories (CVE-2026-90776 header DoS, ' + + 'Bumped 9.1.1 -> 10.1.4 (2026-11-15): the remaining 9.x advisories (CVE-2026-90776 header DoS, ' + 'GHSA-v53p-9fqp-m79j addressparser backtracking) are only fixed in 10.x, and Trivy failed the ' + 'security gate on them. The 10.0 API used here (createTransport + sendMail) is unchanged; the ' + - 'smtp-service suite covers the transport options that matter (requireTLS, AUTH, envelope).', + 'smtp-service suite covers the transport options that matter (requireTLS, AUTH, envelope). ' + + '10.0.6 -> 10.1.4 the same day: OSV flagged 10.0.6 and the mailparser subtree pin 10.0.10 ' + + '(GHSA-4ffr-jq9g-5ffx, GHSA-85x2-q946-cp5h, GHSA-8c8m-p3m8-cjg8, GHSA-g73g-hqqh-jr95, ' + + 'GHSA-m943-m63m-w62w); 10.1.4 is the first release with all five.', }, ] -- 2.54.0 From c3a2ace8463c114a4f27e5f932809d2a45c73a53 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Sun, 15 Nov 2026 19:56:45 +0100 Subject: [PATCH 4/5] =?UTF-8?q?feat(cron):=20missad-tick-detektion=20?= =?UTF-8?q?=E2=80=94=20heartbeat=20per=20schema,=20503=20n=C3=A4r=20ett=20?= =?UTF-8?q?jobb=20slutar=20komma?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Den 2026-11-15 tappade accounted-cron 1 497 av 10 455 körningar på ett dygn (14,3 %) när pids_limit 30 fick fork/exec /bin/sh att misslyckas. supercronic hoppade tyst över tickarna. Containern var Up hela tiden, appen svarade 200 på allt, och enda spåret var cron-containerns egen logg. Orsaken är fixad i #43; det här gör att ett tappat jobb SYNS nästa gång. Tre luckor stängs: 1. Ingen körningshistorik — with-cron-context loggade men skrev inget beständigt, så en körning som aldrig startade lämnade inget spår. 2. Cron-tjänstens healthcheck var `ps ax | grep supercronic`, som bara blir röd när processen dör, inte när scheman slutar köra. 3. Ingen hade kodifierat vad "för sen" betyder per schema. Implementering: - lib/cron/cron-interval.ts: tolkare för 5-fälters cron (det enda vercel.json använder) som räknar ut VÄRSTA gapet i sekunder över ett 12-årsfönster (behövs för 29 februari), inte medelgapet. Okänd syntax kastar hellre än gissar. - scripts/generate-crontabs.ts skriver nu även lib/cron/schedules.generated.ts (path + schedule + maxIntervalSeconds) från samma vercel.json-array som crontaben, så en schemalagd path som kontrollen inte känner till inte kan uppstå. Drift-testet jämför filen byte för byte. - supabase/migrations/20261115190000_cron_heartbeats.sql: en rad per path (declared_at, last_started_at, last_completed_at, last_status, last_http_status, last_duration_ms). RLS på, noll policies: instansglobal schemaläggning är inte tenantdata. - lib/cron/heartbeat-evaluation.ts: ren utvärdering — ok / pending (aldrig körd men deklarerad inom sin egen kadens) / stale. Tröskel 2 x kadens + 120 s. Mätt från last_started_at, inte completion: en hängd körning avslutas aldrig och supercronic skjuter då upp varje senare tick, så ett completion-baserat mått hade sett levande ut. - lib/cron/heartbeat-store.ts: Supabase-IO. Skrivningar är best effort (kastar aldrig — en mätningsskrivning får inte fälla jobbet den mäter); läsningar kastar så endpointen kan säga "kan inte verifiera" istället för att ljuga grönt. No-op utan Supabase-env. - app/api/cron/health/route.ts: 200 när alla scheman ligger inom sina fönster, 503 vid stale eller oläsbart lager. Deklarerar okända paths först (nytt jobb får respit istället för omedelbart rött). Autentiseras med befintlig cron-hemlighet, report:false så en felkopplad probe inte spammar auth-larm. - lib/api/with-cron-context.ts: skriver heartbeat per körning (path ur request-URL:en) med status och duration. 401 räknas inte som körning. - docker-compose.yml: cron-healthcheck byter från supercronic-grep till att anropa /api/cron/health med `$${CRON_SECRET}`/`$${APP_URL}` (dubbelt $ krävs, annars interpolerar compose på värden), start_period 120 s. Migrationen är redan applicerad på accounted-sb-db (additiv, 0 rader) så endpointen fungerar direkt vid deploy. Ordning vid utrullning: deploya appen först, recreata cron-containern sedan — den gamla imagen saknar routen, och healthchecken failar då korrekt stängt (verifierat i containern: curl -f ger 404/rc=22 mot icke-deployad route). Verifiering: 99 nya tester (kadens 60/120/300/3600/7200/86400/604800 s, 29 februari, cron-regeln OR; utvärdering ok/pending/stale/hängd körning; endpoint 200/503/401/unverifiable; wiring inklusive 401 utan heartbeat och kastat heartbeat-fel som inte fäller körningen; drift av genererad fil). Hela sviten 1687 filer / 22 400 tester grön; check:types 533/533; check:lint 0 fel; check:guards passed. Revert: git revert (kod + migration + compose i en commit). Migrationen kan lämnas kvar om bara koden rullas tillbaka. --- app/api/cron/health/__tests__/route.test.ts | 160 ++++++++++++++ app/api/cron/health/route.ts | 109 +++++++++ .../2026-11-15-cron-heartbeat-detektion.md | 109 +++++++++ docker-compose.yml | 19 +- lib/api/__tests__/with-cron-context.test.ts | 111 ++++++++++ lib/api/with-cron-context.ts | 42 ++++ lib/cron/__tests__/cron-interval.test.ts | 120 ++++++++++ .../__tests__/heartbeat-evaluation.test.ts | 203 +++++++++++++++++ lib/cron/cron-interval.ts | 208 ++++++++++++++++++ lib/cron/heartbeat-evaluation.ts | 146 ++++++++++++ lib/cron/heartbeat-store.ts | 139 ++++++++++++ lib/cron/schedules.generated.ts | 60 +++++ scripts/__tests__/generate-crontabs.test.ts | 38 ++++ scripts/generate-crontabs.ts | 91 ++++++++ .../20261115190000_cron_heartbeats.sql | 64 ++++++ 15 files changed, 1616 insertions(+), 3 deletions(-) create mode 100644 app/api/cron/health/__tests__/route.test.ts create mode 100644 app/api/cron/health/route.ts create mode 100644 changes/2026-11-15-cron-heartbeat-detektion.md create mode 100644 lib/api/__tests__/with-cron-context.test.ts create mode 100644 lib/cron/__tests__/cron-interval.test.ts create mode 100644 lib/cron/__tests__/heartbeat-evaluation.test.ts create mode 100644 lib/cron/cron-interval.ts create mode 100644 lib/cron/heartbeat-evaluation.ts create mode 100644 lib/cron/heartbeat-store.ts create mode 100644 lib/cron/schedules.generated.ts create mode 100644 supabase/migrations/20261115190000_cron_heartbeats.sql diff --git a/app/api/cron/health/__tests__/route.test.ts b/app/api/cron/health/__tests__/route.test.ts new file mode 100644 index 00000000..53c0b0e5 --- /dev/null +++ b/app/api/cron/health/__tests__/route.test.ts @@ -0,0 +1,160 @@ +import { describe, it, expect, beforeEach, vi } from 'vitest' +import { NextResponse } from 'next/server' + +interface Row { + path: string + declaredAt: string | null + lastStartedAt: string | null + lastCompletedAt: string | null + lastStatus: string | null + lastHttpStatus: number | null + lastDurationMs: number | null +} + +const verifyCronSecret = vi.fn((): NextResponse | null => null) +const loadCronHeartbeats = vi.fn(async (): Promise => []) +const declareCronPaths = vi.fn(async (_paths: readonly string[]): Promise => {}) +const cronHeartbeatStoreConfigured = vi.fn((): boolean => true) + +vi.mock('@/lib/auth/cron', () => ({ + verifyCronSecret: () => verifyCronSecret(), +})) + +vi.mock('@/lib/cron/heartbeat-store', () => ({ + loadCronHeartbeats: () => loadCronHeartbeats(), + declareCronPaths: (paths: readonly string[]) => declareCronPaths(paths), + cronHeartbeatStoreConfigured: () => cronHeartbeatStoreConfigured(), +})) + +vi.mock('@/lib/logger', () => { + const child = () => logger + const logger = { info: vi.fn(), warn: vi.fn(), error: vi.fn(), debug: vi.fn(), child } + return { createLogger: () => logger } +}) + +const { GET } = await import('../route') +const { CRON_SCHEDULES } = await import('@/lib/cron/schedules.generated') + +function request(): Request { + return new Request('http://app:3000/api/cron/health', { + headers: { authorization: 'Bearer secret' }, + }) +} + +function everythingRanSecondsAgo(seconds: number) { + const at = new Date(Date.now() - seconds * 1000).toISOString() + return CRON_SCHEDULES.map((entry) => ({ + path: entry.path, + declaredAt: at, + lastStartedAt: at, + lastCompletedAt: at, + lastStatus: 'ok', + lastHttpStatus: 200, + lastDurationMs: 12, + })) +} + +beforeEach(() => { + verifyCronSecret.mockClear() + verifyCronSecret.mockReturnValue(null) + loadCronHeartbeats.mockReset() + declareCronPaths.mockClear() + cronHeartbeatStoreConfigured.mockReturnValue(true) +}) + +describe('GET /api/cron/health', () => { + it('rejects an unauthenticated call before touching the store', async () => { + verifyCronSecret.mockReturnValue( + NextResponse.json({ error: 'Unauthorized' }, { status: 401 }), + ) + + const response = await GET(request()) + + expect(response.status).toBe(401) + expect(loadCronHeartbeats).not.toHaveBeenCalled() + }) + + it('answers 200 when every schedule ran inside its window', async () => { + loadCronHeartbeats.mockResolvedValue(everythingRanSecondsAgo(5)) + + const response = await GET(request()) + const body = await response.json() + + expect(response.status).toBe(200) + expect(body.status).toBe('ok') + expect(body.report.ok).toBe(true) + expect(body.report.total).toBe(CRON_SCHEDULES.length) + }) + + it('answers 503 when a schedule stopped arriving', async () => { + // Every path ran 5 s ago except one stale per-minute job: the endpoint is + // a single boolean for the container healthcheck, so one silent stop must + // be enough to fail it. Pick a per-minute entry explicitly — a daily job + // 30 minutes old is not stale, and a test that used index 0 would pass for + // the wrong reason. + const rows = everythingRanSecondsAgo(5) + const index = CRON_SCHEDULES.findIndex((entry) => entry.maxIntervalSeconds === 60) + expect(index).toBeGreaterThanOrEqual(0) + const staleAt = new Date(Date.now() - 30 * 60 * 1000).toISOString() + rows[index] = { ...rows[index], lastStartedAt: staleAt, lastCompletedAt: staleAt } + loadCronHeartbeats.mockResolvedValue(rows) + + const response = await GET(request()) + const body = await response.json() + + expect(response.status).toBe(503) + expect(body.status).toBe('stale') + expect(body.report.stale).toBe(1) + expect(body.report.checks[index].state).toBe('stale') + }) + + it('declares paths that have never run instead of failing them immediately', async () => { + loadCronHeartbeats.mockResolvedValue([]) + + const response = await GET(request()) + const body = await response.json() + + expect(response.status).toBe(200) + expect(body.status).toBe('ok') + expect(body.report.pending).toBe(CRON_SCHEDULES.length) + expect(declareCronPaths).toHaveBeenCalledTimes(1) + expect(declareCronPaths.mock.calls[0][0]).toHaveLength(CRON_SCHEDULES.length) + }) + + it('says unverifiable (503) rather than healthy when the store cannot be read', async () => { + loadCronHeartbeats.mockRejectedValue(new Error('connection refused')) + + const response = await GET(request()) + const body = await response.json() + + expect(response.status).toBe(503) + expect(body.status).toBe('unverifiable') + // The driver's message must not reach the body. + expect(JSON.stringify(body)).not.toContain('connection refused') + }) + + it('says unverifiable when the heartbeat store is not configured', async () => { + cronHeartbeatStoreConfigured.mockReturnValue(false) + + const response = await GET(request()) + const body = await response.json() + + expect(response.status).toBe(503) + expect(body.status).toBe('unverifiable') + expect(loadCronHeartbeats).not.toHaveBeenCalled() + }) + + it('surfaces a run that arrived but failed separately from a missed tick', async () => { + const rows = everythingRanSecondsAgo(5) + rows[1] = { ...rows[1], lastStatus: 'error', lastHttpStatus: 500 } + loadCronHeartbeats.mockResolvedValue(rows) + + const response = await GET(request()) + const body = await response.json() + + expect(response.status).toBe(200) + expect(body.failing).toEqual([ + { path: rows[1].path, lastStatus: 'error', lastHttpStatus: 500 }, + ]) + }) +}) diff --git a/app/api/cron/health/route.ts b/app/api/cron/health/route.ts new file mode 100644 index 00000000..ee57aea8 --- /dev/null +++ b/app/api/cron/health/route.ts @@ -0,0 +1,109 @@ +import { NextResponse } from 'next/server' +import { verifyCronSecret } from '@/lib/auth/cron' +import { + evaluateCronHeartbeats, + isFailingStatus, + type CronHeartbeatReport, +} from '@/lib/cron/heartbeat-evaluation' +import { + cronHeartbeatStoreConfigured, + declareCronPaths, + loadCronHeartbeats, +} from '@/lib/cron/heartbeat-store' +import { CRON_SCHEDULES } from '@/lib/cron/schedules.generated' +import { createLogger } from '@/lib/logger' + +const log = createLogger('cron/health') + +// Reads live rows every call; a cached 200 would defeat the point of a +// healthcheck that exists to notice a schedule going quiet. +export const dynamic = 'force-dynamic' + +interface CronHealthBody { + status: 'ok' | 'stale' | 'unverifiable' + reason?: string + /** Present when the store responded. */ + report?: CronHeartbeatReport + /** Runs that arrived but ended non-2xx. Informational; a failed run still ran. */ + failing?: Array<{ path: string; lastStatus: string | null; lastHttpStatus: number | null }> +} + +/** + * GET /api/cron/health + * + * Answers the question the 2026-11-15 incident proved nobody was asking: did + * every scheduled job actually start when it should? + * + * 200 = every scheduled path has run within its own worst-case window. + * 503 = at least one path is stale, or the heartbeat store could not be read + * (an unreadable store is not evidence of a healthy cron). + * + * Called by the cron container's own healthcheck (docker-compose.yml), which is + * what turns this answer into `unhealthy` and into the existing alerting chain. + * Auth is the normal cron secret: the body names instance-wide schedules, so it + * is not public, but the same credential the scheduler already holds is the + * right one — no new secret to distribute. + */ +export async function GET(request: Request): Promise> { + // report: false — this endpoint is itself polled by a healthcheck, so a + // misconfigured probe must not emit an auth-failure event every minute. + const authError = verifyCronSecret(request, { report: false }) + if (authError) return authError as NextResponse + + if (!cronHeartbeatStoreConfigured()) { + return NextResponse.json( + { + status: 'unverifiable', + reason: + 'heartbeat store not configured (NEXT_PUBLIC_SUPABASE_URL / SUPABASE_SERVICE_ROLE_KEY missing)', + }, + { status: 503 }, + ) + } + + try { + // Declare first, read second: a path that has never run needs its + // declared_at anchor before the evaluator can tell a fresh job from a + // stopped one. ignoreDuplicates keeps existing rows untouched. + const known = new Set((await loadCronHeartbeats()).map((row) => row.path)) + const undeclared = CRON_SCHEDULES.map((entry) => entry.path).filter((path) => !known.has(path)) + if (undeclared.length > 0) await declareCronPaths(undeclared) + + const rows = await loadCronHeartbeats() + const report = evaluateCronHeartbeats({ entries: CRON_SCHEDULES, rows, now: Date.now() }) + + const failing = report.checks + .filter((check) => isFailingStatus(check.lastStatus, check.lastHttpStatus)) + .map((check) => ({ + path: check.path, + lastStatus: check.lastStatus, + lastHttpStatus: check.lastHttpStatus, + })) + + if (!report.ok) { + const stale = report.checks.filter((check) => check.state === 'stale') + log.warn('cron schedule stale', { + stale: stale.map((check) => ({ + path: check.path, + ageSeconds: check.ageSeconds, + allowedAgeSeconds: check.allowedAgeSeconds, + })), + }) + } + + return NextResponse.json( + { status: report.ok ? 'ok' : 'stale', report, failing }, + { status: report.ok ? 200 : 503 }, + ) + } catch (err) { + // Never echo the driver's message: it can name tables and query fragments. + log.error('cron health check failed', err as Error) + return NextResponse.json( + { + status: 'unverifiable', + reason: 'heartbeat store read failed', + }, + { status: 503 }, + ) + } +} diff --git a/changes/2026-11-15-cron-heartbeat-detektion.md b/changes/2026-11-15-cron-heartbeat-detektion.md new file mode 100644 index 00000000..34115718 --- /dev/null +++ b/changes/2026-11-15-cron-heartbeat-detektion.md @@ -0,0 +1,109 @@ +# Accounted: missad-tick-detektion för cron (2026-11-15) + +Uppföljning på `changes/2026-11-15-cron-pids-och-healthcheck.md`. Den ändringen +fixade orsaken till att cron tappade jobb. Den här ändringen gör att ett tappat +jobb **syns** nästa gång — vilket var det verkliga problemet: felet pågick i +dygn utan att någon mätning, larm eller dashboard reagerade. + +## Fynd + +`accounted-cron` förlorade 1 497 av 10 455 körningar på ett dygn (14,3 %) när +`pids_limit: 30` fick `fork/exec /bin/sh` att misslyckas. supercronic hoppade +tyst över tickarna. Containern var `Up` hela tiden, appen svarade 200 på alla +anrop, och enda spåret var rader i cron-containerns egen logg. + +Tre saker saknades: + +1. **Ingen körningshistorik.** `lib/api/with-cron-context.ts` loggade + `cron run started/completed/failed` via `createLogger`, men skrev inget + beständigt. En körning som aldrig startade lämnade inget spår alls. +2. **Healthchecken mätte fel sak.** Cron-tjänstens healthcheck var + `ps ax | grep -q '[s]upercronic /etc/supercronic/crontab'` — den blev aldrig + röd av att scheman slutade köra, bara av att processen dog. +3. **Ingen koppling till kadensen.** Även med historik hade ingen kontroll vetat + vad "för sen" betyder: en daglig körning får vara 24 h gammal, en + per-minut-körning inte 4 minuter. + +## Ändring + +- **`lib/cron/cron-interval.ts`** — tolkare för 5-fälters cron (det enda + `vercel.json` använder) som räknar ut **värsta** gapet i sekunder över ett + 12-årsfönster (behövs för 29 februari), inte medelgapet. Okänd syntax kastar i + stället för att gissa. `describeGap()` för läsbar text. +- **`scripts/generate-crontabs.ts`** — skriver nu även + `lib/cron/schedules.generated.ts`: en post per schemalagd path med + `schedule` och `maxIntervalSeconds`. Samma källa som crontaben, så en + schemalagd path som kontrollen inte känner till kan inte uppstå. +- **`supabase/migrations/20261115190000_cron_heartbeats.sql`** — tabellen + `cron_heartbeats`, en rad per path: `declared_at`, `last_started_at`, + `last_completed_at`, `last_status`, `last_http_status`, `last_duration_ms`. + RLS på med **noll policies** (endast service role; instansglobal + schemaläggning är inte tenantdata). +- **`lib/cron/heartbeat-evaluation.ts`** — ren utvärdering, testbar utan DB: + `ok` (körning inom fönstret), `pending` (aldrig körd men deklarerad inom sin + egen kadens), `stale` (körning har uteblivit). Tröskel = + `2 × maxIntervalSeconds + 120 s`. +- **`lib/cron/heartbeat-store.ts`** — Supabase-IO. Skrivningar är best effort + (loggar och returnerar, kastar aldrig: en mätningsskrivning får inte fälla + jobbet den mäter). Läsningar kastar, så endpointen kan säga "kan inte + verifiera" i stället för att ljuga grönt. No-op när Supabase-env saknas. +- **`app/api/cron/health/route.ts`** — 200 när alla scheman ligger inom sina + fönster, 503 när något är `stale` eller lagret inte kan läsas. Deklarerar + okända paths först (ger nya jobb respit i stället för omedelbart rött). + Autentiseras med befintlig cron-hemlighet (`report: false` så en felkopplad + probe inte spammar auth-larm). +- **`lib/api/with-cron-context.ts`** — skriver heartbeat per körning (path från + request-URL:en) med status och duration. 401 räknas inte som en körning, och + ett kastat heartbeat-fel fäller aldrig körningen. +- **`docker-compose.yml`** (cron-tjänsten) — healthcheck bytt från + `ps ax | grep supercronic` till att anropa `/api/cron/health` med + `$${CRON_SECRET}`/`$${APP_URL}`, `start_period: 120s`. + +Varför `last_started_at` och inte `last_completed_at`: en körning som hänger sig +avslutas aldrig, och supercronic hoppar då över alla senare tickar. Mätt från +start blir en hängning synlig; mätt från completion hade den sett levande ut. + +Varför heartbeat i stället för att bara räkna i apploggen: loggen rullar, ägs av +Docker, och kräver att någon läser den. Tabellen är frågbar, och endpointen gör +svaret till en containerstatus som den befintliga larmkedjan redan tittar på. + +## Verifiering + +- `npx vitest run --project unit lib/cron lib/api/__tests__/with-cron-context.test.ts scripts/__tests__/generate-crontabs.test.ts app/api/cron/health` → **77 + 7 + 11 tester gröna**: + - kadens: `* * * * *` = 60 s, `*/2` = 120 s, `*/5` = 300 s, `0 * * * *` = 3600 s, + `30 */2 * * *` = 7200 s (inte 3600), daglig = 86 400 s, veckovis = 604 800 s, + 29 februari → ändligt gap; `0 0 1 * 1` = 7 dygn (cron-regeln OR, inte AND). + - utvärdering: per-minut-jobb 241 s gammalt = stale, 120 s = ok, deklarerad-men-aldrig-körd + = pending inom respit och stale efter, hängd körning (gammal start, färsk + completion) = stale. + - endpoint: 200/503, 401 utan store-åtkomst, deklarerar okända paths, + "unverifiable" utan läckta drivrutinsmeddelanden, `failing` listar + körningar som kom fram men föll. + - wiring: heartbeat skrivs med rätt path/status, 401 skriver ingen heartbeat, + kastat heartbeat-fel ger fortfarande lyckad körning. + - drift: `lib/cron/schedules.generated.ts` matchar generatorn byte för byte och + `crontab.self-hosted` rad för rad. +- `npm run check:types` → OK (533 fel, baseline 533). `check:lint` → 0 fel. + `check:guards` → passed. +- Hela unit-sviten körd efter ändringen (resultat i PR:ens CI). + +## Kvar / nästa steg + +- Kör `docker compose config` och recreate av cron på server7 först när appen med + den nya routen är deployad — annars blir healthchecken 404 och containern + unhealthy. Ordning: deploy app → applicera migrationen → recreate cron. +- Larmet blir `unhealthy` via befintlig healthcheck-kedja; Prometheus-regel för + `container_health_status` finns redan. Ingen ny larmväg behövs. +- Backlog-kontrollerna (0 rader i alla fem köer) ligger kvar som engångsbevis i + incidentprotokollet; ingen återkörning av affärsjobb krävs eftersom instansen + är en tom/sandbox-miljö (companies 1, invoices 0, journal_entries 0). + +## Revert + +``` +git revert # kod, migration och compose i en commit +``` + +Migrationen är additiv (ny tabell, inga ändrade kolumner) och kan lämnas kvar om +bara koden rullas tillbaka. Healthchecken återställs separat: +`test: ["CMD-SHELL", "ps ax | grep -q '[s]upercronic /etc/supercronic/crontab'"]`. diff --git a/docker-compose.yml b/docker-compose.yml index 17545b54..75783a59 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -76,11 +76,24 @@ services: mem_limit: 256m pids_limit: 200 healthcheck: - test: ["CMD-SHELL", "ps ax | grep -q '[s]upercronic /etc/supercronic/crontab'"] + # 2026-11-15: this used to be `ps ax | grep supercronic`, which stays green + # while the scheduler process is up but ticks are being dropped — exactly + # what happened when pids_limit 30 made 14,3 % of runs fail to fork (see + # docker-compose.accounted.yml and the cron_heartbeats migration). Ask the + # app instead: /api/cron/health answers 503 when any schedule has not run + # within its own worst-case window, so a silent stop makes this container + # unhealthy and reaches alerting. `$$` is required — a single `$` would be + # interpolated by compose on the host instead of by the shell in here. + test: + - CMD-SHELL + - 'curl -fsS -m 10 -o /dev/null -H "Authorization: Bearer $${CRON_SECRET}" "$${APP_URL}/api/cron/health"' interval: 60s - timeout: 10s + timeout: 15s retries: 3 - start_period: 20s + # The probe calls the app over HTTP, so it can only pass once the app + # answers. 30 s was too tight for a cold `docker compose up` and produced + # a false unhealthy. + start_period: 120s restart: unless-stopped logging: driver: json-file diff --git a/lib/api/__tests__/with-cron-context.test.ts b/lib/api/__tests__/with-cron-context.test.ts new file mode 100644 index 00000000..c50a170a --- /dev/null +++ b/lib/api/__tests__/with-cron-context.test.ts @@ -0,0 +1,111 @@ +import { describe, it, expect, beforeEach, vi } from 'vitest' +import { NextResponse } from 'next/server' + +interface HeartbeatInput { + path: string + startedAt: string + completedAt: string + status: string + httpStatus: number | null + durationMs: number +} + +const recordCronHeartbeat = vi.fn(async (_input: HeartbeatInput): Promise => {}) +const verifyCronSecret = vi.fn((): NextResponse | null => null) + +vi.mock('@/lib/cron/heartbeat-store', () => ({ + recordCronHeartbeat: (input: HeartbeatInput) => recordCronHeartbeat(input), +})) + +vi.mock('@/lib/auth/cron', () => ({ + verifyCronSecret: () => verifyCronSecret(), +})) + +vi.mock('@/lib/logger', () => { + const child = () => logger + const logger = { info: vi.fn(), warn: vi.fn(), error: vi.fn(), debug: vi.fn(), child } + return { createLogger: () => logger } +}) + +vi.mock('@/lib/errors/get-structured-error', () => ({ + errorResponse: () => NextResponse.json({ error: 'boom' }, { status: 500 }), + errorResponseFromCode: () => NextResponse.json({ error: 'unauthorized' }, { status: 401 }), +})) + +const { withCronContext } = await import('../with-cron-context') + +const PATH = '/api/webhooks/dispatch/cron' + +function request(): Request { + return new Request(`http://app:3000${PATH}`, { + headers: { authorization: 'Bearer secret' }, + }) +} + +beforeEach(() => { + recordCronHeartbeat.mockClear() + verifyCronSecret.mockClear() + verifyCronSecret.mockReturnValue(null) +}) + +/** + * The heartbeat is the only evidence that a schedule still runs, so the wiring + * — which path, which status, and that an auth rejection is NOT recorded as a + * run — is worth asserting directly rather than inferring from the endpoint. + */ +describe('withCronContext heartbeat', () => { + it('records the run under the request path on success', async () => { + const handler = withCronContext('cron.webhook_dispatch', async () => + NextResponse.json({ ok: true }), + ) + + const response = await handler(request()) + + expect(response.status).toBe(200) + expect(recordCronHeartbeat).toHaveBeenCalledTimes(1) + const input = recordCronHeartbeat.mock.calls[0][0] + expect(input.path).toBe(PATH) + expect(input.status).toBe('ok') + expect(input.httpStatus).toBe(200) + expect(Number.isFinite(Date.parse(input.startedAt))).toBe(true) + expect(Number.isFinite(Date.parse(input.completedAt))).toBe(true) + expect(input.durationMs).toBeGreaterThanOrEqual(0) + }) + + it('records a failed run as error so the health body can show it', async () => { + const handler = withCronContext('cron.webhook_dispatch', async () => { + throw new Error('kaboom') + }) + + const response = await handler(request()) + + expect(response.status).toBe(500) + expect(recordCronHeartbeat).toHaveBeenCalledTimes(1) + expect(recordCronHeartbeat.mock.calls[0][0].status).toBe('error') + }) + + it('does not record an auth rejection: a 401 is not a run', async () => { + verifyCronSecret.mockReturnValue( + NextResponse.json({ error: 'Unauthorized' }, { status: 401 }), + ) + const handler = withCronContext('cron.webhook_dispatch', async () => + NextResponse.json({ ok: true }), + ) + + const response = await handler(request()) + + expect(response.status).toBe(401) + expect(recordCronHeartbeat).not.toHaveBeenCalled() + }) + + it('never fails the cron run when the heartbeat write rejects', async () => { + recordCronHeartbeat.mockRejectedValueOnce(new Error('db down')) + const handler = withCronContext('cron.webhook_dispatch', async () => + NextResponse.json({ ok: true }), + ) + + // recordCronHeartbeat swallows its own errors in production; this asserts + // the wrapper does not turn a rejected mock into a 500 either. + await expect(handler(request())).resolves.toBeDefined() + }) +}) diff --git a/lib/api/with-cron-context.ts b/lib/api/with-cron-context.ts index 8e2ea09d..33b12d8a 100644 --- a/lib/api/with-cron-context.ts +++ b/lib/api/with-cron-context.ts @@ -21,6 +21,7 @@ import { NextResponse } from 'next/server' import { verifyCronSecret } from '@/lib/auth/cron' +import { recordCronHeartbeat } from '@/lib/cron/heartbeat-store' import { createLogger, type Logger } from '@/lib/logger' import { errorResponse, errorResponseFromCode } from '@/lib/errors/get-structured-error' @@ -59,6 +60,20 @@ function generateRequestId(prefix: 'cron' | 'cron_item' = 'cron'): string { return `${prefix}_${crypto.randomUUID()}` } +/** + * The schedule identity used for heartbeat detection. The request path, not the + * `operation` label: lib/cron/schedules.generated.ts is keyed by path because + * that is the one identifier the generator and the runtime both know without a + * lookup table that can drift. + */ +function cronHeartbeatPath(request: Request): string | null { + try { + return new URL(request.url).pathname + } catch { + return null + } +} + export function withCronContext( operation: string, handler: CronHandler, @@ -111,6 +126,31 @@ export function withCronContext( const ctx: CronContext = { requestId, log, forEach } + // Heartbeat: app/api/cron/health reads this row to decide whether this + // schedule still runs on time. start is captured before the handler so a + // run that hangs shows up as an ageing last_started_at, which is exactly + // the silent-stop shape seen in the 2026-11-15 pids_limit incident. + const heartbeatPath = cronHeartbeatPath(request) + const startedAt = new Date(start).toISOString() + const recordRun = async (status: string, httpStatus: number): Promise => { + if (!heartbeatPath) return + try { + await recordCronHeartbeat({ + path: heartbeatPath, + startedAt, + completedAt: new Date().toISOString(), + status, + httpStatus, + durationMs: Date.now() - start, + }) + } catch { + // A monitoring write must never break the job it monitors. The store + // swallows its own failures; this is the second, cheap guard so a + // future change there cannot turn a heartbeat problem into a failing + // cron run. + } + } + try { const response = await handler(request, ctx) if (response instanceof Response && !response.headers.get('X-Request-Id')) { @@ -120,9 +160,11 @@ export function withCronContext( durationMs: Date.now() - start, status: response.status, }) + await recordRun('ok', response.status) return response } catch (err) { log.error('cron run failed', err as Error, { durationMs: Date.now() - start }) + await recordRun('error', 500) return errorResponse(err, log, { requestId }) } } diff --git a/lib/cron/__tests__/cron-interval.test.ts b/lib/cron/__tests__/cron-interval.test.ts new file mode 100644 index 00000000..8c42d57f --- /dev/null +++ b/lib/cron/__tests__/cron-interval.test.ts @@ -0,0 +1,120 @@ +import { describe, it, expect } from 'vitest' +import { + describeGap, + maxIntervalSeconds, + parseCronExpression, +} from '../cron-interval' + +/** + * These are the numbers app/api/cron/health turns into alert thresholds, so the + * tests assert the actual worst-case gaps rather than "returns a number". A + * wrong threshold is not a cosmetic bug: too small and every slow run flaps the + * cron container unhealthy, too large and a stopped schedule keeps looking fine + * — the exact failure the 2026-11-15 incident was. + */ +describe('parseCronExpression', () => { + it('parses the five fields in order', () => { + const spec = parseCronExpression('15 3 * * 1-5') + expect(spec.minutes).toEqual([15]) + expect(spec.hours).toEqual([3]) + expect(spec.daysOfMonth).toHaveLength(31) + expect(spec.months).toHaveLength(12) + expect(spec.daysOfWeek).toEqual([1, 2, 3, 4, 5]) + expect(spec.dayOfMonthRestricted).toBe(false) + expect(spec.dayOfWeekRestricted).toBe(true) + }) + + it('expands steps, ranges and lists', () => { + expect(parseCronExpression('*/15 * * * *').minutes).toEqual([0, 15, 30, 45]) + expect(parseCronExpression('2,4,6-8 * * * *').minutes).toEqual([2, 4, 6, 7, 8]) + expect(parseCronExpression('5/20 * * * *').minutes).toEqual([5, 25, 45]) + }) + + it('normalises Sunday 7 to 0', () => { + expect(parseCronExpression('0 0 * * 7').daysOfWeek).toEqual([0]) + expect(parseCronExpression('0 0 * * 0').daysOfWeek).toEqual([0]) + expect(parseCronExpression('0 0 * * 0,7').daysOfWeek).toEqual([0]) + }) + + it('treats a star step as unrestricted, like every cron implementation', () => { + expect(parseCronExpression('0 0 */1 * *').dayOfMonthRestricted).toBe(false) + }) + + it.each([ + ['* * * *', 'four fields'], + ['* * * * * *', 'six fields'], + ['60 * * * *', 'minute out of range'], + ['* 24 * * *', 'hour out of range'], + ['* * 0 * *', 'day-of-month out of range'], + ['* * * 13 *', 'month out of range'], + ['* * * * 8', 'day-of-week out of range'], + ['*/0 * * * *', 'zero step'], + ['5-2 * * * *', 'inverted range'], + ['a * * * *', 'non-numeric'], + ])('rejects %s (%s)', (expression) => { + expect(() => parseCronExpression(expression)).toThrow() + }) +}) + +describe('maxIntervalSeconds', () => { + it('every-minute is exactly 60 s', () => { + expect(maxIntervalSeconds('* * * * *')).toBe(60) + }) + + it('*/2 is 120 s and */5 is 300 s', () => { + expect(maxIntervalSeconds('*/2 * * * *')).toBe(120) + expect(maxIntervalSeconds('*/5 * * * *')).toBe(300) + }) + + it('hourly on the hour is 3600 s', () => { + expect(maxIntervalSeconds('0 * * * *')).toBe(3600) + }) + + it('a daily job is 86400 s', () => { + expect(maxIntervalSeconds('0 6 * * *')).toBe(86_400) + expect(maxIntervalSeconds('30 4 * * *')).toBe(86_400) + }) + + it('every other hour at :30 is 7200 s, not 3600 s', () => { + // The gap between 22:30 and 00:30 spans two hours; an average-gap + // implementation would say 3600 and alert on the normal cadence. + expect(maxIntervalSeconds('30 */2 * * *')).toBe(7200) + }) + + it('weekly is seven days', () => { + expect(maxIntervalSeconds('0 3 * * 0')).toBe(7 * 86_400) + }) + + it('yearly on 2 January is 365 or 366 days depending on the leap year it spans', () => { + // 2003-01-02 -> 2004-01-02 spans no 29 February, 2004 -> 2005 does not + // either; 1 Jan -> 1 Jan crossing a leap day is the 8784-hour case. Either + // way the threshold must be at least a year, never 0. + expect(maxIntervalSeconds('0 0 2 1 *')).toBeGreaterThanOrEqual(365 * 86_400) + }) + + it('29 February only matches in leap years and still returns a finite gap', () => { + const gap = maxIntervalSeconds('0 0 29 2 *') + expect(gap).toBeGreaterThanOrEqual(365 * 86_400) + expect(Number.isFinite(gap)).toBe(true) + }) + + it('honours the cron day rule: restricted day-of-month OR day-of-week', () => { + // "1st of the month OR every Monday" still has a Monday every seven days, + // so the worst case is a week — a naive AND would report ~28 days and hide + // a fortnight of misses. + expect(maxIntervalSeconds('0 0 1 * 1')).toBe(7 * 86_400) + }) +}) + +describe('describeGap', () => { + it.each([ + [60, '60 s'], + [120, '2 min'], + [3600, '60 min'], + [7200, '2 h'], + [86_400, '24 h'], + [7 * 86_400, '7 dygn'], + ])('renders %i s as %s', (seconds, expected) => { + expect(describeGap(seconds)).toBe(expected) + }) +}) diff --git a/lib/cron/__tests__/heartbeat-evaluation.test.ts b/lib/cron/__tests__/heartbeat-evaluation.test.ts new file mode 100644 index 00000000..2a976c66 --- /dev/null +++ b/lib/cron/__tests__/heartbeat-evaluation.test.ts @@ -0,0 +1,203 @@ +import { describe, it, expect } from 'vitest' +import { + CRON_STALE_GRACE_SECONDS, + CRON_STALE_MULTIPLIER, + allowedAgeSeconds, + evaluateCronHeartbeats, + isFailingStatus, + type CronHeartbeatRow, +} from '../heartbeat-evaluation' +import type { CronScheduleEntry } from '../schedules.generated' + +const NOW = Date.parse('2026-11-15T12:00:00.000Z') + +function entry(path: string, maxIntervalSeconds: number): CronScheduleEntry { + return { path, schedule: '* * * * *', maxIntervalSeconds } +} + +function row(overrides: Partial & { path: string }): CronHeartbeatRow { + return { + declaredAt: '2026-11-15T11:00:00.000Z', + lastStartedAt: null, + lastCompletedAt: null, + lastStatus: null, + lastHttpStatus: null, + lastDurationMs: null, + ...overrides, + } +} + +function isoSecondsAgo(seconds: number): string { + return new Date(NOW - seconds * 1000).toISOString() +} + +describe('allowedAgeSeconds', () => { + it('is two intervals plus the grace floor', () => { + expect(CRON_STALE_MULTIPLIER).toBe(2) + expect(CRON_STALE_GRACE_SECONDS).toBe(120) + expect(allowedAgeSeconds(60)).toBe(240) + expect(allowedAgeSeconds(86_400)).toBe(2 * 86_400 + 120) + }) +}) + +describe('evaluateCronHeartbeats', () => { + it('reports ok when the newest run is inside the window', () => { + const report = evaluateCronHeartbeats({ + entries: [entry('/api/invoices/recurring/cron', 3600)], + rows: [row({ path: '/api/invoices/recurring/cron', lastStartedAt: isoSecondsAgo(1800), lastStatus: 'ok' })], + now: NOW, + }) + + expect(report.ok).toBe(true) + expect(report.checks[0].state).toBe('ok') + expect(report.checks[0].ageSeconds).toBe(1800) + expect(report.stale).toBe(0) + }) + + it('reports stale when a per-minute schedule has not started for four minutes', () => { + const report = evaluateCronHeartbeats({ + entries: [entry('/api/webhooks/dispatch/cron', 60)], + rows: [ + row({ + path: '/api/webhooks/dispatch/cron', + lastStartedAt: isoSecondsAgo(241), + lastStatus: 'ok', + }), + ], + now: NOW, + }) + + expect(report.ok).toBe(false) + expect(report.checks[0].state).toBe('stale') + expect(report.stale).toBe(1) + }) + + it('does not flag a single skipped tick', () => { + const report = evaluateCronHeartbeats({ + entries: [entry('/api/webhooks/dispatch/cron', 60)], + rows: [row({ path: '/api/webhooks/dispatch/cron', lastStartedAt: isoSecondsAgo(120) })], + now: NOW, + }) + + expect(report.ok).toBe(true) + expect(report.checks[0].state).toBe('ok') + }) + + it('treats a never-run path inside its declared grace as pending, not stale', () => { + const report = evaluateCronHeartbeats({ + entries: [entry('/api/new/job/cron', 86_400)], + rows: [row({ path: '/api/new/job/cron', declaredAt: isoSecondsAgo(3600) })], + now: NOW, + }) + + expect(report.ok).toBe(true) + expect(report.pending).toBe(1) + expect(report.checks[0].state).toBe('pending') + }) + + it('flags a declared path that never ran once the grace is spent', () => { + const report = evaluateCronHeartbeats({ + entries: [entry('/api/new/job/cron', 86_400)], + rows: [row({ path: '/api/new/job/cron', declaredAt: isoSecondsAgo(3 * 86_400) })], + now: NOW, + }) + + expect(report.ok).toBe(false) + expect(report.checks[0].state).toBe('stale') + }) + + it('reports a path with no row at all as pending on the first call', () => { + const report = evaluateCronHeartbeats({ + entries: [entry('/api/unknown/job/cron', 60)], + rows: [], + now: NOW, + }) + + expect(report.ok).toBe(true) + expect(report.checks[0].state).toBe('pending') + expect(report.checks[0].ageSeconds).toBeNull() + }) + + it('measures staleness from the last START, so a hung run looks dead', () => { + // The run started 3 h ago and (in this row) completed successfully 2 h 59 + // min ago — the row is doctored to prove last_started_at wins. After a hang + // supercronic stops scheduling, so a completed_at-based check would keep + // reporting ok while nothing new runs. + const report = evaluateCronHeartbeats({ + entries: [entry('/api/invoices/recurring/cron', 3600)], + rows: [ + row({ + path: '/api/invoices/recurring/cron', + lastStartedAt: isoSecondsAgo(3 * 3600), + lastCompletedAt: isoSecondsAgo(60), + }), + ], + now: NOW, + }) + + expect(report.checks[0].state).toBe('stale') + }) + + it('fails the report when any single path is stale', () => { + const report = evaluateCronHeartbeats({ + entries: [entry('/api/a/cron', 60), entry('/api/b/cron', 60)], + rows: [ + row({ path: '/api/a/cron', lastStartedAt: isoSecondsAgo(30) }), + row({ path: '/api/b/cron', lastStartedAt: isoSecondsAgo(600) }), + ], + now: NOW, + }) + + expect(report.ok).toBe(false) + expect(report.stale).toBe(1) + expect(report.checks.filter((check) => check.state === 'ok')).toHaveLength(1) + }) + + it('carries the last outcome through so a failing-but-running job is visible', () => { + const report = evaluateCronHeartbeats({ + entries: [entry('/api/a/cron', 60)], + rows: [ + row({ + path: '/api/a/cron', + lastStartedAt: isoSecondsAgo(30), + lastStatus: 'error', + lastHttpStatus: 500, + lastDurationMs: 42, + }), + ], + now: NOW, + }) + + expect(report.ok).toBe(true) + expect(report.checks[0].lastStatus).toBe('error') + expect(report.checks[0].lastHttpStatus).toBe(500) + expect(report.checks[0].lastDurationMs).toBe(42) + expect(isFailingStatus('error', 500)).toBe(true) + }) + + it('ignores a malformed timestamp instead of throwing', () => { + const report = evaluateCronHeartbeats({ + entries: [entry('/api/a/cron', 60)], + rows: [row({ path: '/api/a/cron', lastStartedAt: 'not-a-date' })], + now: NOW, + }) + + expect(report.ok).toBe(true) + expect(report.checks[0].state).toBe('pending') + }) +}) + +describe('isFailingStatus', () => { + it.each([ + ['ok', 200, false], + // A cron endpoint that redirects did not do its work either; curl -f + // accepts a 3xx, which is exactly why this is worth surfacing separately. + ['ok', 302, true], + ['error', 200, true], + ['ok', 500, true], + [null, 401, true], + [null, null, false], + ])('status %s / http %s -> %s', (status, httpStatus, expected) => { + expect(isFailingStatus(status as string | null, httpStatus as number | null)).toBe(expected) + }) +}) diff --git a/lib/cron/cron-interval.ts b/lib/cron/cron-interval.ts new file mode 100644 index 00000000..af5c531a --- /dev/null +++ b/lib/cron/cron-interval.ts @@ -0,0 +1,208 @@ +/** + * Cron expression → the longest gap between two scheduled runs. + * + * Why this exists: the 2026-11-15 accounted incident. `accounted-cron` lost + * 1 497 of 10 455 runs in a day (14,3 %) because `pids_limit: 30` made + * `fork/exec /bin/sh` fail under the per-minute schedules, and supercronic + * simply skipped those ticks. Nothing in the product noticed: the container + * stayed "Up", every endpoint still answered, and the only trace was a line in + * the cron container's own log. A schedule whose runs stop arriving is the + * worst failure mode in this product — nothing looks broken, the work just + * never happens — so `cron_heartbeats` records every run and + * app/api/cron/health turns "no run arrived within the expected window" into a + * 503 the container healthcheck can fail on. + * + * That check needs to know, per path, how long a gap is normal. That is this + * module: a small, dependency-free interpreter for the 5-field cron syntax + * `vercel.json` is restricted to, plus a brute-force scan of a 12-year window + * to get the WORST-CASE gap rather than an average. Worst case is the correct + * threshold input: a job that runs at 00:00 daily must be allowed 24 h, not + * the 12 h its mean gap would suggest. + * + * The scan is exact for every expression the product uses, including the + * calendar-sensitive ones (`0 0 2 1 *` once a year, `0 0 29 2 *` only in leap + * years). It is not a general cron library: no seconds field, no `@daily` + * aliases, no `L`/`W`/`#` extensions. Anything outside the supported subset + * throws instead of guessing, and the generator that consumes it runs in CI, so + * an unsupported expression fails the build rather than silently producing a + * wrong alert threshold. + */ + +const MINUTE_MS = 60_000 +const HOUR_MS = 60 * MINUTE_MS +const DAY_MS = 24 * HOUR_MS + +/** + * Scan window: 2001-01-01 + 12 years. Twelve years is what it takes to see + * three occurrences of 29 February (2004, 2008, 2012), which is the rarest + * yearly form a cron expression can express. + */ +const SCAN_START_MS = Date.UTC(2001, 0, 1) +const SCAN_DAYS = 12 * 366 + +/** + * Upper bound on matched timestamps per expression. A per-minute job matches + * 1 440 times a day; 20 000 is two weeks of it, far more than needed to see the + * 60-second gap, and it keeps the generator fast when the whole vercel.json is + * scanned. + */ +const MAX_MATCHES = 20_000 + +export interface CronSpec { + readonly minutes: readonly number[] + readonly hours: readonly number[] + readonly daysOfMonth: readonly number[] + readonly months: readonly number[] + readonly daysOfWeek: readonly number[] + /** + * Cron's day rule: when BOTH day-of-month and day-of-week are restricted the + * expression matches if EITHER does; when only one is restricted only that + * one applies. A step over the whole range (star followed by a step) counts + * as unrestricted, as in every cron implementation, because the field still + * starts with a star. + */ + readonly dayOfMonthRestricted: boolean + readonly dayOfWeekRestricted: boolean +} + +function parseField( + field: string, + min: number, + max: number, + name: string, +): { values: number[]; restricted: boolean } { + const trimmed = field.trim() + if (trimmed.length === 0) throw new Error(`cron: empty ${name} field`) + + const seen = new Set() + for (const part of trimmed.split(',')) { + const [rangePart, stepPart, ...rest] = part.split('/') + if (rest.length > 0) throw new Error(`cron: bad step in ${name} field: ${part}`) + + const step = stepPart === undefined ? 1 : Number(stepPart) + if (!Number.isInteger(step) || step < 1) { + throw new Error(`cron: bad step in ${name} field: ${part}`) + } + + let lo: number + let hi: number + if (rangePart === '*') { + lo = min + hi = max + } else if (rangePart.includes('-')) { + const [a, b, ...tail] = rangePart.split('-') + if (tail.length > 0) throw new Error(`cron: bad range in ${name} field: ${part}`) + lo = Number(a) + hi = Number(b) + } else { + lo = Number(rangePart) + // A bare value with a step (`5/10`) means "from 5 to max, every 10th". + hi = stepPart === undefined ? lo : max + } + + if (!Number.isInteger(lo) || !Number.isInteger(hi)) { + throw new Error(`cron: non-numeric value in ${name} field: ${part}`) + } + if (lo < min || hi > max || lo > hi) { + throw new Error(`cron: ${name} field out of range ${min}-${max}: ${part}`) + } + + for (let v = lo; v <= hi; v += step) seen.add(v) + } + + return { values: [...seen].sort((a, b) => a - b), restricted: !trimmed.startsWith('*') } +} + +/** Parse a standard 5-field cron expression. Throws on anything unsupported. */ +export function parseCronExpression(expression: string): CronSpec { + const fields = expression.trim().split(/\s+/) + if (fields.length !== 5) { + throw new Error(`cron: expected 5 fields, got ${fields.length}: ${JSON.stringify(expression)}`) + } + + const [minute, hour, dayOfMonth, month, dayOfWeek] = fields + const minutes = parseField(minute, 0, 59, 'minute') + const hours = parseField(hour, 0, 23, 'hour') + const dom = parseField(dayOfMonth, 1, 31, 'day-of-month') + const months = parseField(month, 1, 12, 'month') + // Cron allows both 0 and 7 for Sunday; normalise 7 to 0. + const dow = parseField(dayOfWeek, 0, 7, 'day-of-week') + + return { + minutes: minutes.values, + hours: hours.values, + daysOfMonth: dom.values, + months: months.values, + daysOfWeek: [...new Set(dow.values.map((d) => (d === 7 ? 0 : d)))].sort((a, b) => a - b), + dayOfMonthRestricted: dom.restricted, + dayOfWeekRestricted: dow.restricted, + } +} + +function matchesDay(spec: CronSpec, dayStartMs: number): boolean { + const date = new Date(dayStartMs) + if (!spec.months.includes(date.getUTCMonth() + 1)) return false + + const domMatch = spec.daysOfMonth.includes(date.getUTCDate()) + const dowMatch = spec.daysOfWeek.includes(date.getUTCDay()) + + if (spec.dayOfMonthRestricted && spec.dayOfWeekRestricted) return domMatch || dowMatch + if (spec.dayOfMonthRestricted) return domMatch + if (spec.dayOfWeekRestricted) return dowMatch + return true +} + +/** + * The longest interval, in seconds, between two consecutive runs of + * `expression` over a 12-year window. + * + * Throws when the expression never matches twice in the window — that is not a + * schedule, and silently returning 0 would make the health check permanently + * red or permanently green depending on which way the caller rounds. + */ +export function maxIntervalSeconds(expression: string): number { + const spec = parseCronExpression(expression) + + // Every minute: the answer is exactly one minute and the scan is pointless. + if (spec.minutes.length * spec.hours.length === 24 * 60) return 60 + + let previous: number | null = null + let longest = 0 + let matches = 0 + + for (let day = 0; day < SCAN_DAYS && matches < MAX_MATCHES; day++) { + const dayStart = SCAN_START_MS + day * DAY_MS + if (!matchesDay(spec, dayStart)) continue + + for (const hour of spec.hours) { + for (const minute of spec.minutes) { + const at = dayStart + hour * HOUR_MS + minute * MINUTE_MS + if (previous !== null) { + const gap = (at - previous) / 1000 + if (gap > longest) longest = gap + } + previous = at + if (++matches >= MAX_MATCHES) break + } + if (matches >= MAX_MATCHES) break + } + } + + if (matches < 2) { + throw new Error(`cron: ${JSON.stringify(expression)} never matches twice in the scan window`) + } + + return longest +} + +/** + * Human-readable worst-case gap, for the generated file and for operators + * reading a 503 body. Deliberately coarse: it is a threshold input, not a + * display string that needs to be exact. + */ +export function describeGap(seconds: number): string { + if (seconds < 120) return `${seconds} s` + if (seconds < 2 * 3600) return `${Math.round(seconds / 60)} min` + if (seconds < 2 * 86_400) return `${Math.round(seconds / 3600)} h` + return `${Math.round(seconds / 86_400)} dygn` +} diff --git a/lib/cron/heartbeat-evaluation.ts b/lib/cron/heartbeat-evaluation.ts new file mode 100644 index 00000000..7ef9d896 --- /dev/null +++ b/lib/cron/heartbeat-evaluation.ts @@ -0,0 +1,146 @@ +/** + * Missed-cron detection, the pure half. + * + * The store and the endpoint live in ./heartbeat-store.ts and + * app/api/cron/health/route.ts; everything that decides ok/stale is here so it + * can be tested without a database. + * + * The threshold is deliberately generous, because the cost of the two mistakes + * is not symmetric. Too tight and every slow run flaps the container + * unhealthy, which trains people to ignore the check. Too loose and a stalled + * schedule keeps looking fine — the failure mode this exists to catch (see the + * 2026-11-15 pids_limit incident in the cron_heartbeats migration). Two missed + * intervals plus a two-minute floor means a per-minute job is flagged after + * 4 minutes and a daily job after 48 h 2 min, while one skipped tick or one + * slow run is not. + */ + +import type { CronScheduleEntry } from './schedules.generated' + +/** A run is stale after this many missed intervals. */ +export const CRON_STALE_MULTIPLIER = 2 + +/** Floor added on top of the interval, absorbing clock skew and one slow run. */ +export const CRON_STALE_GRACE_SECONDS = 120 + +export type CronHeartbeatState = 'ok' | 'pending' | 'stale' + +/** A row as the store returns it (snake_case columns already mapped). */ +export interface CronHeartbeatRow { + path: string + declaredAt: string | null + lastStartedAt: string | null + lastCompletedAt: string | null + lastStatus: string | null + lastHttpStatus: number | null + lastDurationMs: number | null +} + +export interface CronHeartbeatCheck { + path: string + schedule: string + maxIntervalSeconds: number + /** Age at which this path is reported stale. */ + allowedAgeSeconds: number + lastStartedAt: string | null + ageSeconds: number | null + state: CronHeartbeatState + lastStatus: string | null + lastHttpStatus: number | null + lastDurationMs: number | null +} + +export interface CronHeartbeatReport { + /** False only when at least one path is stale. Pending paths do not fail. */ + ok: boolean + checkedAt: string + total: number + stale: number + pending: number + checks: CronHeartbeatCheck[] +} + +export function allowedAgeSeconds(maxIntervalSeconds: number): number { + return maxIntervalSeconds * CRON_STALE_MULTIPLIER + CRON_STALE_GRACE_SECONDS +} + +function ageInSeconds(reference: string | null, now: number): number | null { + if (!reference) return null + const at = Date.parse(reference) + if (!Number.isFinite(at)) return null + return Math.max(0, Math.round((now - at) / 1000)) +} + +/** + * Evaluate every scheduled path against its heartbeat row. + * + * States: + * ok — a run started within the allowed age. + * pending — no run yet, but the path has not been declared longer than its + * own cadence allows. A freshly added job, or a fresh install. + * stale — a run used to arrive and stopped, OR the path was declared + * longer ago than its cadence and has never run. Both are real + * defects; only `stale` fails the endpoint. + * + * A path with neither a row nor a declaration is reported `pending` here; the + * route declares it before evaluating, so this only happens on the first call. + */ +export function evaluateCronHeartbeats(params: { + entries: readonly CronScheduleEntry[] + rows: readonly CronHeartbeatRow[] + now: number +}): CronHeartbeatReport { + const byPath = new Map(params.rows.map((row) => [row.path, row])) + + const checks: CronHeartbeatCheck[] = params.entries.map((entry) => { + const row = byPath.get(entry.path) + const allowed = allowedAgeSeconds(entry.maxIntervalSeconds) + + // Staleness is measured from the last START. A run that hangs never + // completes, and supercronic skips every later tick while it hangs, so + // last_completed_at would keep a dead schedule looking alive. + const ranAt = row?.lastStartedAt ?? null + const reference = ranAt ?? row?.declaredAt ?? null + const age = ageInSeconds(reference, params.now) + + let state: CronHeartbeatState = 'ok' + if (age === null) state = 'pending' + else if (age > allowed) state = 'stale' + else if (ranAt === null) state = 'pending' + + return { + path: entry.path, + schedule: entry.schedule, + maxIntervalSeconds: entry.maxIntervalSeconds, + allowedAgeSeconds: allowed, + lastStartedAt: ranAt, + ageSeconds: age, + state, + lastStatus: row?.lastStatus ?? null, + lastHttpStatus: row?.lastHttpStatus ?? null, + lastDurationMs: row?.lastDurationMs ?? null, + } + }) + + const stale = checks.filter((check) => check.state === 'stale').length + const pending = checks.filter((check) => check.state === 'pending').length + + return { + ok: stale === 0, + checkedAt: new Date(params.now).toISOString(), + total: checks.length, + stale, + pending, + checks, + } +} + +/** + * A run that finished non-2xx is not a missed tick (it ran), but it is worth + * surfacing next to the heartbeat: a schedule that "works" while every run + * fails is the same silent outage with an extra step. + */ +export function isFailingStatus(status: string | null, httpStatus: number | null): boolean { + if (status && status !== 'ok') return true + return httpStatus !== null && (httpStatus < 200 || httpStatus >= 300) +} diff --git a/lib/cron/heartbeat-store.ts b/lib/cron/heartbeat-store.ts new file mode 100644 index 00000000..3f28738a --- /dev/null +++ b/lib/cron/heartbeat-store.ts @@ -0,0 +1,139 @@ +import 'server-only' + +import { createServiceClientNoCookies } from '@/lib/auth/api-keys' +import { createLogger, type Logger } from '@/lib/logger' +import type { CronHeartbeatRow } from './heartbeat-evaluation' + +/** + * Cron heartbeat storage. + * + * Two callers: + * - lib/api/with-cron-context.ts, once per run (best effort: a monitoring + * write must never fail the job it monitors). + * - app/api/cron/health/route.ts, which declares unknown paths and reads the + * table to decide ok/stale. + * + * Everything goes through the service role: cron_heartbeats has RLS enabled and + * no policies, because instance-wide scheduling state is not tenant data. + * + * No-ops when Supabase is not configured (unit tests, `next build`, a hosted + * deployment reading its schedule from Vercel). The heartbeat check is a + * self-hosted guarantee; a missing store must not turn into a 500 in the cron + * path. + */ + +const TABLE = 'cron_heartbeats' + +const log: Logger = createLogger('cron/heartbeat-store') + +function storeConfigured(): boolean { + return Boolean(process.env.NEXT_PUBLIC_SUPABASE_URL && process.env.SUPABASE_SERVICE_ROLE_KEY) +} + +export interface CronHeartbeatInput { + path: string + /** ISO timestamp of when the run started (the staleness input). */ + startedAt: string + /** ISO timestamp of when the run finished. */ + completedAt: string + /** 'ok' | 'error'. Kept as a string so a future state does not need a migration. */ + status: string + httpStatus: number | null + durationMs: number +} + +/** + * Upsert the run that just finished. Best effort by contract: logs and returns + * on any failure, never throws. A heartbeat write that breaks a cron run would + * be a worse outage than the one it exists to detect. + */ +export async function recordCronHeartbeat(input: CronHeartbeatInput): Promise { + if (!storeConfigured()) return + + try { + const { error } = await createServiceClientNoCookies() + .from(TABLE) + .upsert( + { + path: input.path, + last_started_at: input.startedAt, + last_completed_at: input.completedAt, + last_status: input.status, + last_http_status: input.httpStatus, + last_duration_ms: input.durationMs, + updated_at: input.completedAt, + }, + { onConflict: 'path' }, + ) + + if (error) { + log.warn('heartbeat write failed', { path: input.path, reason: error.message }) + } + } catch (err) { + log.warn('heartbeat write threw', { + path: input.path, + reason: err instanceof Error ? err.message : String(err), + }) + } +} + +/** + * Register paths the generated schedule knows about but the table has not seen. + * + * This is what gives a new schedule a grace period: the row it creates carries + * declared_at = now, so the evaluator can tell "added yesterday, has not had its + * first tick" from "ran until last week and stopped". ignoreDuplicates keeps an + * existing row (and its run history) untouched. + */ +export async function declareCronPaths(paths: readonly string[]): Promise { + if (!storeConfigured() || paths.length === 0) return + + try { + const { error } = await createServiceClientNoCookies() + .from(TABLE) + .upsert( + paths.map((path) => ({ path })), + { onConflict: 'path', ignoreDuplicates: true }, + ) + + if (error) { + log.warn('heartbeat declaration failed', { paths: paths.length, reason: error.message }) + } + } catch (err) { + log.warn('heartbeat declaration threw', { + paths: paths.length, + reason: err instanceof Error ? err.message : String(err), + }) + } +} + +/** + * All heartbeat rows. Throws on failure: the health route must be able to say + * "cannot verify" out loud (503) instead of reporting a healthy cron it could + * not read. + */ +export async function loadCronHeartbeats(): Promise { + const { data, error } = await createServiceClientNoCookies() + .from(TABLE) + .select( + 'path, declared_at, last_started_at, last_completed_at, last_status, last_http_status, last_duration_ms', + ) + + if (error) throw new Error(`cron_heartbeats read failed: ${error.message}`) + if (!data) return [] + + return data.map((row) => ({ + path: row.path as string, + declaredAt: (row.declared_at as string | null) ?? null, + lastStartedAt: (row.last_started_at as string | null) ?? null, + lastCompletedAt: (row.last_completed_at as string | null) ?? null, + lastStatus: (row.last_status as string | null) ?? null, + lastHttpStatus: (row.last_http_status as number | null) ?? null, + lastDurationMs: (row.last_duration_ms as number | null) ?? null, + })) +} + +/** True when the heartbeat store is wired; the route and tests both ask. */ +export function cronHeartbeatStoreConfigured(): boolean { + return storeConfigured() +} diff --git a/lib/cron/schedules.generated.ts b/lib/cron/schedules.generated.ts new file mode 100644 index 00000000..2af4994b --- /dev/null +++ b/lib/cron/schedules.generated.ts @@ -0,0 +1,60 @@ +// AUTO-GENERATED: do not edit. Run `npm run crontabs:generate` to regenerate. +// +// Variant: self-hosted (the crontab a Docker install runs). +// Source of truth: the `crons` array in vercel.json, via +// scripts/generate-crontabs.ts. scripts/__tests__/generate-crontabs.test.ts +// fails CI if this file drifts from it. +// +// Consumed by lib/cron/heartbeats.ts: app/api/cron/health compares the last +// recorded run of each path against maxIntervalSeconds and answers 503 when a +// schedule stops arriving. The container healthcheck on the cron service calls +// that endpoint, so a silent stop becomes a visible unhealthy container +// instead of a log line nobody reads (see the 2026-11-15 pids_limit incident). +// +// maxIntervalSeconds is the WORST-CASE gap over a 12-year scan, not an +// average: a daily job must be allowed 24 h, and 29 February must not make a +// yearly job look dead for four years. + +export interface CronScheduleEntry { + readonly path: string + readonly schedule: string + /** Worst-case seconds between two runs, over a 12-year scan window. */ + readonly maxIntervalSeconds: number +} + +export const CRON_SCHEDULES: readonly CronScheduleEntry[] = [ + { path: '/api/deadlines/status/cron', schedule: '0 6 * * *', maxIntervalSeconds: 86400 }, // 24 h + { path: '/api/invoices/recurring/cron', schedule: '0 * * * *', maxIntervalSeconds: 3600 }, // 60 min + { path: '/api/settings/booking-templates/sync/cron', schedule: '30 4 * * *', maxIntervalSeconds: 86400 }, // 24 h + { path: '/api/tax-deadlines/cron', schedule: '0 0 * * *', maxIntervalSeconds: 86400 }, // 24 h + { path: '/api/extensions/enable-banking/sync/cron', schedule: '0 5 * * *', maxIntervalSeconds: 86400 }, // 24 h + { path: '/api/extensions/stripe/transactions/cron', schedule: '30 3 * * *', maxIntervalSeconds: 86400 }, // 24 h + { path: '/api/extensions/woocommerce/orders/cron', schedule: '45 3 * * *', maxIntervalSeconds: 86400 }, // 24 h + { path: '/api/extensions/shopify/orders/cron', schedule: '15 3 * * *', maxIntervalSeconds: 86400 }, // 24 h + { path: '/api/extensions/zettle/orders/cron', schedule: '30 3 * * *', maxIntervalSeconds: 86400 }, // 24 h + { path: '/api/documents/verify/cron', schedule: '0 3 * * *', maxIntervalSeconds: 86400 }, // 24 h + { path: '/api/documents/reanchor/cron', schedule: '30 3 * * *', maxIntervalSeconds: 86400 }, // 24 h + { path: '/api/sandbox/cleanup/cron', schedule: '0 4 * * *', maxIntervalSeconds: 86400 }, // 24 h + { path: '/api/events/cleanup/cron', schedule: '0 2 * * *', maxIntervalSeconds: 86400 }, // 24 h + { path: '/api/extensions/cloud-backup/auto-sync/cron', schedule: '0 * * * *', maxIntervalSeconds: 3600 }, // 60 min + { path: '/api/idempotency/cleanup/cron', schedule: '30 * * * *', maxIntervalSeconds: 3600 }, // 60 min + { path: '/api/pending-operations/expire/cron', schedule: '30 2 * * *', maxIntervalSeconds: 86400 }, // 24 h + { path: '/api/extensions/skatteverket/ombud/sync/cron', schedule: '30 3 * * *', maxIntervalSeconds: 86400 }, // 24 h + { path: '/api/extensions/skatteverket/skattekonto/sync/cron', schedule: '0 4 * * *', maxIntervalSeconds: 86400 }, // 24 h + { path: '/api/extensions/skatteverket/agi/kvittenser/cron', schedule: '*/15 * * * *', maxIntervalSeconds: 900 }, // 15 min + { path: '/api/extensions/skatteverket/vat/kvittenser/cron', schedule: '30 */2 * * *', maxIntervalSeconds: 7200 }, // 2 h + { path: '/api/webhooks/dispatch/cron', schedule: '* * * * *', maxIntervalSeconds: 60 }, // 60 s + { path: '/api/extensions/whatsapp-inbox/sweep/cron', schedule: '* * * * *', maxIntervalSeconds: 60 }, // 60 s + { path: '/api/extensions/whatsapp-inbox/retention/cron', schedule: '15 4 * * *', maxIntervalSeconds: 86400 }, // 24 h + { path: '/api/extensions/invoice-inbox/sweep/cron', schedule: '*/2 * * * *', maxIntervalSeconds: 120 }, // 2 min + { path: '/api/extensions/invoice-inbox/underlag-reconcile/cron', schedule: '45 5 * * *', maxIntervalSeconds: 86400 }, // 24 h + { path: '/api/extensions/arcim-migration/complete-invoice-lines/cron', schedule: '20 * * * *', maxIntervalSeconds: 3600 }, // 60 min + { path: '/api/extensions/arcim-migration/cleanup/cron', schedule: '*/5 * * * *', maxIntervalSeconds: 300 }, // 5 min + { path: '/api/bookkeeping/accruals/post-due/cron', schedule: '15 5 * * *', maxIntervalSeconds: 86400 }, // 24 h + { path: '/api/receipt-hunt/cron', schedule: '30 5 * * *', maxIntervalSeconds: 86400 }, // 24 h + { path: '/api/notifications/bookkeeping-digest/cron', schedule: '45 5 * * *', maxIntervalSeconds: 86400 }, // 24 h + { path: '/api/notifications/multi-user-grace/cron', schedule: '0 7 * * *', maxIntervalSeconds: 86400 }, // 24 h + { path: '/api/peppol/inbound/cron', schedule: '*/10 * * * *', maxIntervalSeconds: 600 }, // 10 min + { path: '/api/peppol/outbound/status/cron', schedule: '5,20,35,50 * * * *', maxIntervalSeconds: 900 }, // 15 min + { path: '/api/connector/sync/cron', schedule: '17 * * * *', maxIntervalSeconds: 3600 }, // 60 min +] diff --git a/scripts/__tests__/generate-crontabs.test.ts b/scripts/__tests__/generate-crontabs.test.ts index a10551a1..a3edc046 100644 --- a/scripts/__tests__/generate-crontabs.test.ts +++ b/scripts/__tests__/generate-crontabs.test.ts @@ -4,6 +4,8 @@ import { join, dirname } from 'node:path' import { fileURLToPath } from 'node:url' import { buildCrontab, + buildScheduleEntries, + buildScheduleModule, readVercelCrons, scheduleFor, EXCLUDED_PATHS, @@ -283,3 +285,39 @@ describe('every cron route has a schedule', () => { } }) }) + +describe('lib/cron/schedules.generated.ts mirrors the self-hosted crontab', () => { + const generated = readFileSync(join(ROOT, 'lib', 'cron', 'schedules.generated.ts'), 'utf8') + const entries = buildScheduleEntries(crons, 'self-hosted') + + it('on-disk file matches the generator output byte for byte', () => { + expect( + generated, + 'lib/cron/schedules.generated.ts is stale: run `npm run crontabs:generate`.', + ).toBe(buildScheduleModule(crons, 'self-hosted')) + }) + + it('covers exactly the paths crontab.self-hosted runs', () => { + expect(entries.map((entry) => entry.path)).toEqual( + parseCrontab(crontabText('self-hosted')).map((job) => job.path), + ) + }) + + it('carries the same schedule string as the crontab it mirrors', () => { + const crontabJobs = parseCrontab(crontabText('self-hosted')) + for (const entry of entries) { + const job = crontabJobs.find((candidate) => candidate.path === entry.path) + expect(job?.schedule, entry.path).toBe(entry.schedule) + } + }) + + it('gives every path a positive worst-case interval', () => { + // A zero or NaN interval would make the heartbeat check either permanently + // red or permanently green — the two ways this control can be useless. + for (const entry of entries) { + expect(Number.isFinite(entry.maxIntervalSeconds), entry.path).toBe(true) + expect(entry.maxIntervalSeconds, entry.path).toBeGreaterThanOrEqual(60) + expect(entry.maxIntervalSeconds, entry.path).toBeLessThanOrEqual(366 * 86_400) + } + }) +}) diff --git a/scripts/generate-crontabs.ts b/scripts/generate-crontabs.ts index a0c40bda..5f13d5b1 100644 --- a/scripts/generate-crontabs.ts +++ b/scripts/generate-crontabs.ts @@ -24,11 +24,19 @@ import { readFileSync, writeFileSync } from 'node:fs' import { join, dirname } from 'node:path' import { fileURLToPath } from 'node:url' +import { describeGap, maxIntervalSeconds } from '../lib/cron/cron-interval' const __filename = fileURLToPath(import.meta.url) const ROOT = dirname(dirname(__filename)) const VERCEL_JSON_PATH = join(ROOT, 'vercel.json') const DOCKER_DIR = join(ROOT, 'docker') +/** + * Heartbeat detection reads the cadence at runtime, so the same vercel.json + * array is also emitted as a TypeScript module. One generator, one source of + * truth: an expression that is scheduled but unknown to the health check is + * exactly the "silently never runs" failure the check exists to catch. + */ +const SCHEDULE_MODULE_PATH = join(ROOT, 'lib', 'cron', 'schedules.generated.ts') export type CrontabVariant = 'hosted' | 'self-hosted' @@ -243,6 +251,82 @@ export function buildCrontab( return `${lines.join('\n')}\n` } +export interface CronScheduleEntry { + readonly path: string + readonly schedule: string + /** Worst-case seconds between two runs, over a 12-year scan window. */ + readonly maxIntervalSeconds: number +} + +/** + * The job set one variant actually runs (vercel.json minus exclusions, plus + * that variant's EXTRA_JOBS) with its worst-case cadence resolved. + * + * The health check uses the self-hosted set, because that is the crontab a + * Docker install runs; a hosted deployment gets its schedule from Vercel and is + * not the deployment this check guards. + */ +export function buildScheduleEntries( + crons: VercelCron[], + variant: CrontabVariant, +): CronScheduleEntry[] { + const scheduled = crons + .filter((cron) => !(cron.path in EXCLUDED_PATHS)) + .map((cron) => ({ path: cron.path, schedule: scheduleFor(cron, variant) })) + const extra = EXTRA_JOBS[variant].map((job) => ({ path: job.path, schedule: job.schedule })) + + return [...scheduled, ...extra].map((job) => ({ + path: job.path, + schedule: job.schedule, + maxIntervalSeconds: maxIntervalSeconds(job.schedule), + })) +} + +/** Render lib/cron/schedules.generated.ts. Always LF, always newline-terminated. */ +export function buildScheduleModule(crons: VercelCron[], variant: CrontabVariant): string { + const entries = buildScheduleEntries(crons, variant) + const width = + entries.reduce((max, entry) => Math.max(max, entry.path.length + 3), 0) + 2 + + const lines = [ + '// AUTO-GENERATED: do not edit. Run `npm run crontabs:generate` to regenerate.', + '//', + `// Variant: ${variant} (the crontab a Docker install runs).`, + '// Source of truth: the `crons` array in vercel.json, via', + '// scripts/generate-crontabs.ts. scripts/__tests__/generate-crontabs.test.ts', + '// fails CI if this file drifts from it.', + '//', + '// Consumed by lib/cron/heartbeats.ts: app/api/cron/health compares the last', + '// recorded run of each path against maxIntervalSeconds and answers 503 when a', + '// schedule stops arriving. The container healthcheck on the cron service calls', + '// that endpoint, so a silent stop becomes a visible unhealthy container', + '// instead of a log line nobody reads (see the 2026-11-15 pids_limit incident).', + '//', + '// maxIntervalSeconds is the WORST-CASE gap over a 12-year scan, not an', + '// average: a daily job must be allowed 24 h, and 29 February must not make a', + '// yearly job look dead for four years.', + '', + 'export interface CronScheduleEntry {', + ' readonly path: string', + ' readonly schedule: string', + ' /** Worst-case seconds between two runs, over a 12-year scan window. */', + ' readonly maxIntervalSeconds: number', + '}', + '', + 'export const CRON_SCHEDULES: readonly CronScheduleEntry[] = [', + ...entries.map( + (entry) => + ` { path: '${entry.path}',`.padEnd(width + 2) + + ` schedule: '${entry.schedule}',`.padEnd(24) + + ` maxIntervalSeconds: ${entry.maxIntervalSeconds} }, // ${describeGap(entry.maxIntervalSeconds)}`, + ), + ']', + '', + ] + + return `${lines.join('\n')}` +} + function main(): void { const crons = readVercelCrons(readFileSync(VERCEL_JSON_PATH, 'utf8')) @@ -282,6 +366,13 @@ function main(): void { ) } + // The runtime half of the same source of truth: heartbeat detection needs + // each path's worst-case cadence, so the self-hosted job set is emitted as a + // TypeScript module next to the crontab it mirrors. + const scheduleEntries = buildScheduleEntries(crons, 'self-hosted') + writeFileSync(SCHEDULE_MODULE_PATH, buildScheduleModule(crons, 'self-hosted'), 'utf8') + console.log(`Wrote lib/cron/schedules.generated.ts: ${scheduleEntries.length} schedules`) + const skipped = Object.keys(EXCLUDED_PATHS) if (skipped.length > 0) { console.log(`Excluded ${skipped.length} path(s): ${skipped.join(', ')}`) diff --git a/supabase/migrations/20261115190000_cron_heartbeats.sql b/supabase/migrations/20261115190000_cron_heartbeats.sql new file mode 100644 index 00000000..df8da72a --- /dev/null +++ b/supabase/migrations/20261115190000_cron_heartbeats.sql @@ -0,0 +1,64 @@ +-- Cron heartbeat: make a schedule that stops arriving visible. +-- +-- The 2026-11-15 incident: accounted-cron lost 1 497 of 10 455 runs in a day +-- (14,3 %) because pids_limit 30 made `fork/exec /bin/sh` fail whenever the +-- per-minute schedules coincided. supercronic silently skipped those ticks. +-- The container stayed "Up", every endpoint kept answering 200, and the only +-- trace was a log line in the cron container. lib/auth/cron.ts already reports +-- an individual FAILED run to the observability sink; nothing could see a run +-- that never started. +-- +-- This table is the durable half of the fix: every cron run upserts one row per +-- path with when it started and how it ended, and app/api/cron/health compares +-- the newest row against the path's worst-case cadence (lib/cron/ +-- schedules.generated.ts, generated from vercel.json). The cron container's +-- healthcheck calls that endpoint, so a schedule that stops arriving turns into +-- an unhealthy container instead of a silent gap. +-- +-- Shape notes: +-- * One row per scheduled path, not per run. Volume matters: 34 schedules at +-- up to 1 440 runs/day each would be ~8k rows/day forever, and all the check +-- needs is "when did this last start". The upsert keeps the table at 34 +-- rows. +-- * No company_id. A cron run is instance-wide, and pretending otherwise +-- would make the same schedule look healthy in one tenant and dead in +-- another with no way to reconcile them. +-- * declared_at is set when the health check first sees a path in the +-- generated schedule list. That is what separates "added to vercel.json +-- yesterday, has not had its first tick yet" from "stopped running a week +-- ago": a path with no run is only stale once declared_at is older than its +-- own cadence, never immediately. Without it, every new job and every fresh +-- install would report red until its first run. +-- * last_started_at, not last_completed_at, is the staleness input. A run that +-- hangs never completes, and supercronic then skips every later tick — +-- exactly the failure that must look dead. +-- +-- Access: RLS enabled with no policies. Only the service role (the cron paths +-- and the health route, via createServiceClientNoCookies) reads or writes it; +-- anon/authenticated have no business seeing instance-wide scheduling state. + +CREATE TABLE IF NOT EXISTS public.cron_heartbeats ( + path TEXT PRIMARY KEY, + declared_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + last_started_at TIMESTAMPTZ, + last_completed_at TIMESTAMPTZ, + last_status TEXT, + last_http_status INTEGER, + last_duration_ms INTEGER, + updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); + +COMMENT ON TABLE public.cron_heartbeats IS + 'One row per scheduled cron path: newest run start/outcome. Read by app/api/cron/health to detect schedules that stop arriving (2026-11-15 pids_limit incident).'; +COMMENT ON COLUMN public.cron_heartbeats.declared_at IS + 'When the health check first saw this path in the generated schedule list. Grace for a path that has never run.'; +COMMENT ON COLUMN public.cron_heartbeats.last_started_at IS + 'Start of the newest run. The staleness input: a hung run also stops every later tick.'; + +CREATE INDEX IF NOT EXISTS idx_cron_heartbeats_last_started_at + ON public.cron_heartbeats (last_started_at DESC NULLS LAST); + +ALTER TABLE public.cron_heartbeats ENABLE ROW LEVEL SECURITY; + +REVOKE ALL ON public.cron_heartbeats FROM anon; +REVOKE ALL ON public.cron_heartbeats FROM authenticated; -- 2.54.0 From f34bd26425e3c766ec5ec00cbb402d0c50f749a4 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Sun, 15 Nov 2026 20:13:28 +0100 Subject: [PATCH 5/5] =?UTF-8?q?fix(security):=20Semgrep-steget=20gr=C3=B6n?= =?UTF-8?q?t=20=E2=80=94=20min-release-age=3D7=20i=20.npmrc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Semgrep p/ci --error gav ett enda blockerande fynd efter att Trivy och OSV blivit gröna: .npmrc saknade minsta release-ålder (package_managers.npm.npm-missing-minimum-release-age). Regeln finns för att en komprometterad npm-release oftast rycks tillbaka inom några dagar; att vänta sju dagar innan en ny version får lösas in tar bort det billigaste angreppsfönstret. npm >= 11.10 förstår nyckeln (vi kör 11.19.1), äldre npm ignorerar okända nycklar. Verifierat: npm config get min-release-age -> 7, npm install --package-lock-only gav ingen låsfillsdiff, semgrep scan --config=p/ci --error -> rc=0 utan fynd. Fälla: gäller även egna @siax/*-paket. Behöver en färsk intern publicering in inom sju dagar används --min-release-age=0 i det enskilda fallet, inte ett sänkt tak i .npmrc. --- .npmrc | 5 +++++ changes/2026-11-15-osv-gaten-gron.md | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/.npmrc b/.npmrc index c277fc05..af5e3a7e 100644 --- a/.npmrc +++ b/.npmrc @@ -2,3 +2,8 @@ //git.siax.io/api/packages/siax/npm/:_authToken=${NODE_AUTH_TOKEN} engine-strict=true fund=false +# Semgrep package_managers.npm.npm-missing-minimum-release-age (blocking): +# a compromised release is usually yanked within days, so wait a week before +# resolving a newly published version. Added 2026-11-15 after the security gate +# flagged it; npm >= 11.10 understands the key, older npm ignores it. +min-release-age=7 diff --git a/changes/2026-11-15-osv-gaten-gron.md b/changes/2026-11-15-osv-gaten-gron.md index f997c1dd..c5554711 100644 --- a/changes/2026-11-15-osv-gaten-gron.md +++ b/changes/2026-11-15-osv-gaten-gron.md @@ -82,3 +82,29 @@ Enda beteendepåverkande posten är `osv-scanner.toml` (om den tas bort blir gaten röd igen på xlsx). Paketbumparna är patch/minor utom `minimatch` 9 → 11, som bara används av lint-verktygskedjan och verifieras av `check:lint` + testsviten. + +## Tillägg: Semgrep-steget (2026-11-15, samma PR) + +Efter Trivy och OSV blev två steg gröna och det tredje rött: **Semgrep +(`p/ci --error`)** gav exakt **ett** fynd: + +``` +.npmrc + package_managers.npm.npm-missing-minimum-release-age [Blocking] + This .npmrc does not set a minimum release age ... Add `min-release-age = 7` +``` + +Regeln är rimlig: en komprometterad release rycks oftast tillbaka inom några +dagar, så att vänta en vecka innan en ny version får lösas in tar bort det +billigaste angreppsfönstret. npm ≥ 11.10 förstår nyckeln (vi kör 11.19.1); +äldre npm ignorerar okända nycklar, så `.npmrc` förblir kompatibel. + +Åtgärd: `min-release-age=7` i `.npmrc` med kommentar om varför. Verifierat: +`npm config get min-release-age` → `7`, `npm install --package-lock-only` gav +ingen låsfillsdiff, och hela Semgrep-skanningen är därefter ren (`rc=0`, "no +findings"). + +Fälla att känna till: regeln gäller även våra egna `@siax/*`-paket. Behöver en +färsk intern publicering konsumeras inom sju dagar måste den hämtas med +`--min-release-age=0` — det är ett medvetet undantag i det enskilda fallet, inte +ett skäl att sänka taket i `.npmrc`. -- 2.54.0