From 99830f0872480f702c2ee4ce2aff1b57a85f3889 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 23 Oct 2026 12:40:31 +0000 Subject: [PATCH] fix(security): encode route params in URLs and exclude tests from CodeQL Encode user-supplied path segments before interpolating them into API URLs (movie/tv/collection SSR fetches and the reset-password POST), so a crafted id cannot traverse to a different API path. Clears 4 js/request-forgery alerts. Exclude *.test.ts(x) and cypress/ from CodeQL analysis. Test fixtures are not shipped and produced 9 false-positive alerts (js/clear-text-cookie, js/request-forgery). Config is inline because the init step runs in parallel with checkout. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WNZbbpoHjgV821zgcUrE4L --- .github/workflows/codeql.yml | 7 +++++++ src/components/ResetPassword/index.tsx | 2 +- src/pages/collection/[collectionId]/index.tsx | 2 +- src/pages/movie/[movieId]/index.tsx | 2 +- src/pages/tv/[tvId]/index.tsx | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 000604a6a3..35e671ec01 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -47,6 +47,13 @@ jobs: with: languages: ${{ matrix.language }} queries: +security-and-quality + # Inline (not config-file) because init runs in parallel with + # checkout. Test files are not shipped and only add noise. + config: | + paths-ignore: + - '**/*.test.ts' + - '**/*.test.tsx' + - 'cypress/**' - name: Autobuild uses: github/codeql-action/autobuild@v4.37.9 diff --git a/src/components/ResetPassword/index.tsx b/src/components/ResetPassword/index.tsx index 57053e936c..1268282276 100644 --- a/src/components/ResetPassword/index.tsx +++ b/src/components/ResetPassword/index.tsx @@ -101,7 +101,7 @@ const ResetPassword = () => { validationSchema={ResetSchema} onSubmit={async (values) => { const response = await axios.post( - `/api/v1/auth/reset-password/${guid}`, + `/api/v1/auth/reset-password/${encodeURIComponent(String(guid))}`, { password: values.password, } diff --git a/src/pages/collection/[collectionId]/index.tsx b/src/pages/collection/[collectionId]/index.tsx index ff8bbbd898..1ac9be5cb5 100644 --- a/src/pages/collection/[collectionId]/index.tsx +++ b/src/pages/collection/[collectionId]/index.tsx @@ -16,7 +16,7 @@ export const getServerSideProps: GetServerSideProps< CollectionPageProps > = async (ctx) => { const response = await axios.get( - `http://${getHostAndPort()}/api/v1/collection/${ctx.query.collectionId}`, + `http://${getHostAndPort()}/api/v1/collection/${encodeURIComponent(String(ctx.query.collectionId))}`, { headers: ctx.req?.headers?.cookie ? { cookie: ctx.req.headers.cookie } diff --git a/src/pages/movie/[movieId]/index.tsx b/src/pages/movie/[movieId]/index.tsx index 24fd3a826f..83b2ecebb5 100644 --- a/src/pages/movie/[movieId]/index.tsx +++ b/src/pages/movie/[movieId]/index.tsx @@ -16,7 +16,7 @@ export const getServerSideProps: GetServerSideProps = async ( ctx ) => { const response = await axios.get( - `http://${getHostAndPort()}/api/v1/movie/${ctx.query.movieId}`, + `http://${getHostAndPort()}/api/v1/movie/${encodeURIComponent(String(ctx.query.movieId))}`, { headers: ctx.req?.headers?.cookie ? { cookie: ctx.req.headers.cookie } diff --git a/src/pages/tv/[tvId]/index.tsx b/src/pages/tv/[tvId]/index.tsx index 599a7985e0..68a6aa55e1 100644 --- a/src/pages/tv/[tvId]/index.tsx +++ b/src/pages/tv/[tvId]/index.tsx @@ -16,7 +16,7 @@ export const getServerSideProps: GetServerSideProps = async ( ctx ) => { const response = await axios.get( - `http://${getHostAndPort()}/api/v1/tv/${ctx.query.tvId}`, + `http://${getHostAndPort()}/api/v1/tv/${encodeURIComponent(String(ctx.query.tvId))}`, { headers: ctx.req?.headers?.cookie ? { cookie: ctx.req.headers.cookie }