@defra/lis-infra-ui-services 0.48.0 → 0.49.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
@@ -161,7 +161,7 @@ await server.register(securityHeaders)
161
161
 
162
162
  `getCacheEngine` picks Redis or in-memory Catbox. `createSessionCachePluginForConfig` registers
163
163
  [yar](https://hapi.dev/module/yar/) from the `session` config (`cache.name`, `cache.ttl`,
164
- `cookie.password`, `cookie.ttl`). Session cookies are always `Secure`. Both engines cap the ttl of
164
+ `cookie.password`, `cookie.ttl`). Session cookies are always `Secure`, and `maxCookieSize` is `0` so session data always lives in the server cache, never the cookie, because the session carries the hub JWT. Both engines cap the ttl of
165
165
  every write at `MAX_CACHE_TTL` (7 days), so no cache policy can keep session data longer than
166
166
  CDP allows.
167
167
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/lis-infra-ui-services",
3
- "version": "0.48.0",
3
+ "version": "0.49.0",
4
4
  "description": "UI-Services shared definitions for the livestock taxonomy topology.",
5
5
  "main": "src/index.js",
6
6
  "repository": {
@@ -1,6 +1,9 @@
1
1
  /** @import { Request } from '@hapi/hapi' */
2
2
  import { milliseconds } from '../duration.js'
3
3
 
4
+ // Kept as a literal because the browser bundle imports this file and must not
5
+ // pull in the server-only infra-core package. Must match the cookie the hub proxy
6
+ // forwards to spokes, COOKIES_POLICY_COOKIE_NAME in @defra/lis-hubs-infra-core.
4
7
  export const COOKIES_POLICY_COOKIE_NAME = 'cookies_policy'
5
8
  export const COOKIES_PATH = '/cookies'
6
9
 
@@ -14,6 +14,8 @@ export function createSessionCachePlugin({ sessionConfig }) {
14
14
  expiresIn: sessionConfig.cache.ttl
15
15
  },
16
16
  storeBlank: false,
17
+ // The session carries the user's hub JWT, so it must always live in the server cache, never the cookie.
18
+ maxCookieSize: 0,
17
19
  errorOnCacheNotReady: true,
18
20
  cookieOptions: {
19
21
  password: sessionConfig.cookie.password,
@@ -29,6 +29,7 @@ test('createSessionCachePlugin builds the expected yar plugin options', () => {
29
29
  expiresIn: 1234
30
30
  },
31
31
  storeBlank: false,
32
+ maxCookieSize: 0,
32
33
  errorOnCacheNotReady: true,
33
34
  cookieOptions: {
34
35
  password: 'password',