LowGHSA-r5w7-f542-q2j4

Potential DoS when using ContextLines integration

Published 28 Jan 2025 · Updated 28 Jan 2025

Affected packages

Affected
>=8.10.0 <8.49.0
Fixed in
8.49.0
Update to the fixed version for your release line, for example:npm install @sentry/node@8.49.0
Affected
>=8.10.0 <8.49.0
Fixed in
8.49.0
Update to the fixed version for your release line, for example:npm install @sentry/astro@8.49.0
Affected
>=8.10.0 <8.49.0
Fixed in
8.49.0
Update to the fixed version for your release line, for example:npm install @sentry/aws-serverless@8.49.0
Affected
>=8.10.0 <8.49.0
Fixed in
8.49.0
Update to the fixed version for your release line, for example:npm install @sentry/bun@8.49.0
Affected
>=8.10.0 <8.49.0
Fixed in
8.49.0
Update to the fixed version for your release line, for example:npm install @sentry/google-cloud-serverless@8.49.0
Affected
>=8.10.0 <8.49.0
Fixed in
8.49.0
Update to the fixed version for your release line, for example:npm install @sentry/nestjs@8.49.0
Affected
>=8.10.0 <8.49.0
Fixed in
8.49.0
Update to the fixed version for your release line, for example:npm install @sentry/nextjs@8.49.0
Affected
>=8.10.0 <8.49.0
Fixed in
8.49.0
Update to the fixed version for your release line, for example:npm install @sentry/nuxt@8.49.0
Affected
>=8.10.0 <8.49.0
Fixed in
8.49.0
Update to the fixed version for your release line, for example:npm install @sentry/remix@8.49.0
Affected
>=8.10.0 <8.49.0
Fixed in
8.49.0
Update to the fixed version for your release line, for example:npm install @sentry/solidstart@8.49.0
Affected
>=8.10.0 <8.49.0
Fixed in
8.49.0
Update to the fixed version for your release line, for example:npm install @sentry/sveltekit@8.49.0

Details

Impact

The ContextLines integration uses readable streams to more efficiently use memory when reading files. The ContextLines integration is used to attach source context to outgoing events.

The stream was not explicitly closed after use. This could lead to excessive amounts of file handles open on the system and potentially lead to a Denial of Service (DoS).

The ContextLines integration is enabled by default in the Node SDK (@sentry/node) and SDKs that run in Node.js environments (@sentry/astro, @sentry/aws-serverless, @sentry/bun, @sentry/google-cloud-serverless, @sentry/nestjs, @sentry/nextjs, @sentry/nuxt, @sentry/remix, @sentry/solidstart, @sentry/sveltekit).

Patches

Users should upgrade to version 8.49.0 or higher.

Workarounds

To remediate this issue in affected versions without upgrading to version 8.49.0 and above you can disable the ContextLines integration. See the docs for more details.

Sentry.init({
  // ...
  integrations: function (integrations) {
    // integrations will be all default integrations
    return integrations.filter(function (integration) {
      return integration.name !== "ContextLines";
    });
  },
});

If you disable the ContextLines integration, you will lose source context on your error events.

References

  • Reported issue: https://github.com/getsentry/sentry-javascript/issues/14892
  • PR Fix: https://github.com/getsentry/sentry-javascript/pull/14997

Is GHSA-r5w7-f542-q2j4 in any of your client repos?

Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected @sentry/node, and gives you the command that fixes it.

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.