@apollo/server vulnerable to unsafe application of Content Security Policy via reused noncesGHSA-68jh-rf6x-836f
Fix: apollographql/apollo-server@0adaf80GHSA-68jh-rf6x-836f is a security vulnerability in @apollo/server. A fix is available for @apollo/server — see the affected versions and patch details below.
Real-World Exposure
How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.
@apollo/servernpmDescription
Context
Content Security Policies (CSP) are a defense-in-depth strategy against XSS attacks. Improper application of CSP isn't itself a vulnerability, but it does fail to prevent XSS in the event that there is a viable attack vector for an XSS attack.
Impact
There aren't any XSS attack vectors via the Apollo Server landing pages known to Apollo, so to our knowledge there is no impact. However, if there are existing XSS vectors that haven't been reported and patched, then all users of Apollo Server's landing pages have a vulnerability which won't be prevented by the current CSP implemented by the landing pages.
Prior to version 4.7.1, there was no CSP implemented at all. However, the initial CSP implementation (4.7.1+) reused nonces. While this sufficiently resolved the issue w.r.t. scripts not running in Safari, it did not implement CSP in a safe or conventional way.
Patches
The issue is patched in the latest version of Apollo Server, v4.7.4. The changes can be reviewed in the merge commit.
Workarounds
The landing page can be disabled completely until the patch can be upgraded to. https://www.apollographql.com/docs/apollo-server/api/plugin/landing-pages/#disabling-the-landing-page
References
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | @apollo/server | ≥ 4.7.1&&< 4.7.4 | 4.7.4npm install @apollo/server@4.7.4 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for @apollo/server, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update @apollo/server to 4.7.4 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-68jh-rf6x-836f is resolved across your whole dependency graph.
Workarounds
Escape or sanitise the affected output on the server side rather than relying on client-side filtering, and add a Content-Security-Policy that blocks inline script execution so injected markup cannot run even if it reaches the page.
Frequently Asked Questions
Is GHSA-68jh-rf6x-836f in your dependencies?
Find it across npm, including transitive dependencies.