From eb1fb2b97a25f777e9d79fee460bf42e7aebb903 Mon Sep 17 00:00:00 2001 From: Tobbe Lundberg Date: Sun, 17 Nov 2024 11:20:30 +0100 Subject: [PATCH 1/2] chore(test-project): Update TailwindCSS to 3.4.15 and PostCSS to 8.4.49 (#11721) --- __fixtures__/test-project/web/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/__fixtures__/test-project/web/package.json b/__fixtures__/test-project/web/package.json index 2612c328037a..de51ef664227 100644 --- a/__fixtures__/test-project/web/package.json +++ b/__fixtures__/test-project/web/package.json @@ -24,9 +24,9 @@ "@types/react": "^18.2.55", "@types/react-dom": "^18.2.19", "autoprefixer": "^10.4.20", - "postcss": "^8.4.47", + "postcss": "^8.4.49", "postcss-loader": "^8.1.1", "prettier-plugin-tailwindcss": "^0.5.12", - "tailwindcss": "^3.4.14" + "tailwindcss": "^3.4.15" } } From 3ed44ec5ba71e49f05c00ed33d9b5d36bb85b3c6 Mon Sep 17 00:00:00 2001 From: Tobbe Lundberg Date: Sun, 17 Nov 2024 11:32:16 +0100 Subject: [PATCH 2/2] chore(dbAuth): Early return to make code easier to read (#11722) --- .../auth-providers/dbAuth/api/src/shared.ts | 51 ++++++++++--------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/packages/auth-providers/dbAuth/api/src/shared.ts b/packages/auth-providers/dbAuth/api/src/shared.ts index ba7417150767..e4cf1d9767c1 100644 --- a/packages/auth-providers/dbAuth/api/src/shared.ts +++ b/packages/auth-providers/dbAuth/api/src/shared.ts @@ -40,34 +40,34 @@ const getPort = () => { // When in development environment, check for auth impersonation cookie // if user has generated graphiql headers const eventGraphiQLHeadersCookie = (event: APIGatewayProxyEvent | Request) => { - if (process.env.NODE_ENV === 'development') { - const impersationationHeader = getEventHeader( - event, - 'rw-studio-impersonation-cookie', - ) - - if (impersationationHeader) { - return impersationationHeader - } + if (process.env.NODE_ENV !== 'development') { + return + } - // TODO: Remove code below when we remove the old way of passing the cookie - // from Studio, and decide it's OK to break compatibility with older Studio - // versions - try { - if (!isFetchApiRequest(event)) { - const jsonBody = JSON.parse(event.body ?? '{}') - return ( - jsonBody?.extensions?.headers?.cookie || - jsonBody?.extensions?.headers?.Cookie - ) - } - } catch { - // sometimes the event body isn't json - return - } + const impersationationHeader = getEventHeader( + event, + 'rw-studio-impersonation-cookie', + ) + + if (impersationationHeader) { + return impersationationHeader } - return + // TODO: Remove code below when we remove the old way of passing the cookie + // from Studio, and decide it's OK to break compatibility with older Studio + // versions + try { + if (!isFetchApiRequest(event)) { + const jsonBody = JSON.parse(event.body ?? '{}') + return ( + jsonBody?.extensions?.headers?.cookie || + jsonBody?.extensions?.headers?.Cookie + ) + } + } catch { + // sometimes the event body isn't json + return + } } // decrypts session text using old CryptoJS algorithm (using node:crypto library) @@ -97,6 +97,7 @@ const legacyDecryptSession = (encryptedText: string) => { export const extractCookie = (event: APIGatewayProxyEvent | Request) => { return eventGraphiQLHeadersCookie(event) || getEventHeader(event, 'Cookie') } + // whether this encrypted session was made with the old CryptoJS algorithm export const isLegacySession = (text: string | undefined) => { if (!text) {