mehrabmp / kara-shop

KARA - Ecommerce built with T3 Stack : NextJS, TypeScript, tRPC, Prisma, NextAuth and styled with Tailwind CSS
https://karashop.vercel.app
MIT License
301 stars 51 forks source link

fix(deps): update dependency next-auth to v4.24.5 [security] #373

Open renovate[bot] opened 8 months ago

renovate[bot] commented 8 months ago

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
next-auth (source) 4.22.1 -> 4.24.5 age adoption passing confidence

GitHub Vulnerability Alerts

CVE-2023-48309

Impact

next-auth applications prior to version 4.24.5 that rely on the default Middleware authorization are affected.

A bad actor could create an empty/mock user, by getting hold of a NextAuth.js-issued JWT from an interrupted OAuth sign-in flow (state, PKCE or nonce).

Manually overriding the next-auth.session-token cookie value with this non-related JWT would let the user simulate a logged in user, albeit having no user information associated with it. (The only property on this user is an opaque randomly generated string).

This vulnerability does not give access to other users' data, neither to resources that require proper authorization via scopes or other means. The created mock user has no information associated with it (ie. no name, email, access_token, etc.)

This vulnerability can be exploited by bad actors to peek at logged in user states (e.g. dashboard layout).

Note: Regardless of the vulnerability, the existence of a NextAuth.js session state can provide simple authentication, but not authorization in your applications. For role-based access control, you can check out our guide.

Patches

We patched the vulnerability in next-auth v4.24.5. To upgrade, run one of the following:

npm i next-auth@latest
yarn add next-auth@latest
pnpm add next-auth@latest

Workarounds

Upgrading to latest is the recommended way to fix this issue. However, using a custom authorization callback for Middleware, developers can manually do a basic authentication:

// middleware.ts
import { withAuth } from "next-auth/middleware"

export default withAuth(/*your middleware function*/, {
  // checking the existence of any property - besides `value` which might be a random string - on the `token` object is sufficient to prevent this vulnerability
  callbacks: { authorized: ({ token }) => !!token?.email }
})

References


Release Notes

