fix(api): patch oauth2 (#58581)

This commit is contained in:
Shaun Hamilton
2025-02-10 10:51:54 +02:00
committed by GitHub
parent 915526ec27
commit 75d2199f00
5 changed files with 389 additions and 321 deletions
+6 -1
View File
@@ -15,6 +15,8 @@ COPY --chown=node:node curriculum/ curriculum/
# TODO: AFAIK it's just the intro translations. Those should be folded into the
# curriculum and then we can remove this.
COPY --chown=node:node client/ client/
# TODO: Remove once `@fastify/oauth2` is fixed
COPY --chown=node:node patches/ patches/
RUN pnpm config set dedupe-peer-dependents false
# While we want to ignore scripts generally, we do need to generate the prisma
@@ -22,7 +24,7 @@ RUN pnpm config set dedupe-peer-dependents false
# to have prisma as a prod dependency. The jq tricks are to ensure we're using
# the right version of prisma.
RUN pnpm install -F=api -F=curriculum -F tools/scripts/build -F challenge-parser \
--frozen-lockfile --ignore-scripts
--frozen-lockfile --ignore-scripts
RUN cd api && npx prisma@$(jq -r '.devDependencies.prisma' < package.json) generate
# The api needs to source curriculum.json and build:curriculum relies on the
@@ -38,8 +40,11 @@ RUN apt-get update && apt-get install -y jq
WORKDIR /home/node/build
COPY --chown=node:node pnpm*.yaml .
COPY --chown=node:node package.json .
COPY --chown=node:node api/ api/
COPY --chown=node:node shared/ shared/
# TODO: Remove once `@fastify/oauth2` is fixed
COPY --chown=node:node patches/ patches/
RUN npm i -g pnpm@9
# Weirdly this config does not seem necessary for the new api (the same number
+2
View File
@@ -11,6 +11,8 @@ COPY --chown=node:node client/ client/
COPY --chown=node:node shared/ shared/
COPY --chown=node:node tools/ tools/
COPY --chown=node:node curriculum/ curriculum/
# TODO: Remove once `@fastify/oauth2` is fixed
COPY --chown=node:node patches/ patches/
ARG HOME_LOCATION
ARG API_LOCATION
+6 -1
View File
@@ -137,5 +137,10 @@
"webpack-bundle-analyzer": "4.10.1",
"yargs": "17.7.2"
},
"packageManager": "pnpm@9.10.0+sha512.73a29afa36a0d092ece5271de5177ecbf8318d454ecd701343131b8ebc0c1a91c487da46ab77c8e596d6acf1461e3594ced4becedf8921b074fbd8653ed7051c"
"packageManager": "pnpm@9.10.0+sha512.73a29afa36a0d092ece5271de5177ecbf8318d454ecd701343131b8ebc0c1a91c487da46ab77c8e596d6acf1461e3594ced4becedf8921b074fbd8653ed7051c",
"pnpm": {
"patchedDependencies": {
"@fastify/oauth2@7.8.1": "patches/@fastify__oauth2@7.8.1.patch"
}
}
}
+13
View File
@@ -0,0 +1,13 @@
diff --git a/index.js b/index.js
index ca254d0c9761c8c02070eaf51675627a6d80ff46..efb522616b586f3c8692d5bafd4f2da7aa9b0e20 100644
--- a/index.js
+++ b/index.js
@@ -483,7 +483,7 @@ function fastifyOauth2 (fastify, options, next) {
function onUserinfoResponse (res) {
let rawData = ''
- res.on('data', (chunk) => { rawData = chunk })
+ res.on('data', (chunk) => { rawData += chunk })
res.on('end', () => {
try {
cb(null, JSON.parse(rawData)) // should always be JSON since we don't do jwt auth response
+362 -319
View File
File diff suppressed because it is too large Load Diff