logixia 1.12.6 → 1.13.0

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/README.md CHANGED
@@ -1316,22 +1316,28 @@ logixia ships this as a dedicated `logixia/correlation` sub-package. It uses the
1316
1316
  ```typescript
1317
1317
  import { correlationMiddleware } from 'logixia/correlation';
1318
1318
 
1319
- // Zero-config — reads X-Correlation-ID / X-Request-ID from the incoming request.
1320
- // Generates a UUID v4 if no header is present.
1319
+ // Zero-config — reads X-Correlation-ID from the incoming request.
1320
+ // Generates a UUID v4 if the header is missing or invalid.
1321
1321
  // Sets X-Correlation-ID on the response.
1322
1322
  app.use(correlationMiddleware());
1323
1323
 
1324
1324
  // Custom config:
1325
1325
  app.use(
1326
1326
  correlationMiddleware({
1327
- header: 'X-Correlation-ID', // header to read / write. Default: 'X-Correlation-ID'
1328
- generateId: () => crypto.randomUUID(),
1327
+ header: 'X-Correlation-ID', // header to read / write (matched case-insensitively). Default: 'x-correlation-id'
1328
+ generate: () => crypto.randomUUID(), // used when no usable incoming ID. Default: crypto.randomUUID()
1329
1329
  trustIncoming: true, // honour the header from the client. Default: true
1330
1330
  setResponseHeader: true, // echo the ID back in the response. Default: true
1331
1331
  })
1332
1332
  );
1333
1333
  ```
1334
1334
 
1335
+ An incoming ID is only used if it is at most 128 characters long and contains only
1336
+ `A-Z`, `a-z`, `0-9`, `.`, `_`, `:` and `-`. Anything else (newlines, spaces, or base64-style
1337
+ `+`, `/`, `=`) is replaced with a freshly generated ID, so client-supplied text can't end up in
1338
+ every log line. Set `trustIncoming: false` to ignore the incoming header entirely and always
1339
+ generate a new ID. `correlationFastifyHook()` takes the same options.
1340
+
1335
1341
  ### Correlation Fastify hook
1336
1342
 
1337
1343
  ```typescript