nextauthjs/next-auth (next-auth) ### [`v4.24.5`](https://redirect.github.com/nextauthjs/next-auth/releases/tag/next-auth%404.24.5) [Compare Source](https://redirect.github.com/nextauthjs/next-auth/compare/next-auth@4.24.4...next-auth@4.24.5) #### Bugfixes - differentiate between issued JWTs ### [`v4.24.4`](https://redirect.github.com/nextauthjs/next-auth/releases/tag/next-auth%404.24.4) [Compare Source](https://redirect.github.com/nextauthjs/next-auth/compare/next-auth@4.24.3...next-auth@4.24.4) #### Bugfixes - allow Next.js 14 as peer dependency ### [`v4.24.3`](https://redirect.github.com/nextauthjs/next-auth/releases/tag/next-auth%404.24.3) [Compare Source](https://redirect.github.com/nextauthjs/next-auth/compare/next-auth@4.24.2...next-auth@4.24.3) ##### Bugfixes - css build error ### [`v4.24.2`](https://redirect.github.com/nextauthjs/next-auth/releases/tag/next-auth%404.24.2) [Compare Source](https://redirect.github.com/nextauthjs/next-auth/compare/next-auth@4.24.1...next-auth@4.24.2) ##### Bugfixes - css build error ### [`v4.24.1`](https://redirect.github.com/nextauthjs/next-auth/releases/tag/next-auth%404.24.1) [Compare Source](https://redirect.github.com/nextauthjs/next-auth/compare/next-auth@4.24.0...next-auth@4.24.1) ##### Bugfixes - css build error ### [`v4.24.0`](https://redirect.github.com/nextauthjs/next-auth/releases/tag/next-auth%404.24.0) [Compare Source](https://redirect.github.com/nextauthjs/next-auth/compare/next-auth@4.23.2...next-auth@4.24.0) ##### Features - tweak default sign-in page ([#​8888](https://redirect.github.com/nextauthjs/next-auth/issues/8888)) ### [`v4.23.2`](https://redirect.github.com/nextauthjs/next-auth/releases/tag/next-auth%404.23.2) [Compare Source](https://redirect.github.com/nextauthjs/next-auth/compare/next-auth@4.23.1...next-auth@4.23.2) #### Bugfixes - **next**: returns correct status for signing in with `redirect: false` for route handler ([#​8775](https://redirect.github.com/nextauthjs/next-auth/issues/8775)) ([`27b2519`](https://redirect.github.com/nextauthjs/next-auth/commit/27b2519b)) - **ts**: fix typo ([`d813c00`](https://redirect.github.com/nextauthjs/next-auth/commit/d813c00b)) - remove trailing `?` from signIn URL ([#​8466](https://redirect.github.com/nextauthjs/next-auth/issues/8466)) #### Other - update security policy link ### [`v4.23.1`](https://redirect.github.com/nextauthjs/next-auth/releases/tag/next-auth%404.23.1) [Compare Source](https://redirect.github.com/nextauthjs/next-auth/compare/next-auth@4.23.0...next-auth@4.23.1) #### Bugfixes - **ts**: correctly expose `next-auth/adapters` ([`20c3fe3`](https://redirect.github.com/nextauthjs/next-auth/commit/20c3fe33)) - use `default` submodules export in `package.json` ([#​8330](https://redirect.github.com/nextauthjs/next-auth/issues/8330)) ### [`v4.23.0`](https://redirect.github.com/nextauthjs/next-auth/releases/tag/next-auth%404.23.0) [Compare Source](https://redirect.github.com/nextauthjs/next-auth/compare/next-auth@4.22.5...next-auth@4.23.0) #### Features - **providers**: add Passage by 1Password ([`5a8aa2e`](https://redirect.github.com/nextauthjs/next-auth/commit/5a8aa2e5)) #### Bugfixes - **ts**: correctly export submodule types ([`05ff6ae`](https://redirect.github.com/nextauthjs/next-auth/commit/05ff6ae2)) - sort cookie chunks correctly ([#​8284](https://redirect.github.com/nextauthjs/next-auth/issues/8284)) ### [`v4.22.5`](https://redirect.github.com/nextauthjs/next-auth/releases/tag/next-auth%404.22.5) [Compare Source](https://redirect.github.com/nextauthjs/next-auth/compare/next-auth@4.22.4...next-auth@4.22.5) #### Bugfixes - **ts**: match `next-auth/adapter` & `@auth/core/adapters` (https://github.com/nextauthjs/next-auth/commit/3b0128c3cabfaa014531e38e06919ea435df35fd) #### Other - docs: amplify note ### [`v4.22.4`](https://redirect.github.com/nextauthjs/next-auth/releases/tag/next-auth%404.22.4) [Compare Source](https://redirect.github.com/nextauthjs/next-auth/compare/next-auth@4.22.3...next-auth@4.22.4) #### Bugfixes - **ts**: SignInResponse.error type ([#​8109](https://redirect.github.com/nextauthjs/next-auth/issues/8109)) ([`465644f`](https://redirect.github.com/nextauthjs/next-auth/commit/465644f9)) - Remove RSC warning in `getServerSession` ([#​8108](https://redirect.github.com/nextauthjs/next-auth/issues/8108)) - Don't return `res.end()` in api handler ([#​8244](https://redirect.github.com/nextauthjs/next-auth/issues/8244)) #### Other - docs: fixing broken link in documentation ([#​8208](https://redirect.github.com/nextauthjs/next-auth/issues/8208)) - docs: clarify `getServerSession` - docs: move `unstable_getServerSession` - docs: Typo fixed ([#​8206](https://redirect.github.com/nextauthjs/next-auth/issues/8206)) - docs(providers): mention HTTP-based Email guide ([#​8214](https://redirect.github.com/nextauthjs/next-auth/issues/8214)) - docs: Update object key "email" to "username" ([#​8113](https://redirect.github.com/nextauthjs/next-auth/issues/8113)) - doc: Add a guide on sending magic links to existing users only ([#​7663](https://redirect.github.com/nextauthjs/next-auth/issues/7663)) - docs: Update refresh-token-rotation.md - fix example client code filename ([#​8088](https://redirect.github.com/nextauthjs/next-auth/issues/8088)) - docs(providers): updated docs with missing account attribute ([#​8084](https://redirect.github.com/nextauthjs/next-auth/issues/8084)) ### [`v4.22.3`](https://redirect.github.com/nextauthjs/next-auth/releases/tag/next-auth%404.22.3) [Compare Source](https://redirect.github.com/nextauthjs/next-auth/compare/next-auth@4.22.2...next-auth@4.22.3) **Full Changelog**: https://github.com/nextauthjs/next-auth/compare/next-auth@4.22.2...next-auth@4.22.3 ### [`v4.22.2`](https://redirect.github.com/nextauthjs/next-auth/releases/tag/next-auth%404.22.2) [Compare Source](https://redirect.github.com/nextauthjs/next-auth/compare/next-auth@4.22.1...next-auth@4.22.2) #### Bugfixes - **providers**: fix `nodemailer`/required types ([#​7950](https://redirect.github.com/nextauthjs/next-auth/issues/7950)) ([`f48eb04`](https://redirect.github.com/nextauthjs/next-auth/commit/f48eb047)) - **ts**: adapter interface ([#​8054](https://redirect.github.com/nextauthjs/next-auth/issues/8054)) ([`bd37c55`](https://redirect.github.com/nextauthjs/next-auth/commit/bd37c552)) - **ts**: add overloads to withAuth middleware ([#​7999](https://redirect.github.com/nextauthjs/next-auth/issues/7999)) ([`169a523`](https://redirect.github.com/nextauthjs/next-auth/commit/169a5230)) - respect protocol too, when host is trusted ([#​7214](https://redirect.github.com/nextauthjs/next-auth/issues/7214)) #### Other - remove unused TS types - merge changes back to v4 ([#​7430](https://redirect.github.com/nextauthjs/next-auth/issues/7430)) - rephrase

Configuration

📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.



This PR was generated by Mend Renovate. View the repository job log.

vercel[bot] commented 8 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
karashop ❌ Failed (Inspect) Feb 25, 2024 11:44am