Discussion of critical errors in npm audit report for @sanity/client@0.3.0
I understand the concern! npm audit warnings can be alarming, but let me help you understand what's happening and how to fix it.
The Issue
You're using @sanity/client version 3.3.0, which is quite outdated (released in 2022). This version depends on eventsource 3.2.0, which has known security vulnerabilities that npm audit is flagging. The eventsource package is used for Server-Sent Events (SSE) functionality in the Sanity client.
The Solution: Upgrade @sanity/client
The best approach is to upgrade to the latest version of @sanity/client. The current version is v6.x, which has resolved these dependency vulnerabilities. Here's what to do:
npm install @sanity/client@latestOr if you're using yarn:
yarn add @sanity/client@latestImportant Breaking Changes to Consider
Since you're jumping from v3.3.0 to v6.x, there are some breaking changes you'll need to handle:
Import changes: The client now uses named exports
// Old (v3) import sanityClient from '@sanity/client' // New (v6) import {createClient} from '@sanity/client'Configuration: The API is largely the same, but check the Sanity changelog for any specific features you're using
Node.js version: Make sure you're running Node.js 18 or higher
Why This Matters
While the eventsource vulnerability (CVE/GHSA issues) might not directly affect your application depending on whether you're using listener features, it's good practice to stay reasonably up-to-date with dependencies for security and compatibility reasons. The vulnerability in eventsource 3.2.0 has been addressed in newer versions that the latest @sanity/client uses.
After Upgrading
Run npm audit again to verify the critical vulnerabilities are resolved. You should see a much cleaner report.
If you're working on a large codebase and concerned about breaking changes, you can review what changed between versions by checking the official Sanity changelog or testing in a development branch first.
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.