Information Exposure Affecting next-auth package, versions <3.29.9 >=4.0.0 <4.10.2


0.0
low

Snyk CVSS

    Attack Complexity Low

    Threat Intelligence

    EPSS 0.05% (15th percentile)
Expand this section
NVD
3.3 low

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-JS-NEXTAUTH-2965597
  • published 2 Aug 2022
  • disclosed 2 Aug 2022
  • credit ShuPink

How to fix?

Upgrade next-auth to version 3.29.9, 4.10.2 or higher.

Overview

next-auth is an Authentication for Next.js

Affected versions of this package are vulnerable to Information Exposure where it is possible to reveal sensitive information such as an identity provider's secret in logs.

Note: This vulnerability can be worked around by configuring the logger manually to remove the provider secret.

import log from "your-logging-service"
export const authOptions: NextAuthOptions = {
  debug: process.env.NODE_ENV !== "production",
  logger: {
    error: (code, metadata) => {
      if (!(metadata instanceof Error) &&  metadata.provider) {
        // redact the provider secret here
        delete metadata.provider
        log.error(code, metadata)
      } else {
        log.error(code, metadata)
      }
    }
  },
}