@lenne.tech/nest-server 12.12.0 → 12.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/rules/configurable-features.md +1 -1
- package/.claude/rules/package-management.md +1 -1
- package/.claude/rules/testing.md +10 -5
- package/FRAMEWORK-API.md +1 -1
- package/dist/core/common/helpers/cookies.helper.js +5 -2
- package/dist/core/common/helpers/cookies.helper.js.map +1 -1
- package/dist/core/common/persistence/sql/postgres/postgres-schema.compiler.js +3 -3
- package/dist/core/common/persistence/sql/postgres/postgres-schema.compiler.js.map +1 -1
- package/dist/core/common/persistence/sql/postgres/postgres-schema.migrator.js +2 -2
- package/dist/core/common/persistence/sql/postgres/postgres-schema.migrator.js.map +1 -1
- package/dist/core/common/persistence/sql/sql-naming.d.ts +1 -0
- package/dist/core/common/persistence/sql/sql-naming.js +7 -0
- package/dist/core/common/persistence/sql/sql-naming.js.map +1 -1
- package/dist/core/modules/ai/models/core-ai-connection.model.d.ts +1 -1
- package/dist/core/modules/ai/models/core-ai-connection.model.js +1 -3
- package/dist/core/modules/ai/models/core-ai-connection.model.js.map +1 -1
- package/dist/core/modules/ai/services/core-ai-budget.service.d.ts +1 -1
- package/dist/core/modules/ai/services/core-ai-budget.service.js +1 -2
- package/dist/core/modules/ai/services/core-ai-budget.service.js.map +1 -1
- package/dist/core/modules/migrate/cli/migrate-cli.js +19 -1
- package/dist/core/modules/migrate/cli/migrate-cli.js.map +1 -1
- package/dist/core/modules/throttler/core-throttler.constants.d.ts +1 -0
- package/dist/core/modules/throttler/core-throttler.constants.js +24 -0
- package/dist/core/modules/throttler/core-throttler.constants.js.map +1 -1
- package/docs/REQUEST-LIFECYCLE.md +1 -1
- package/migration-guides/12.11.x-to-12.12.x.md +6 -0
- package/migration-guides/12.12.0-to-12.12.1.md +101 -0
- package/migration-guides/12.12.1-to-12.12.2.md +87 -0
- package/package.json +3 -3
- package/src/core/common/helpers/cookies.helper.ts +12 -2
- package/src/core/common/persistence/sql/postgres/postgres-schema.compiler.ts +3 -3
- package/src/core/common/persistence/sql/postgres/postgres-schema.migrator.ts +2 -2
- package/src/core/common/persistence/sql/sql-naming.ts +20 -0
- package/src/core/modules/ai/models/core-ai-connection.model.ts +2 -4
- package/src/core/modules/ai/services/core-ai-budget.service.ts +2 -3
- package/src/core/modules/migrate/README.md +4 -1
- package/src/core/modules/migrate/cli/migrate-cli.ts +31 -1
- package/src/core/modules/throttler/README.md +8 -0
- package/src/core/modules/throttler/core-throttler.constants.ts +38 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-cli.js","sourceRoot":"","sources":["../../../../../src/core/modules/migrate/cli/migrate-cli.ts"],"names":[],"mappings":";AAwBA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEzE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAC;AAMpF,SAAS,kBAAkB,CAAC,YAAoB;IAC9C,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;AAC/E,CAAC;AAYD,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AAwBpD,MAAM,UAAU,0BAA0B,CACxC,aAAqB,EACrB,MAAc,OAAO,CAAC,GAAG,EAAE,EAC3B,WAAmB,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAEpE,IAAI,CAAC;QACH,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACzE,OAAO,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CAAC,GAAG,CAClC,CAAC,MAAM,EAAE,EAAE,CACT,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QAC5B,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;YAC3B,OAAO,EAAE,CAAC;YACV,OAAO;QACT,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;IACpC,CAAC,CAAC,CACL,CACF,CAAC;IAEF,YAAY,CAAC,KAAK,CAAC,CAAC;IACpB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC,CAAC;AAkBF,MAAM,MAAM,GAAG,KAAK,IAAmB,EAAE;IACvC,IAAI,CAAC;QACH,MAAM,IAAI,EAAE,CAAC;IACf,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;QACrC,MAAM,YAAY,CAAC,CAAC,CAAC,CAAC;QACtB,OAAO;IACT,CAAC;IACD,MAAM,YAAY,CAAC,CAAC,CAAC,CAAC;AACxB,CAAC,CAAC;AAKF,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC/F,KAAK,MAAM,EAAE,CAAC;AAChB,CAAC;AAGD,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -8,4 +8,28 @@ export const THROTTLER_DEFAULTS = {
|
|
|
8
8
|
ttl: 60_000,
|
|
9
9
|
};
|
|
10
10
|
export const THROTTLER_STORAGE_KINDS = ['database', 'memory', 'redis'];
|
|
11
|
+
const THROTTLER_RESPONSE_HEADERS = ['Retry-After', 'X-RateLimit-Limit', 'X-RateLimit-Remaining', 'X-RateLimit-Reset'];
|
|
12
|
+
export function throttlerResponseHeaders(config) {
|
|
13
|
+
if (config === undefined || config === null || config === false) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
if (config !== true && (typeof config !== 'object' || config.enabled === false)) {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
const settings = (config === true ? {} : config);
|
|
20
|
+
if (settings.setHeaders === false) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
const names = Array.isArray(settings.throttlers) && settings.throttlers.length
|
|
24
|
+
? settings.throttlers.map((entry) => typeof entry?.name === 'string' && entry.name.trim() ? entry.name.trim() : THROTTLER_DEFAULTS.name)
|
|
25
|
+
: [THROTTLER_DEFAULTS.name];
|
|
26
|
+
const headers = new Set();
|
|
27
|
+
for (const name of names) {
|
|
28
|
+
const suffix = name === THROTTLER_DEFAULTS.name ? '' : `-${name}`;
|
|
29
|
+
for (const header of THROTTLER_RESPONSE_HEADERS) {
|
|
30
|
+
headers.add(`${header}${suffix}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return [...headers];
|
|
34
|
+
}
|
|
11
35
|
//# sourceMappingURL=core-throttler.constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-throttler.constants.js","sourceRoot":"","sources":["../../../../src/core/modules/throttler/core-throttler.constants.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,uBAAuB,GAAG,sBAAsB,CAAC;AAG9D,MAAM,CAAC,MAAM,4BAA4B,GAAG,mBAAmB,CAAC;AAMhE,MAAM,CAAC,MAAM,wBAAwB,GAAG,iBAAiB,CAAC;AAG1D,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAEhC,KAAK,EAAE,EAAE;IAET,IAAI,EAAE,SAAS;IAEf,MAAM,EAAE,WAAoB;IAE5B,GAAG,EAAE,MAAM;CACZ,CAAC;AAGF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAC"}
|
|
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AAC,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,KAAqC,EAAE,EAAE,CAChE,OAAO,KAAK,EAAE,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,CACnG;QACH,CAAC,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,IAAI,KAAK,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;QAClE,KAAK,MAAM,MAAM,IAAI,0BAA0B,EAAE,CAAC;YAChD,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -122,7 +122,7 @@ JWT-based authentication for existing projects:
|
|
|
122
122
|
| **Tenant Plugin Safety Net** | Mongoose tenant plugin refuses a tenant-schema access without valid tenant context: 401 for a client operation nobody is signed in to (an expired session included — 12.11.3), 403 for a signed-in caller and for server work. Its post hooks (`find`, `findOne`, `findOneAnd*`) additionally check every RETURNED row (`assertRowsInTenantScope()`): a row of a tenant outside the caller's scope withholds the whole result with 403. The decisions live in `common/persistence/policies/tenant.policy.ts`, which every data store shares |
|
|
123
123
|
| **Data Store** | `DataStore<T>` (`common/persistence/`) is the database-neutral port below the CrudService pipeline; every `ModuleService` has one (`this.dataStore`, derived from `mainDbModel`, or passed as `dataStore`). On MongoDB it runs through Mongoose model methods, so every plugin fires. On PostgreSQL (`SqlDataStore`, phase 1) the same pipeline runs on plain records: before every statement the store applies the policies the plugins call (tenant filter and stamping, safety net, audit, password, role guard, system roles), the statement runs in its own transaction with the request's tenant scope so FORCED row-level security binds it (a query without a scope fails with 42501 → 403), and every returned row passes the tenant row check. References populate with one batched `id $in` read through the target model's store. Mongoose-only APIs (`aggregate`, `getModel`, native collection/connection) refuse on a SQL-stored model, and so does the Mongoose model itself (every data method of a model routed to SQL throws a named error). Since phase 2 the core's own models — users, tenant memberships, API tokens — are registered this way and their services run on the routed store; the port gained `updateOne` / `deleteOne` (atomic first match), `updateMany`, `deleteMany` and `updateById(…, { timestamps: false })`. Since phase 3 Better-Auth follows the user model: with the users on a SQL source (PostgreSQL; MySQL / MariaDB since 12.1.1) it runs its own Kysely adapter on that source's application pool, one `users` row per user, and the framework's reads of Better-Auth's data (session lookup by token in the middleware, token service, JWKS, passkey challenge mappings, e-mail-verified hook, user mapper, system setup, migration status, the MCP OAuth subject's roles) go through `BetterAuthSqlStore` — see `.claude/rules/better-auth.md` §11. Since phase 4 the AI module (eleven models, MCP OAuth clients, codes and refresh tokens) and the S3 / filesystem file metadata (`fileMetadataCollection()`, used by the file service, the TUS hand-off and the Hub) follow their routed store too; the port gained `sum()` and `find(…, { exclude })`, and an expiry sweep removes expired rows of TTL models and expired Better-Auth sessions on SQL, where no TTL index does. `CorePersistenceModule.forFeature()` + `@InjectStore()` register and inject the store; the `database` configuration routes each model to its source. Since phase 5 (12.1.0) MongoDB's libraries are optional peers: the core reaches them through `common/persistence/mongo/` (decorators that record the declaration and apply `@nestjs/mongoose`'s where installed, tokens, ObjectIds, GridFS), `CoreModule` connects MongoDB only when a source uses it, `forFeature()` provides the model tokens itself (a stand-in that refuses data access where no MongoDB is connected), and `database: false` runs without any database; the port gained `find(…, { sample })`, and the SQL update compiler skips a field given as `undefined` as Mongoose does |
|
|
124
124
|
| **API Tokens** | `apiTokens` config (opt-in): USER tokens act as their user without global roles; TENANT tokens (multi-tenancy only) act with the lowest tenant role in their own tenant. `CoreApiTokenMiddleware` authenticates `Authorization: Bearer` / `x-api-key`; every guard denies a token unless the route declares `@ApiTokenScopes()`. Signed short-lived assertions for embedded pages. See `src/core/modules/api-token/README.md` |
|
|
125
|
-
| **Rate limit for project routes** | `throttler` config (opt-in, 12.12.0, DEV-4431) on top of `@nestjs/throttler`: `CoreThrottlerGuard` is registered as the FIRST global guard, so an over-limit client gets 429 + `Retry-After` (`#LTNS_0020`) before authentication runs — also on a route that would answer it 401. It resolves the request like the role guards (`resolveGuardRequest()`: REST, GraphQL over HTTP, agent calls in a request); only a call without any request (a request-less agent call) is not counted. Counted per `request.ip` (follows `trustProxy`, IPv6 by /64); a request without an address — a GraphQL operation over the WebSocket, an HTTP request whose client already closed the connection — per signed-in user, else by the WebSocket's upgrade address, else in one shared bucket, never uncounted. `routes: 'decorated'` (default) limits only routes whose method or controller carries `@Throttle()`; `'all'` every route unless `@SkipThrottle()`. Counters in memory, Redis (default with `redis`) or the project's database through the persistence layer (`storage: 'database'`, MongoDB or SQL, exact across replicas); an outage of the shared store falls back to memory. See `src/core/modules/throttler/README.md` |
|
|
125
|
+
| **Rate limit for project routes** | `throttler` config (opt-in, 12.12.0, DEV-4431) on top of `@nestjs/throttler`: `CoreThrottlerGuard` is registered as the FIRST global guard, so an over-limit client gets 429 + `Retry-After` (`#LTNS_0020`) before authentication runs — also on a route that would answer it 401. It resolves the request like the role guards (`resolveGuardRequest()`: REST, GraphQL over HTTP, agent calls in a request); only a call without any request (a request-less agent call) is not counted. Counted per `request.ip` (follows `trustProxy`, IPv6 by /64); a request without an address — a GraphQL operation over the WebSocket, an HTTP request whose client already closed the connection — per signed-in user, else by the WebSocket's upgrade address, else in one shared bucket, never uncounted. `routes: 'decorated'` (default) limits only routes whose method or controller carries `@Throttle()`; `'all'` every route unless `@SkipThrottle()`. Counters in memory, Redis (default with `redis`) or the project's database through the persistence layer (`storage: 'database'`, MongoDB or SQL, exact across replicas); an outage of the shared store falls back to memory. CORS exposes `Retry-After` and `X-RateLimit-*` (`buildCorsConfig()`, 12.12.1), so an app on another origin can read the wait time. See `src/core/modules/throttler/README.md` |
|
|
126
126
|
|
|
127
127
|
### Data & CRUD
|
|
128
128
|
|
|
@@ -143,6 +143,11 @@ core. In an ES module project (`"type": "module"`, the starter's format since 12
|
|
|
143
143
|
directory (`'../src/core'`), which ESM does not resolve: `migrate up` stopped with `ERR_UNSUPPORTED_DIR_IMPORT`. New
|
|
144
144
|
migrations now import `'../src/core/index.js'`, also with `--sql`. CommonJS projects keep `'../src/core'`.
|
|
145
145
|
|
|
146
|
+
Until 12.12.1 a migration created while a build lay in `dist/` imported the build instead, `'../dist/src/core/index.js'`
|
|
147
|
+
(`'../dist/core/index.js'` with `rootDir: 'src'`): `bin/migrate.js` runs the compiled CLI then, and the path was
|
|
148
|
+
computed from its location. Since 12.12.1 it always names the source core. `grep -rlnE "dist/(src/)?core" migrations/`
|
|
149
|
+
finds such migrations; change their import to `'../src/core/index.js'`.
|
|
150
|
+
|
|
146
151
|
Migrations created before keep their import. Fix one that fails by hand:
|
|
147
152
|
|
|
148
153
|
```typescript
|
|
@@ -167,6 +172,7 @@ import { runSqlMigration } from '../src/core/index.js';
|
|
|
167
172
|
| Symptom | Cause | Fix |
|
|
168
173
|
|---------|-------|-----|
|
|
169
174
|
| Every client gets 429 at once behind a reverse proxy | `trustProxy` unset: every request comes from the proxy | Set `trustProxy` to the number of proxies |
|
|
175
|
+
| An app on another origin sees the 429 but cannot read `Retry-After` | the CORS options do not expose it (12.12.0) | 12.12.1 exposes the rate limit headers through `buildCorsConfig()`; a `main.ts` building its own CORS options lists them in `exposedHeaders` |
|
|
170
176
|
| Boot error `throttler.storage is 'redis', but redis is not configured` | explicit storage without its backend | Configure `redis` or choose another storage |
|
|
171
177
|
| A route with `@Throttle()` is not limited | decorator imported from a second copy of `@nestjs/throttler` | Import it from `@lenne.tech/nest-server` |
|
|
172
178
|
| No audit entries for a model | the model is neither `@Audited()` nor in `auditLog.models`, or the write bypasses `CrudService` | Add it, or call `record()` |
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Migration Guide: 12.12.0 → 12.12.1
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
| Category | Details |
|
|
6
|
+
|---|---|
|
|
7
|
+
| **Breaking Changes** | None |
|
|
8
|
+
| **New Features** | None |
|
|
9
|
+
| **Bugfixes** | `migrate create` writes the source core into a new migration while a build lies in `dist/` (§1); with `throttler` configured, CORS exposes the rate limit headers to an app on another origin (§2) |
|
|
10
|
+
| **Security** | None |
|
|
11
|
+
| **Migration Effort** | Package update. A vendor-mode project changes the import of a migration created under 12.12.0 while a build was present; a project that builds its CORS options itself in `main.ts` lists the rate limit headers there |
|
|
12
|
+
|
|
13
|
+
## Quick Migration
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @lenne.tech/nest-server@12.12.1
|
|
17
|
+
pnpm run update # nest-server-starter based projects
|
|
18
|
+
pnpm run build
|
|
19
|
+
pnpm test
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Vendor mode**: run `/lt-dev:backend:update-nest-server-core` as usual.
|
|
23
|
+
|
|
24
|
+
## 1. Bugfix: `migrate create` imports the source core, also while a build exists
|
|
25
|
+
|
|
26
|
+
**No action needed** in npm mode. A vendor-mode project checks the migrations it created under 12.12.0 (and before)
|
|
27
|
+
while a build lay in `dist/`.
|
|
28
|
+
|
|
29
|
+
In a vendor-mode project, `migrate create` writes the relative path to the vendored core into the new migration
|
|
30
|
+
(`'../src/core/index.js'` in an ES module project, `'../src/core'` in a CommonJS project). `bin/migrate.js` prefers the
|
|
31
|
+
compiled CLI in `dist/` when a build exists, and the path was computed from the CLI's own location. Such a migration
|
|
32
|
+
therefore imported the build output, `'../dist/src/core/index.js'` (`'../dist/core/index.js'` in a project that builds
|
|
33
|
+
with `rootDir: 'src'`): it failed in a fresh checkout without a build, and after the project's build it pointed into
|
|
34
|
+
`dist/dist/`.
|
|
35
|
+
|
|
36
|
+
Since 12.12.1 the path always names the source core (`<project>/src/core`), for a build in `dist/src/core` and in
|
|
37
|
+
`dist/core` alike. Only where no source core with an `index.ts` lies beside the build (a deployed image) does the CLI
|
|
38
|
+
keep the core it runs from. Find and fix the migrations written with the build path:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
grep -rlnE "dist/(src/)?core" migrations/
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
// Before (created while a build existed)
|
|
46
|
+
import { getDb } from '../dist/src/core/index.js';
|
|
47
|
+
|
|
48
|
+
// After
|
|
49
|
+
import { getDb } from '../src/core/index.js';
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 2. Bugfix: an app on another origin can read the rate limit headers
|
|
53
|
+
|
|
54
|
+
**No action needed** for a project whose `main.ts` calls `app.enableCors(buildCorsConfig(envConfig))`, as the
|
|
55
|
+
nest-server-starter does: REST and GraphQL share that configuration.
|
|
56
|
+
|
|
57
|
+
The rate limit of 12.12.0 (`throttler`) answers `429` with `Retry-After` and sets `X-RateLimit-Limit`,
|
|
58
|
+
`X-RateLimit-Remaining` and `X-RateLimit-Reset` on every limited response. A browser hides every response header but a
|
|
59
|
+
short safe list from a script on another origin, so an app on its own host (`app.example.com` calling
|
|
60
|
+
`api.example.com`) saw the `429` but not how long to wait.
|
|
61
|
+
|
|
62
|
+
Since 12.12.1 `buildCorsConfig()` lists these headers in `exposedHeaders` while `throttler` is configured, each with
|
|
63
|
+
`-<name>` for a throttler other than `default` (the names `@nestjs/throttler` sets). Nothing changes with `throttler`
|
|
64
|
+
unset, `{ enabled: false }` or `setHeaders: false`, and the allowed origins and credentials stay exactly as before.
|
|
65
|
+
`throttlerResponseHeaders(config)` returns the list.
|
|
66
|
+
|
|
67
|
+
A project that builds its CORS options itself adds them:
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { throttlerResponseHeaders } from '@lenne.tech/nest-server';
|
|
71
|
+
|
|
72
|
+
app.enableCors({
|
|
73
|
+
credentials: true,
|
|
74
|
+
exposedHeaders: throttlerResponseHeaders(envConfig.throttler),
|
|
75
|
+
origin: ['https://app.example.com'],
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Compatibility Notes
|
|
80
|
+
|
|
81
|
+
| Pattern | Status |
|
|
82
|
+
|---|---|
|
|
83
|
+
| npm mode | Unchanged (`migrate create` keeps `@lenne.tech/nest-server`) |
|
|
84
|
+
| Vendor mode, `migrate create` without a build | Unchanged |
|
|
85
|
+
| Vendor mode, `migrate create` with a build in `dist/` | Writes the source core instead of the build |
|
|
86
|
+
| No `throttler` | CORS unchanged |
|
|
87
|
+
| `throttler` with `buildCorsConfig()` in `main.ts` | `Access-Control-Expose-Headers` lists the rate limit headers |
|
|
88
|
+
| Own CORS options in `main.ts` | Unchanged until the project adds `exposedHeaders` |
|
|
89
|
+
|
|
90
|
+
## Troubleshooting
|
|
91
|
+
|
|
92
|
+
| Symptom | Cause | Fix |
|
|
93
|
+
|---|---|---|
|
|
94
|
+
| `migrate up` fails with `Cannot find module '../dist/src/core/index.js'` (or `'../dist/core/index.js'`) | the migration was created by 12.12.0 or earlier while a build existed | Change the import to `'../src/core/index.js'` (`'../src/core'` in a CommonJS project) |
|
|
95
|
+
| The app shows the `429` but cannot read `Retry-After` | the project builds its own CORS options | Add `exposedHeaders: throttlerResponseHeaders(envConfig.throttler)` |
|
|
96
|
+
|
|
97
|
+
## Module Documentation
|
|
98
|
+
|
|
99
|
+
- `src/core/modules/migrate/README.md`: framework import in vendor-mode migrations
|
|
100
|
+
- `src/core/modules/throttler/README.md`: "Reading the headers from another origin"
|
|
101
|
+
- `src/core/common/helpers/cookies.helper.ts`: `buildCorsConfig()`
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Migration Guide: 12.12.1 → 12.12.2
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
| Category | Details |
|
|
6
|
+
|---|---|
|
|
7
|
+
| **Breaking Changes** | None |
|
|
8
|
+
| **New Features** | None |
|
|
9
|
+
| **Bugfixes** | PostgreSQL: an application role whose name contains `-` (or `$`) no longer stops the boot at the first GRANT (§2) |
|
|
10
|
+
| **Security** | The Node.js runtime of a deployed API must be at least 24.22.3 (22.23.5, 26.13.1): a Brotli decoder flaw in older versions is reachable through every request body (§1) |
|
|
11
|
+
| **Migration Effort** | Raise the Node.js base image of the project's `Dockerfile` (and any other runtime that starts the API), rebuild and deploy |
|
|
12
|
+
|
|
13
|
+
## Quick Migration
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @lenne.tech/nest-server@12.12.2
|
|
17
|
+
pnpm run update # nest-server-starter based projects
|
|
18
|
+
pnpm run build
|
|
19
|
+
pnpm test
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Vendor mode**: run `/lt-dev:backend:update-nest-server-core` as usual.
|
|
23
|
+
|
|
24
|
+
Then raise the Node.js image of the deployment (§1). The package update alone does not change the runtime.
|
|
25
|
+
|
|
26
|
+
## 1. Security: Node.js runtime at least 24.22.3
|
|
27
|
+
|
|
28
|
+
**Action needed** for every deployed API, in npm and in vendor mode.
|
|
29
|
+
|
|
30
|
+
Node.js versions before 22.23.4, 24.22.1 and 26.12.1 contain CVE-2026-111497 (high): malformed Brotli input makes the
|
|
31
|
+
bundled decoder write past the end of an internal buffer, which permits remote code execution. CISA lists it as
|
|
32
|
+
actively exploited. An API built on nest-server reaches the decoder without authentication: Express's body parser
|
|
33
|
+
decompresses a request body sent with `Content-Encoding: br`, before any guard runs, and a reverse proxy passes such a
|
|
34
|
+
body through. The November security releases (22.23.5, 24.22.3, 26.13.1) fix further CVEs in the TLS server, HTTP/2
|
|
35
|
+
and the HTTP client, so take those versions as the minimum.
|
|
36
|
+
|
|
37
|
+
The `Dockerfile` of nest-server-starter pinned `node:24-alpine` at a digest that is Node.js 24.18.0. Replace the base
|
|
38
|
+
image in every stage:
|
|
39
|
+
|
|
40
|
+
```dockerfile
|
|
41
|
+
# Before
|
|
42
|
+
FROM node:24-alpine@sha256:a0b9bf06e4e6193cf7a0f58816cc935ff8c2a908f81e6f1a95432d679c54fbfd AS deps
|
|
43
|
+
# After
|
|
44
|
+
FROM node:24.22.3-alpine@sha256:116b800c3754b440ee0aa3ed2f20f5bf3d99a554bfd9adeea09ea8017f6e85f5 AS deps
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The version tag in front of the digest only documents the version; Docker uses the digest. Check the running image
|
|
48
|
+
after the deploy:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
docker run --rm --entrypoint node <image> -p process.version # v24.22.3 or later on the 24.x line
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
A project on another runtime (a CI image, a PaaS Node.js version, a 22.x or 26.x image) raises it to 22.23.5, 24.22.3
|
|
55
|
+
or 26.13.1 at least. `engines.node` of `@lenne.tech/nest-server` stays `>= 22.15`: the package itself has no fix to
|
|
56
|
+
ship, the runtime does.
|
|
57
|
+
|
|
58
|
+
## 2. Bugfix: PostgreSQL application roles with `-` in the name
|
|
59
|
+
|
|
60
|
+
**No action needed.**
|
|
61
|
+
|
|
62
|
+
Since 12.1.0 the framework quoted the application role in its GRANT statements (tables, change-order sequences, the
|
|
63
|
+
schema) with the rule for table and column names, which accepts only letters, digits and `_`. A role named the way
|
|
64
|
+
platforms name them, such as `acme-prod-api-app`, therefore stopped the boot at the first GRANT with
|
|
65
|
+
`"acme-prod-api-app" is not a valid SQL identifier`. Since 12.12.2 a role name may also contain `-` and `$`; a double
|
|
66
|
+
quote, whitespace or any other character is still refused, and the limit of 63 characters stays. Every role name that
|
|
67
|
+
worked before still works.
|
|
68
|
+
|
|
69
|
+
## Compatibility Notes
|
|
70
|
+
|
|
71
|
+
| Pattern | Status |
|
|
72
|
+
|---|---|
|
|
73
|
+
| Image pinned by digest (`node:<tag>@sha256:…`) | Raise tag and digest together; a digest never moves by itself |
|
|
74
|
+
| Image without digest (`node:24-alpine`) | Rebuild with `docker build --pull --no-cache`: `--no-cache` alone reuses a base image stored locally. An image built before 2026-11-10 runs a version below 24.22.3 |
|
|
75
|
+
| Body parser configured with `bodyParser` | Unaffected by the fix; the runtime update closes the flaw for every configuration |
|
|
76
|
+
|
|
77
|
+
## Troubleshooting
|
|
78
|
+
|
|
79
|
+
| Symptom | Cause | Fix |
|
|
80
|
+
|---|---|---|
|
|
81
|
+
| `process.version` in the running container is below 24.22.3 | the image was built from a cached or still pinned base layer | Raise the digest in every `FROM` line and build with `--pull` |
|
|
82
|
+
|
|
83
|
+
## Module Documentation
|
|
84
|
+
|
|
85
|
+
- [Node.js October 2026 security releases](https://nodejs.org/en/blog/vulnerability/october-2026-security-releases)
|
|
86
|
+
- [Node.js November 2026 security releases](https://nodejs.org/en/blog/vulnerability/november-2026-security-releases)
|
|
87
|
+
- `docs/choosing-a-database.md` — PostgreSQL roles and the owner / application split
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lenne.tech/nest-server",
|
|
3
|
-
"version": "12.12.
|
|
3
|
+
"version": "12.12.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Server framework in TypeScript on top of NestJS: GraphQL and REST APIs on MongoDB, PostgreSQL, MySQL or MariaDB, with authentication, field-level permissions, multi-tenancy, offline sync and an AI assistant.",
|
|
6
6
|
"keywords": [
|
|
@@ -288,8 +288,8 @@
|
|
|
288
288
|
"nodemon": "3.1.14",
|
|
289
289
|
"otpauth": "9.6.0",
|
|
290
290
|
"oxfmt": "0.80.0",
|
|
291
|
-
"oxlint": "1.
|
|
292
|
-
"oxlint-tsgolint": "7.0.
|
|
291
|
+
"oxlint": "1.95.0",
|
|
292
|
+
"oxlint-tsgolint": "7.0.2009",
|
|
293
293
|
"pg": "8.23.1",
|
|
294
294
|
"playwright-core": "1.65.1",
|
|
295
295
|
"rimraf": "6.1.4",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Response } from 'express';
|
|
2
2
|
|
|
3
3
|
import type { ICookiesConfig, ICorsConfig, IServerOptions } from '../interfaces/server-options.interface.js';
|
|
4
|
+
import { throttlerResponseHeaders } from '../../modules/throttler/core-throttler.constants.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Module-scoped cache of `process.env.NODE_ENV === 'production'`.
|
|
@@ -561,6 +562,10 @@ export function resolveServerUrls(input: {
|
|
|
561
562
|
* `appUrl`/`baseUrl` are resolved via {@link resolveServerUrls}, the same function BetterAuth
|
|
562
563
|
* uses, so all three CORS layers (GraphQL, REST, BetterAuth `trustedOrigins`) agree.
|
|
563
564
|
*
|
|
565
|
+
* With `throttler` configured (12.12.0+) the config also carries `exposedHeaders`: `Retry-After` and `X-RateLimit-*`
|
|
566
|
+
* (`throttlerResponseHeaders()`). A browser hides response headers outside a short safe list from a script on another
|
|
567
|
+
* origin, so an app on its own host saw the 429 but not how long to wait.
|
|
568
|
+
*
|
|
564
569
|
* Used by both:
|
|
565
570
|
* - `CoreModule.buildCorsConfig()` for GraphQL (Apollo) CORS
|
|
566
571
|
* - `main.ts` reference implementation for REST (Express) CORS
|
|
@@ -589,9 +594,14 @@ export function buildCorsConfig(options: Partial<IServerOptions>): Record<string
|
|
|
589
594
|
|
|
590
595
|
const corsObj = typeof options?.cors === 'object' ? options.cors : {};
|
|
591
596
|
|
|
597
|
+
// Response headers a script on the app's origin must be able to read (the rate limit's wait time)
|
|
598
|
+
const exposed = throttlerResponseHeaders(options?.throttler);
|
|
599
|
+
const withExposedHeaders = (cors: Record<string, unknown>): Record<string, unknown> =>
|
|
600
|
+
exposed.length ? { ...cors, exposedHeaders: exposed } : cors;
|
|
601
|
+
|
|
592
602
|
// allowAll → mirror request origin (explicit opt-in for dev/test)
|
|
593
603
|
if (corsObj.allowAll) {
|
|
594
|
-
return { credentials: true, origin: true };
|
|
604
|
+
return withExposedHeaders({ credentials: true, origin: true });
|
|
595
605
|
}
|
|
596
606
|
|
|
597
607
|
// Build origin list from the shared URL resolution (appUrl auto-derived from baseUrl,
|
|
@@ -618,7 +628,7 @@ export function buildCorsConfig(options: Partial<IServerOptions>): Record<string
|
|
|
618
628
|
const uniqueOrigins = [...new Set(origins)];
|
|
619
629
|
|
|
620
630
|
if (uniqueOrigins.length > 0) {
|
|
621
|
-
return { credentials: true, origin: uniqueOrigins };
|
|
631
|
+
return withExposedHeaders({ credentials: true, origin: uniqueOrigins });
|
|
622
632
|
}
|
|
623
633
|
|
|
624
634
|
// No origins resolvable → return empty (secure default — no open CORS with credentials)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FieldDescriptor, IndexDescriptor, ModelDescriptor } from '../../model-descriptor.interface.js';
|
|
2
2
|
import { UnsupportedQueryError } from '../sql-errors.js';
|
|
3
|
-
import { columnName, quoteIdentifier, SqlLiterals, sqlLiteral } from '../sql-naming.js';
|
|
3
|
+
import { columnName, quoteIdentifier, quoteRoleName, SqlLiterals, sqlLiteral } from '../sql-naming.js';
|
|
4
4
|
import { schemaHash, shortName, tableName } from '../sql-schema.shared.js';
|
|
5
5
|
import { isLiveFilter, SYNC_SEQUENCE_FIELD } from '../../sync-model.js';
|
|
6
6
|
import { compilePostgresWhere } from './postgres-where.compiler.js';
|
|
@@ -303,7 +303,7 @@ export function addCheckStatement(table: string, check: DesiredCheck): string {
|
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
export function grantStatement(table: string, appRole: string): string {
|
|
306
|
-
return `GRANT SELECT, INSERT, UPDATE, DELETE ON ${quoteIdentifier(table)} TO ${
|
|
306
|
+
return `GRANT SELECT, INSERT, UPDATE, DELETE ON ${quoteIdentifier(table)} TO ${quoteRoleName(appRole)}`;
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
/**
|
|
@@ -346,7 +346,7 @@ export function syncTableStatements(table: string, sync: DesiredSync, appRole: s
|
|
|
346
346
|
const sequence = quoteIdentifier(sync.sequence);
|
|
347
347
|
return [
|
|
348
348
|
`CREATE SEQUENCE IF NOT EXISTS ${sequence}`,
|
|
349
|
-
`GRANT USAGE ON SEQUENCE ${sequence} TO ${
|
|
349
|
+
`GRANT USAGE ON SEQUENCE ${sequence} TO ${quoteRoleName(appRole)}`,
|
|
350
350
|
`CREATE TRIGGER ${quoteIdentifier(SYNC_TRIGGER)} BEFORE INSERT OR UPDATE ON ${quoted} FOR EACH ROW EXECUTE FUNCTION ${quoteIdentifier(SYNC_STAMP_FUNCTION)}(${sqlLiteral(sync.sequence)})`,
|
|
351
351
|
`UPDATE ${quoted} AS t SET "sync_seq" = n.seq FROM (SELECT "id", nextval(${sqlLiteral(sync.sequence)}::regclass) AS seq FROM (SELECT "id" FROM ${quoted} WHERE "sync_seq" IS NULL ORDER BY "id") AS o) AS n WHERE t."id" = n."id"`,
|
|
352
352
|
];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ModelDescriptor } from '../../model-descriptor.interface.js';
|
|
2
2
|
import { isForeignColumn } from '../../persistence-runtime.registry.js';
|
|
3
3
|
import type { SqlExecutor, SqlQueryResult, SqlStatement, SqlTenantScope } from '../sql-executor.interface.js';
|
|
4
|
-
import { quoteIdentifier } from '../sql-naming.js';
|
|
4
|
+
import { quoteIdentifier, quoteRoleName } from '../sql-naming.js';
|
|
5
5
|
import {
|
|
6
6
|
LOCK_MODEL,
|
|
7
7
|
type SchemaChange,
|
|
@@ -157,7 +157,7 @@ export async function planPostgresSchema(
|
|
|
157
157
|
changes.push({
|
|
158
158
|
description: `let ${options.appRole} use schema ${catalog.schema}`,
|
|
159
159
|
kind: 'automatic',
|
|
160
|
-
statements: [`GRANT USAGE ON SCHEMA ${quoteIdentifier(catalog.schema)} TO ${
|
|
160
|
+
statements: [`GRANT USAGE ON SCHEMA ${quoteIdentifier(catalog.schema)} TO ${quoteRoleName(options.appRole)}`],
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
163
|
for (const table of tables) {
|
|
@@ -45,6 +45,26 @@ export function quoteIdentifier(name: string): string {
|
|
|
45
45
|
return `"${name}"`;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* A role name as PostgreSQL deployments actually spell it. Wider than {@link IDENTIFIER} by `-` and `$`, both harmless
|
|
50
|
+
* inside double quotes; a double quote, a backslash, whitespace or any other character still never gets through.
|
|
51
|
+
*/
|
|
52
|
+
const ROLE_NAME = /^[A-Za-z_][\w$-]*$/;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Double-quote a database ROLE name (the application role a GRANT names) after checking it is one.
|
|
56
|
+
*
|
|
57
|
+
* Not {@link quoteIdentifier}: a table or column name comes from a model, a role name from the operator — the user of
|
|
58
|
+
* `NSC__DATABASE__URL`. Platforms name roles with hyphens (`<project>-<stage>-<service>-app`), which is a valid role
|
|
59
|
+
* in PostgreSQL once quoted, and `quoteIdentifier()` refused it: the boot stopped at the first GRANT.
|
|
60
|
+
*/
|
|
61
|
+
export function quoteRoleName(name: string): string {
|
|
62
|
+
if (!ROLE_NAME.test(name) || name.length > MAX_IDENTIFIER_LENGTH) {
|
|
63
|
+
throw new UnsupportedQueryError(`"${name}" is not a valid role name`);
|
|
64
|
+
}
|
|
65
|
+
return `"${name}"`;
|
|
66
|
+
}
|
|
67
|
+
|
|
48
68
|
/**
|
|
49
69
|
* Backtick-quote an identifier for MySQL / MariaDB after checking it is one — with the same limit as PostgreSQL's
|
|
50
70
|
* (MySQL allows 64), so a model's names are valid on every SQL database alike.
|
|
@@ -316,13 +316,11 @@ export class CoreAiConnection extends CorePersistenceModel {
|
|
|
316
316
|
* Compute the non-secret {@link hasApiKey} indicator and strip the encrypted
|
|
317
317
|
* key from every output. Runs via the CheckSecurityInterceptor on responses.
|
|
318
318
|
*/
|
|
319
|
-
override securityCheck(
|
|
319
|
+
override securityCheck(_user?: any, _force?: boolean) {
|
|
320
320
|
this.hasApiKey = !!this.apiKeyEncrypted;
|
|
321
321
|
this.apiKeyEncrypted = undefined;
|
|
322
322
|
// Access to the whole model is already gated by @Restricted(ADMIN); nothing
|
|
323
|
-
// else to filter here.
|
|
324
|
-
void force;
|
|
325
|
-
void user;
|
|
323
|
+
// else to filter here. The parameters are kept for signature symmetry.
|
|
326
324
|
return this;
|
|
327
325
|
}
|
|
328
326
|
}
|
|
@@ -134,10 +134,10 @@ export class CoreAiBudgetService extends CrudService<
|
|
|
134
134
|
/**
|
|
135
135
|
* Block the run with HTTP 429 if the user OR tenant has hit a finite limit.
|
|
136
136
|
*
|
|
137
|
-
* @param
|
|
137
|
+
* @param _language Deprecated and unused — the error-code translation layer now
|
|
138
138
|
* localizes the 429 message. Kept for call-site backward compatibility.
|
|
139
139
|
*/
|
|
140
|
-
async assertWithinBudget(userId?: string, tenantId?: string,
|
|
140
|
+
async assertWithinBudget(userId?: string, tenantId?: string, _language?: string): Promise<void> {
|
|
141
141
|
for (const [scope, refId] of [
|
|
142
142
|
['user', userId],
|
|
143
143
|
['tenant', tenantId],
|
|
@@ -152,7 +152,6 @@ export class CoreAiBudgetService extends CrudService<
|
|
|
152
152
|
const usage = await this.getUsage(scope === 'user' ? { userId: refId } : { tenantId: refId }, limit.period);
|
|
153
153
|
if (this.exceeded(usage, limit)) {
|
|
154
154
|
// Message is translated (de/en) by the error-code translation layer.
|
|
155
|
-
void language;
|
|
156
155
|
throw new HttpException(ErrorCode.AI_BUDGET_EXCEEDED, HttpStatus.TOO_MANY_REQUESTS);
|
|
157
156
|
}
|
|
158
157
|
}
|
|
@@ -532,7 +532,10 @@ directory to the vendored core (e.g. `'../src/core'`). It does so only when the
|
|
|
532
532
|
project and the core it runs from has its own `index`; in npm mode the template is written unchanged. In an ES module
|
|
533
533
|
project (`"type": "module"` in the package scope of the migrations directory) the path names the entry file,
|
|
534
534
|
`'../src/core/index.js'`, because ESM resolves no directory (12.12.0; before, `migrate up` stopped with
|
|
535
|
-
`ERR_UNSUPPORTED_DIR_IMPORT`). The same applies to `migrate create --sql`.
|
|
535
|
+
`ERR_UNSUPPORTED_DIR_IMPORT`). The same applies to `migrate create --sql`. The path always names the source core, also
|
|
536
|
+
while a build lies in `dist/`: `bin/migrate.js` then runs the compiled CLI, and until 12.12.1 the path was computed from
|
|
537
|
+
its location, so such a migration imported `'../dist/src/core/index.js'` (`'../dist/core/index.js'` with
|
|
538
|
+
`rootDir: 'src'`).
|
|
536
539
|
|
|
537
540
|
### TypeScript Loader
|
|
538
541
|
|
|
@@ -68,6 +68,10 @@ const FRAMEWORK_PACKAGE = '@lenne.tech/nest-server';
|
|
|
68
68
|
* `index.ts` of a source run. A CommonJS project keeps the directory, so its migrations stay as they
|
|
69
69
|
* were — a loader that maps no `.js` to `.ts` under `require()` (ts-node) keeps working there.
|
|
70
70
|
*
|
|
71
|
+
* The path always names the SOURCE core (`<project>/src/core`), also when this CLI runs compiled: `bin/migrate.js`
|
|
72
|
+
* prefers a build in `dist/`, and its location (`dist/src/core`) put `'../dist/src/core/index.js'` into every migration
|
|
73
|
+
* created while a build was present (`sourceCoreRoot()`).
|
|
74
|
+
*
|
|
71
75
|
* @param migrationsDir - Directory the migration is written to, absolute or relative to `cwd`
|
|
72
76
|
* @param cwd - Project directory the package is resolved from
|
|
73
77
|
* @param coreRoot - Root of the core this CLI belongs to
|
|
@@ -87,11 +91,37 @@ export function vendoredFrameworkSpecifier(
|
|
|
87
91
|
return undefined;
|
|
88
92
|
}
|
|
89
93
|
const absoluteMigrationsDir = path.resolve(cwd, migrationsDir);
|
|
90
|
-
const relativePath = path.relative(absoluteMigrationsDir, coreRoot).split(path.sep).join('/');
|
|
94
|
+
const relativePath = path.relative(absoluteMigrationsDir, sourceCoreRoot(coreRoot)).split(path.sep).join('/');
|
|
91
95
|
const directory = relativePath.startsWith('.') ? relativePath : `./${relativePath}`;
|
|
92
96
|
return isEsModuleScope(absoluteMigrationsDir) ? `${directory}/index.js` : directory;
|
|
93
97
|
}
|
|
94
98
|
|
|
99
|
+
/**
|
|
100
|
+
* The source core a compiled core was built from: `<project>/dist/src/core` → `<project>/src/core` (the layout
|
|
101
|
+
* `lt fullstack convert-mode` builds), `<project>/dist/core` → `<project>/src/core` (a build with `rootDir: 'src'`).
|
|
102
|
+
* A migration lives next to the sources, imports the source core, and is compiled together with it, so the relative
|
|
103
|
+
* path also holds in the build. Without a source core with an `index.ts` beside the build (a deployed image), the core
|
|
104
|
+
* this CLI runs from is the answer.
|
|
105
|
+
*/
|
|
106
|
+
function sourceCoreRoot(coreRoot: string): string {
|
|
107
|
+
if (fs.existsSync(path.join(coreRoot, 'index.ts'))) {
|
|
108
|
+
return coreRoot;
|
|
109
|
+
}
|
|
110
|
+
const segments = coreRoot.split(path.sep);
|
|
111
|
+
for (let index = segments.length - 1; index >= 0; index--) {
|
|
112
|
+
if (segments[index] !== 'dist') {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
for (const replacement of [[], ['src']]) {
|
|
116
|
+
const candidate = [...segments.slice(0, index), ...replacement, ...segments.slice(index + 1)].join(path.sep);
|
|
117
|
+
if (candidate && fs.existsSync(path.join(candidate, 'index.ts'))) {
|
|
118
|
+
return candidate;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return coreRoot;
|
|
123
|
+
}
|
|
124
|
+
|
|
95
125
|
/**
|
|
96
126
|
* Whether files in `directory` are ES modules: the `type` of the nearest `package.json` above it, as Node decides.
|
|
97
127
|
* No `package.json`, or one that cannot be read, means CommonJS (Node's default).
|
|
@@ -68,6 +68,14 @@ Caddy, nginx or an ingress without `trustProxy`, every request arrives from the
|
|
|
68
68
|
bucket** — the boot warns about exactly that. Trusting more hops than exist lets a client pick a fresh bucket per
|
|
69
69
|
request. IPv6 addresses are counted by their /64 (`ipv6SubnetPrefix`).
|
|
70
70
|
|
|
71
|
+
## Reading the headers from another origin
|
|
72
|
+
|
|
73
|
+
A browser hides every response header but a short safe list from a script on another origin. With `throttler`
|
|
74
|
+
configured, `buildCorsConfig()` lists `Retry-After` and `X-RateLimit-Limit` / `-Remaining` / `-Reset` (with `-<name>`
|
|
75
|
+
for a throttler other than `default`) in `Access-Control-Expose-Headers` (12.12.1), so an app on its own host can show
|
|
76
|
+
how long to wait. REST takes it from the project's `enableCors(buildCorsConfig(…))` in `main.ts`, GraphQL from
|
|
77
|
+
`CoreModule`. A project that builds its CORS options itself adds them there; `setHeaders: false` sends and exposes none.
|
|
78
|
+
|
|
71
79
|
## Order with the role guards
|
|
72
80
|
|
|
73
81
|
The rate limit guard is registered as the **first** global guard, so an over-limit client is refused before
|
|
@@ -31,3 +31,41 @@ export const THROTTLER_DEFAULTS = {
|
|
|
31
31
|
|
|
32
32
|
/** The storages a project can choose (`throttler.storage`) */
|
|
33
33
|
export const THROTTLER_STORAGE_KINDS = ['database', 'memory', 'redis'] as const;
|
|
34
|
+
|
|
35
|
+
/** The headers `@nestjs/throttler` sets per throttler: `Retry-After` on a refusal, `X-RateLimit-*` on every response */
|
|
36
|
+
const THROTTLER_RESPONSE_HEADERS = ['Retry-After', 'X-RateLimit-Limit', 'X-RateLimit-Remaining', 'X-RateLimit-Reset'];
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The response headers the rate limit of a `throttler` configuration sets, as `@nestjs/throttler` names them: each with
|
|
40
|
+
* `-<name>` for a throttler other than `default`. Empty while `throttler` is off or `setHeaders: false`.
|
|
41
|
+
*
|
|
42
|
+
* `buildCorsConfig()` lists them in `Access-Control-Expose-Headers`: a browser hides every response header but a few
|
|
43
|
+
* from a script on another origin, so an app on its own host saw the 429 but not how long to wait. The names follow
|
|
44
|
+
* `resolveThrottlerConfig()` (a trimmed `name`, else `default`) without its warnings, because CORS is built before it.
|
|
45
|
+
*/
|
|
46
|
+
export function throttlerResponseHeaders(config: unknown): string[] {
|
|
47
|
+
if (config === undefined || config === null || config === false) {
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
if (config !== true && (typeof config !== 'object' || (config as { enabled?: unknown }).enabled === false)) {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
const settings = (config === true ? {} : config) as { setHeaders?: unknown; throttlers?: unknown };
|
|
54
|
+
if (settings.setHeaders === false) {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
const names =
|
|
58
|
+
Array.isArray(settings.throttlers) && settings.throttlers.length
|
|
59
|
+
? settings.throttlers.map((entry: { name?: unknown } | undefined) =>
|
|
60
|
+
typeof entry?.name === 'string' && entry.name.trim() ? entry.name.trim() : THROTTLER_DEFAULTS.name,
|
|
61
|
+
)
|
|
62
|
+
: [THROTTLER_DEFAULTS.name];
|
|
63
|
+
const headers = new Set<string>();
|
|
64
|
+
for (const name of names) {
|
|
65
|
+
const suffix = name === THROTTLER_DEFAULTS.name ? '' : `-${name}`;
|
|
66
|
+
for (const header of THROTTLER_RESPONSE_HEADERS) {
|
|
67
|
+
headers.add(`${header}${suffix}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return [...headers];
|
|
71
|
+
}
|