Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs: correct role, dependabot and image-scan statements for 0.23.5

Yudhi Armyndharis92ff7ae9613d
diff --git a/.env.example b/.env.example
index a9dfdc02d..57e900c60 100644
--- a/.env.example
+++ b/.env.example
@@ -32,7 +32,7 @@ PORT=2785
API_PORT=2785
# Serve the bundled dashboard from the API process. Set false for an API-only deployment.
# SERVE_DASHBOARD=true
-LOG_LEVEL=info # error | warn | info | debug
+LOG_LEVEL=info # error | warn | info | debug | verbose
# Console output format. Default: json in production (containers, log aggregators),
# human-readable pretty otherwise. Force one with: json | pretty
# LOG_FORMAT=pretty
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 01d836067..7926c86ae 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -460,8 +460,10 @@ jobs:
cache-to: type=gha,mode=max
# Never serve the production stage's apt layer from cache on branch builds either: a
# cached hit installs whatever the apt index held when the layer was first built, so a
- # `:main` image can ship OS packages Debian has since patched. release.yml's docker
- # build carries the same line plus the incident record that motivated it.
+ # `:main` image can ship OS packages Debian has since patched. The filter names a whole
+ # stage, so every branch and pull request build rebuilds all of `production` on both
+ # platforms, not only the apt layer; the builder stage keeps its cache. release.yml's
+ # docker build carries the same line plus the incident record that motivated it.
no-cache-filters: production
# The image carries no USER directive by design: docker-entrypoint.sh starts as root to fix
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 969721edd..9e81a2d8e 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -492,14 +492,16 @@ jobs:
sbom: true
cache-from: type=gha
cache-to: type=gha,mode=max
- # Never serve the production stage's `apt-get update && apt-get install` from cache. That
+ # Never serve the production stage's `apt-get update && apt-get upgrade && apt-get install` from cache. That
# layer's cache key is its own command text, which does not change when Debian publishes a
# security update — so a cached hit silently installs whatever the apt index held when the
# layer was first built, and the release image ships known-vulnerable packages. It is not a
# theoretical risk: the first two v0.12.3 attempts installed chromium 150.0.7871.181 from a
# cached layer while bookworm-security already carried 151.0.7922.71 on BOTH architectures,
- # and image-scan failed with 228 then 240 findings. The builder stage keeps its cache, so
- # only the OS-package layer is rebuilt.
+ # and image-scan failed with 228 then 240 findings. The filter names a whole stage, so every
+ # layer of `production` is rebuilt, not only the OS-package one: the PGDG client, the
+ # production `npm ci`, the browser download and the COPY --from=builder steps too. Only the
+ # builder stage keeps its cache.
no-cache-filters: production
# ──── Boot Smoke (amd64 + arm64) ──────────────────────────────────
@@ -591,7 +593,10 @@ jobs:
# cannot give: audit sees the npm tree, but the Debian packages baked into node:22-slim — and, on
# arm64 only, the `chromium`/`chromium-sandbox` packages the amd64 image never installs (amd64 uses
# a downloaded Chrome-for-Testing binary, not a .deb) — are visible only by scanning the built
- # artifact. Both architectures are scanned because their OS package sets diverge. Runs at release
+ # artifact. Both architectures are scanned because their OS package sets diverge. The amd64
+ # browser is outside that coverage: no dpkg package owns the Chrome for Testing binary and no
+ # lockfile names it, so neither scanner sees it and a clean amd64 scan says nothing about the
+ # browser (.trivyignore records the same, next to the arm64 chromium note). Runs at release
# time, not on every PR, so it never hits the fork-PR permission limits a push/PR scan would.
# `ignore-unfixed` keeps a release from being blocked by a CVE with no fix yet; a fixable
# HIGH/CRITICAL fails the job and — via promote's `needs` below — stops the release tags.
diff --git a/.trivyignore b/.trivyignore
index acf9f9805..74e41d2d0 100644
--- a/.trivyignore
+++ b/.trivyignore
@@ -35,47 +35,20 @@ CVE-2026-69152
# it cannot regress below it — the same invariant the brace-expansion note describes, which is what
# keeps an ID-level ignore honest. Drop this entry once npm ships a bundle with ip-address >= 10.3.1.
CVE-2026-69192
-# CVE-2026-76033 / -76036 / -76037 / -76038 / -76039 / -76040 / -76041 / -76043 / -76044 / -76045 /
-# -76047: Chromium, arm64 image ONLY. Eleven ids, 33 findings.
-#
-# Each lands on `chromium`, `chromium-common` and `chromium-sandbox`, which is why eleven ids produce
-# thirty-three findings. They are arm64-only by construction: Chrome for Testing publishes no
-# linux-arm64 build, so amd64 uses CfT while arm64 installs Debian's chromium (Dockerfile, TARGETARCH
-# branch). Only the arm64 image carries the Debian package, and the amd64 scan is clean.
-#
-# THE FIX EXISTS UPSTREAM BUT NOT IN DEBIAN YET. The image has 151.0.7922.137-1~deb12u1 and Trivy
-# names 151.0.7922.169-1~deb12u1 as fixed. Checked against the security mirror's own package index at
-# the time of writing: bookworm-security still serves .137 for both arm64 and amd64. The release build
-# is not stale; it fetched from bookworm-security with no cached apt layer (`no-cache-filters:
-# production`) and installed the newest version that exists. Rebuilding today changes nothing.
+
+# Chromium: no entry, and the two architectures are not scanned alike.
#
-# Exposure, stated honestly rather than talked down. Unlike the earlier chromium batch, where two of
-# the four were sandbox escapes that `--no-sandbox` made irrelevant, NONE of these are neutralised by
-# how the container runs:
-# - Eight are arbitrary or remote code execution in the renderer: v8 type confusion (-76038, -76047),
-# v8 miscalculation (-76043), Dawn (-76036), WebGL use-after-free (-76045), a use-after-free
-# (-76040), a race condition (-76044) and link following (-76037).
-# - One is a site isolation bypass (-76033) and two are information disclosure (-76039, -76041).
-# Chromium renders content the sender controls (message bodies, link previews, images), so a crafted
-# message is a plausible path to code execution as the `openwa` user inside the arm64 container. The
-# container is the confinement boundary (cap_drop ALL, no-new-privileges, read_only rootfs), and that
-# is all that stands behind it. This is accepted deliberately so the release can ship while Debian has
-# no fixed build, NOT because it is harmless.
+# arm64 installs Debian's `chromium` and `chromium-sandbox` (Dockerfile, TARGETARCH branch), because
+# Chrome for Testing publishes no linux-arm64 build. Those are dpkg packages, so the scan sees them and
+# a fixable HIGH/CRITICAL fails it. `ignore-unfixed` still hides every chromium CVE Debian has not
+# fixed yet, so a passing arm64 scan does not mean the browser has no open advisories. The eleven
+# chromium CVEs this file used to accept (between CVE-2026-76033 and CVE-2026-76047) were fixed in
+# 151.0.7922.169, and bookworm-security has shipped newer chromium builds since.
#
-# Drop all eleven the moment bookworm ships chromium >= 151.0.7922.169 (watch
-# https://security-tracker.debian.org/tracker/source-package/chromium) and re-run the release scan
-# with them removed before assuming they are gone.
-CVE-2026-76033
-CVE-2026-76036
-CVE-2026-76037
-CVE-2026-76038
-CVE-2026-76039
-CVE-2026-76040
-CVE-2026-76041
-CVE-2026-76043
-CVE-2026-76044
-CVE-2026-76045
-CVE-2026-76047
+# amd64 downloads a Chrome for Testing binary into /opt/puppeteer. No dpkg package owns it and no
+# lockfile names it, so neither the OS nor the library scanner can see it: a clean amd64 scan says
+# nothing about the browser. Its version is the pin in the Dockerfile, and no scan will flag that pin
+# as outdated.
# CVE-2026-73566 — node-tar denial of service via a crafted long-path archive entry, fixed
# upstream in 7.5.21.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 039dae648..a65247a24 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -27,7 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- A Baileys media download aborted at `MEDIA_DOWNLOAD_MAX_BYTES` reports the bytes received as `sizeBytes`, and a timed-out one its declared size, instead of the cap.
- The webhook docs state that at the default limits media above about 768 KiB reaches webhooks as the omitted marker, and how to raise both limits ([#1569](https://github.com/rmyndharis/OpenWA/issues/1569)). Thanks @Magnarks for the report.
- The takeover sweep marks sessions left `ready` or `initializing` by a node that never returned disconnected, regardless of `AUTO_START_SESSIONS`.
-- Branch Docker images (`:main`, sha tags) rebuild the production apt layer, so they cannot serve stale OS packages from the build cache.
+- Branch Docker images (`:main`, sha tags) rebuild the production stage without the build cache, so they cannot serve stale OS packages.
- The Docker image upgrades the Debian packages inherited from the digest-pinned `node:22-slim` base at build time, so security fixes published after the base snapshot reach them; this clears CVE-2026-86145 and CVE-2026-89161 in `libpcre2-8-0`.
- The Message Tester's bulk-recipients file picker refuses files over 2 MB before reading them.
- A misspelled `LOG_LEVEL` fails the boot naming the accepted values, instead of silently logging at info.
diff --git a/docs/04-security-design.md b/docs/04-security-design.md
index 18161e5f6..fc13f0a5e 100644
--- a/docs/04-security-design.md
+++ b/docs/04-security-design.md
@@ -657,8 +657,8 @@ npm audit --json > audit-report.json
### GitHub Dependabot Configuration
```yaml
-# .github/dependabot.yml — the root npm ecosystem (the file also covers /dashboard,
-# github-actions and docker)
+# .github/dependabot.yml, root npm ecosystem only (the file also covers /dashboard,
+# github-actions and docker). The comment above each ignore is omitted here.
version: 2
updates:
- package-ecosystem: npm
@@ -669,25 +669,36 @@ updates:
open-pull-requests-limit: 5
groups:
minor-and-patch:
- update-types: [minor, patch]
+ update-types:
+ - minor
+ - patch
major:
- update-types: [major]
+ update-types:
+ - major
labels:
- dependencies
ignore:
- # TypeScript 7 is the native port: typescript-eslint and ts-jest cannot load it (#727/#729).
- dependency-name: 'typescript'
versions: ['>=7.0.0']
- # better-sqlite3 v14: v13 is the shipped line (^13.0.3, TypeORM's optional ^12 peer pinned
- # to the root version via overrides, prebuild proven on both architectures by the release
- # boot smoke). The next major stays frozen until re-evaluated.
- dependency-name: 'better-sqlite3'
versions: ['>=14.0.0']
+ - dependency-name: 'puppeteer'
+ versions: ['>24.38.0']
+ - dependency-name: 'audio-decode'
+ versions: ['>=3.0.0']
+ - dependency-name: '@types/node'
+ versions: ['>=23.0.0']
+ - dependency-name: '@nestjs/*'
+ versions: ['>=12.0.0']
+ - dependency-name: 'tar-stream'
+ versions: ['>=3.2.1']
```
-Majors are **not** ignored — they arrive as their own grouped PR, separate from the minor/patch
-group. The only ignores are the two pinned incompatibilities above, each with its lift condition
-documented inline.
+Majors arrive as their own grouped PR, separate from the minor/patch group. Five ignores freeze a
+major line (TypeScript 7, better-sqlite3 14, audio-decode 3, @types/node 23 and later, NestJS 12)
+and two freeze the line in use (puppeteer above the 24.38.0 pin it shares with whatsapp-web.js,
+tar-stream from 3.2.1). Each ignore's reason and lift condition is the comment above it in
+`.github/dependabot.yml`.
### Security Scanning in CI
diff --git a/docs/06-api-specification.md b/docs/06-api-specification.md
index 2fc5dcfc7..cc8f48063 100644
--- a/docs/06-api-specification.md
+++ b/docs/06-api-specification.md
@@ -2553,7 +2553,7 @@ No `@HttpCode` override is present, so this DELETE returns the NestJS default `2
### 6.4.4 Groups
-All group routes are nested under a session: base path `/api/sessions/:sessionId/groups`. Reads (`GET`) require a plain API key; writes (create/modify/leave/revoke) require an `OPERATOR` role key. All routes resolve the engine for the session first, so a session that is not started yields `400 Session is not started`.
+All group routes are nested under a session: base path `/api/sessions/:sessionId/groups`. Reads (`GET`) require a plain API key, except the invite-code read (`GET .../:groupId/invite-code`), which requires an `OPERATOR` role key because the code is a join capability rather than data; writes (create/modify/leave/revoke) require an `OPERATOR` role key. All routes resolve the engine for the session first, so a session that is not started yields `400 Session is not started`.
#### GET /api/sessions/:sessionId/groups
diff --git a/docs/16-risk-management.md b/docs/16-risk-management.md
index e607734e0..c2483779b 100644
--- a/docs/16-risk-management.md
+++ b/docs/16-risk-management.md
@@ -312,7 +312,7 @@ Dependencies (`whatsapp-web.js`, Puppeteer, NestJS, etc.) may have vulnerabiliti
**Mitigation Strategies:**
-> **Current state:** the real dependency check is a dedicated `audit` job in `ci.yml` running `npm run check:audit` over the root tree and `npm audit --audit-level=high` over `dashboard/` (on push / PR — not on a daily schedule); it is deliberately split out of the `Lint` job so a newly published advisory cannot abort the other quality gates. `check:audit` keeps the `high` threshold but applies it per advisory, so one with no patched version can be excused by id in `scripts/check-audit.mjs` — with its reason and removal condition recorded, and a stale entry failing the job — instead of lowering the bar for everything. `release.yml` repeats both and additionally runs a Trivy image scan (`CRITICAL,HIGH`, `ignore-unfixed`) against an explicit `.trivyignore` before the release tags are promoted. Dependabot PRs cover npm for `/` and `/dashboard` (weekly), GitHub Actions (monthly) and Docker base/compose images (weekly), with version-pinned ignores for `typescript >=7` and `better-sqlite3 >=13`. There is **no** standalone `security.yml` and **no** Snyk integration. The workflow below is a recommended enhancement to add scheduled scanning.
+> **Current state:** the real dependency check is a dedicated `audit` job in `ci.yml` running `npm run check:audit` over the root tree and `npm audit --audit-level=high` over `dashboard/` (on push / PR — not on a daily schedule); it is deliberately split out of the `Lint` job so a newly published advisory cannot abort the other quality gates. `check:audit` keeps the `high` threshold but applies it per advisory, so one with no patched version can be excused by id in `scripts/check-audit.mjs` — with its reason and removal condition recorded, and a stale entry failing the job — instead of lowering the bar for everything. `release.yml` repeats both and additionally runs a Trivy image scan (`CRITICAL,HIGH`, `ignore-unfixed`) against an explicit `.trivyignore` before the release tags are promoted. Dependabot PRs cover npm for `/` and `/dashboard` (weekly), GitHub Actions (monthly) and Docker base/compose images (weekly), with version-pinned ignores (seven in the root tree, two in `/dashboard`) whose reasons and lift conditions are recorded in `.github/dependabot.yml`. There is **no** standalone `security.yml` and **no** Snyk integration. The workflow below is a recommended enhancement to add scheduled scanning.
```yaml
# .github/workflows/security.yml
diff --git a/docs/18-sdk-design.md b/docs/18-sdk-design.md
index dd1558380..0f9533aad 100644
--- a/docs/18-sdk-design.md
+++ b/docs/18-sdk-design.md
@@ -215,7 +215,7 @@ Media bodies share the `SendMediaRequest` shape: `{ chatId, url? | base64?, mime
| `deletePicture` | `deletePicture(sessionId, groupId)` | Remove the group's picture. **OPERATOR** |
| `inviteCode` | `inviteCode(sessionId, groupId)` | Get the group invite code and link. **OPERATOR** |
| `revokeInviteCode` | `revokeInviteCode(sessionId, groupId)` | Revoke the current invite code and generate a new one. **OPERATOR** |
-| `getMembershipRequests` | `getMembershipRequests(sessionId, groupId)` | List a group's pending join requests. Requires group admin. **OPERATOR** |
+| `getMembershipRequests` | `getMembershipRequests(sessionId, groupId)` | List a group's pending join requests. Requires group admin. |
| `approveMembershipRequests` | `approveMembershipRequests(sessionId, groupId, participants?)` | Approve pending join requests; omit the list to approve all. **OPERATOR** |
| `rejectMembershipRequests` | `rejectMembershipRequests(sessionId, groupId, participants?)` | Reject pending join requests; omit the list to reject all. **OPERATOR** |
@@ -584,9 +584,9 @@ Resources are accessed as properties on the client (e.g. `client.messages`). All
| `get_picture` | `get_picture(session_id, group_id) -> dict[str, Any]` | The group's picture URL, or `null` when it has none. |
| `set_picture` | `set_picture(session_id, group_id, body) -> SuccessResult` | Set the group's picture. **OPERATOR** |
| `delete_picture` | `delete_picture(session_id, group_id) -> SuccessResult` | Remove the group's picture. **OPERATOR** |
-| `invite_code` | `invite_code(session_id, group_id) -> InviteCodeResponse` | Get the invite code. |
+| `invite_code` | `invite_code(session_id, group_id) -> InviteCodeResponse` | Get the invite code. **OPERATOR** |
| `revoke_invite_code` | `revoke_invite_code(session_id, group_id) -> InviteCodeResponse` | Revoke and regenerate the invite code. **OPERATOR** |
-| `get_membership_requests` | `get_membership_requests(session_id, group_id) -> list[GroupMembershipRequest]` | List a group's pending join requests. Requires group admin. **OPERATOR** |
+| `get_membership_requests` | `get_membership_requests(session_id, group_id) -> list[GroupMembershipRequest]` | List a group's pending join requests. Requires group admin. |
| `approve_membership_requests` | `approve_membership_requests(session_id, group_id, participants=None) -> ParticipantsResult` | Approve pending join requests; omit the list to approve all. **OPERATOR** |
| `reject_membership_requests` | `reject_membership_requests(session_id, group_id, participants=None) -> ParticipantsResult` | Reject pending join requests; omit the list to reject all. **OPERATOR** |
@@ -928,9 +928,9 @@ All payloads are associative arrays; all listed methods are synchronous and retu
| `getPicture` | `getPicture(string $sessionId, string $groupId): array` | The group's picture URL, or `null` when it has none. |
| `setPicture` | `setPicture(string $sessionId, string $groupId, array $body): array` | Set the group's picture. **OPERATOR** |
| `deletePicture` | `deletePicture(string $sessionId, string $groupId): array` | Remove the group's picture. **OPERATOR** |
-| `inviteCode` | `inviteCode(string $sessionId, string $groupId): array` | Get the invite code. |
+| `inviteCode` | `inviteCode(string $sessionId, string $groupId): array` | Get the invite code. **OPERATOR** |
| `revokeInviteCode` | `revokeInviteCode(string $sessionId, string $groupId): array` | Revoke and regenerate the invite code. **OPERATOR** |
-| `getMembershipRequests` | `getMembershipRequests(string $sessionId, string $groupId): array` | List a group's pending join requests. Requires group admin. **OPERATOR** |
+| `getMembershipRequests` | `getMembershipRequests(string $sessionId, string $groupId): array` | List a group's pending join requests. Requires group admin. |
| `approveMembershipRequests` | `approveMembershipRequests(string $sessionId, string $groupId, ?array $participants = null): array` | Approve pending join requests; omit the list to approve all. **OPERATOR** |
| `rejectMembershipRequests` | `rejectMembershipRequests(string $sessionId, string $groupId, ?array $participants = null): array` | Reject pending join requests; omit the list to reject all. **OPERATOR** |
diff --git a/docs/24-mcp-integration.md b/docs/24-mcp-integration.md
index 4f6dc9043..a9b3cef08 100644
--- a/docs/24-mcp-integration.md
+++ b/docs/24-mcp-integration.md
@@ -117,9 +117,10 @@ down on response close — any request can hit any instance.
The surface is an **allowlist by construction** — a capability is exposed only if a
`ToolDescriptor` is written for it. There is no automatic route reflection. Each tool
declares a `tier` (`read` | `write`) and a `requiredRole` when the call warrants one: every
-write carries its privilege level, and so does a read whose payload is itself a credential
-(`GroupGetInviteCode`: the invite code is a transferable join capability, so it sits at
-OPERATOR like the QR endpoint).
+write carries its privilege level, and a read carries the role its REST twin requires. The
+reads at OPERATOR are `WebhooksList`, `WebhookFindBySession` and `WebhookFindOne`,
+`AutomationRuleFindAll` and `AutomationRuleFindOne`, and `GroupGetInviteCode` (the invite
+code is a transferable join capability, so it sits at OPERATOR like the QR endpoint).
| Domain | Read tools | Write tools |
| -------------- | ------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
@@ -127,9 +128,9 @@ OPERATOR like the QR endpoint).
| **Message** | list, history, reactions | send text/image/video/audio/document/location/contact/sticker/template, reply, forward, react |
| **Contact** | list, get, check-number, resolve-phone, profile-picture | block, unblock |
| **Group** | list, get, invite-code (OPERATOR) | create, add participants, set subject, set description |
-| **Webhook** | list, get (read-only) | — |
+| **Webhook** | list, get (OPERATOR) | — |
| **Label** | list, get, chats for a label, labels on a chat | upsert, delete, add to chat, remove from chat |
-| **Automation** | rules list, get | — |
+| **Automation** | rules list, get (OPERATOR) | — |
> **Labels split across the engines**, and each tool's description says which way. Every label
> _read_ needs whatsapp-web.js — Baileys exposes no label query at all. Editing a label (upsert,
@@ -235,9 +236,9 @@ Guidelines:
- **Reuse the response DTO** the matching REST controller uses (e.g.
`WebhookResponseDto.fromEntity`, `SessionResponseDto.fromEntity`). Returning a raw entity
can leak fields the REST API deliberately strips.
-- Mark writes with `tier: 'write'` and the appropriate `requiredRole`. A read can carry a
- `requiredRole` too, when its payload is a credential for a system outside OpenWA rather
- than data (`GroupGetInviteCode` is the current example).
+- Mark writes with `tier: 'write'` and the appropriate `requiredRole`. Give a read the same
+ `requiredRole` as the REST route it mirrors: the webhook and automation-rule reads and
+ `GroupGetInviteCode` sit at OPERATOR because their REST routes do.
- Use `sessionScoped: true` and a non-empty `sessionId` field for any per-session tool so
the scope check applies.
- A snapshot test (`tool-registry.spec.ts`) locks the public tool-name set; update it
diff --git a/src/common/utils/db-errors.spec.ts b/src/common/utils/db-errors.spec.ts
index 9ae86c3dd..fb111e20d 100644
--- a/src/common/utils/db-errors.spec.ts
+++ b/src/common/utils/db-errors.spec.ts
@@ -23,9 +23,9 @@ describe('isMissingTableError', () => {
expect(isUniqueViolation(qfe('UNIQUE constraint failed: templates.name', 'SQLITE_CONSTRAINT_UNIQUE'))).toBe(true);
});
- it('recognizes the RAW SqliteError better-sqlite3 throws at prepare() time (never wrapped by TypeORM)', () => {
- // TypeORM's BetterSqlite3QueryRunner prepares the statement outside its try/catch, so a DELETE on a
- // missing table escapes as the raw driver error — QueryFailedError never enters the picture.
+ it('recognizes the RAW SqliteError better-sqlite3 throws at prepare() time when nothing wraps it', () => {
+ // typeorm 1.1.1 wraps a prepare-time error in QueryFailedError; up to 1.1.0 the statement was prepared
+ // outside the runner's try/catch, so a DELETE on a missing table escaped as this raw driver error.
const raw = Object.assign(new Error('no such table: plugin_instances'), { code: 'SQLITE_ERROR' });
raw.name = 'SqliteError';
expect(isMissingTableError(raw)).toBe(true);
diff --git a/src/common/utils/db-errors.ts b/src/common/utils/db-errors.ts
index c595628a0..43a8458e1 100644
--- a/src/common/utils/db-errors.ts
+++ b/src/common/utils/db-errors.ts
@@ -58,9 +58,11 @@ export function isMissingTableError(err: unknown): boolean {
const message = `${driver?.message ?? ''} ${err.message ?? ''}`;
return /no such table/i.test(message);
}
- // better-sqlite3 validates SQL at prepare() time, and TypeORM's BetterSqlite3QueryRunner creates the
- // statement OUTSIDE its try/catch — so a missing-table error surfaces as the RAW SqliteError, never
- // wrapped in QueryFailedError. Recognize that exact shape (class name + message); a plain Error whose
+ // better-sqlite3 rejects a missing table at prepare() time. Since typeorm 1.1.1 BetterSqlite3QueryRunner
+ // prepares inside its try/catch, so that error arrives wrapped in QueryFailedError (message
+ // 'SqliteError: no such table: x') and the branch above matches it. Up to 1.1.0 the prepare sat outside
+ // the try/catch and the RAW SqliteError escaped unwrapped; that shape is still recognized, for an older
+ // TypeORM copy or a direct driver call. Match it exactly (class name + message): a plain Error whose
// text happens to mention a missing table must still NOT classify.
return isNamedError(err, 'SqliteError') && /no such table/i.test(err.message ?? '');
}
diff --git a/src/main.ts b/src/main.ts
index 63447c942..495dfde47 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -35,8 +35,9 @@ import { RedisIoAdapter } from './modules/events/redis-io.adapter';
let appInstance: INestApplication | undefined;
async function bootstrap() {
- // Apply the operator-configured log verbosity (LOG_LEVEL) before anything logs. Unset means INFO;
- // a misspelling never reaches here, env.validation.ts rejects it at boot.
+ // Apply the operator-configured log verbosity (LOG_LEVEL) before anything logs. Unset means INFO.
+ // A misspelling is skipped here; env.validation.ts rejects it and the boot fails inside
+ // NestFactory.create.
const requestedLevel = process.env.LOG_LEVEL?.trim().toLowerCase();
if (requestedLevel && (Object.values(LogLevel) as string[]).includes(requestedLevel)) {
LoggerService.setLogLevel(requestedLevel as LogLevel);