@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 +1 -1
- package/package.json +1 -1
- package/src/cookies/cookies-policy.js +3 -0
- package/src/session-cache.js +2 -0
- package/src/session-cache.test.js +1 -0
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
|
|
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,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
|
|
package/src/session-cache.js
CHANGED
|
@@ -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,
|