diff --git a/api/package.json b/api/package.json index 6a43d32a49f..5851c428337 100644 --- a/api/package.json +++ b/api/package.json @@ -6,7 +6,7 @@ "dependencies": { "@aws-sdk/client-ses": "3.521.0", "@fastify/accepts": "4.3.0", - "@fastify/cookie": "9.3.1", + "@fastify/cookie": "9.4.0", "@fastify/csrf-protection": "6.4.1", "@fastify/express": "^2.3.0", "@fastify/swagger": "8.14.0", diff --git a/api/src/plugins/code-flow-auth.ts b/api/src/plugins/code-flow-auth.ts index b76594ab261..7b9e8cca6eb 100644 --- a/api/src/plugins/code-flow-auth.ts +++ b/api/src/plugins/code-flow-auth.ts @@ -78,12 +78,12 @@ const codeFlowAuth: FastifyPluginCallback = (fastify, _options, done) => { const jwtAccessToken = unsignedToken.value; try { - jwt.verify(jwtAccessToken!, JWT_SECRET); + jwt.verify(jwtAccessToken, JWT_SECRET); } catch { return rejectStrategy(req, reply, TOKEN_INVALID); } - const { accessToken } = jwt.decode(jwtAccessToken!) as { + const { accessToken } = jwt.decode(jwtAccessToken) as { accessToken: Token; }; diff --git a/api/src/plugins/cookies.ts b/api/src/plugins/cookies.ts index 795b2b683f1..2161aec8515 100644 --- a/api/src/plugins/cookies.ts +++ b/api/src/plugins/cookies.ts @@ -1,4 +1,4 @@ -import fastifyCookie from '@fastify/cookie'; +import fastifyCookie, { type UnsignResult } from '@fastify/cookie'; import { FastifyPluginCallback } from 'fastify'; import fp from 'fastify-plugin'; @@ -23,7 +23,7 @@ export const sign = (value: string) => * @param rawValue The signed cookie value. * @returns The unsigned cookie value. */ -export const unsign = (rawValue: string) => { +export const unsign = (rawValue: string): UnsignResult => { const prefix = rawValue.slice(0, 2); if (prefix !== 's:') return { valid: false, renew: false, value: null }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 05564135d52..23ac84489a4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -157,8 +157,8 @@ importers: specifier: 4.3.0 version: 4.3.0 '@fastify/cookie': - specifier: 9.3.1 - version: 9.3.1 + specifier: 9.4.0 + version: 9.4.0 '@fastify/csrf-protection': specifier: 6.4.1 version: 6.4.1 @@ -2971,8 +2971,8 @@ packages: '@fastify/ajv-compiler@3.5.0': resolution: {integrity: sha512-ebbEtlI7dxXF5ziNdr05mOY8NnDiPB1XvAlLHctRt/Rc+C3LCOVW5imUVX+mhvUhnNzmPBHewUkOFgGlCxgdAA==} - '@fastify/cookie@9.3.1': - resolution: {integrity: sha512-h1NAEhB266+ZbZ0e9qUE6NnNR07i7DnNXWG9VbbZ8uC6O/hxHpl+Zoe5sw1yfdZ2U6XhToUGDnzQtWJdCaPwfg==} + '@fastify/cookie@9.4.0': + resolution: {integrity: sha512-Th+pt3kEkh4MQD/Q2q1bMuJIB5NX/D5SwSpOKu3G/tjoGbwfpurIMJsWSPS0SJJ4eyjtmQ8OipDQspf8RbUOlg==} '@fastify/csrf-protection@6.4.1': resolution: {integrity: sha512-nP1xjruddvWMvqjxTVzpLqWVLAX7P/XWkeTaARg3bXVrVmpDWjDMN7KfV3swIT/XexjDooMo+QG/n0n6ynZaiw==} @@ -17095,7 +17095,7 @@ snapshots: ajv-formats: 2.1.1(ajv@8.12.0) fast-uri: 2.3.0 - '@fastify/cookie@9.3.1': + '@fastify/cookie@9.4.0': dependencies: cookie-signature: 1.2.1 fastify-plugin: 4.5.1