Summary
Prevent logging invalid header values
What kind of vulnerability is it?
Apollo Server can log sensitive information (Studio API keys) if they are passed incorrectly (with leading/trailing whitespace) or if they have any characters that are invalid as part of a header value.
Who is impacted?
Users who (all of the below):
- use either the schema reporting or usage reporting feature
- use an Apollo Studio API key which has invalid header values
- use the default fetcher (
node-fetch) or configured their ownnode-fetchfetcher
The following node snippet can test whether your API key has invalid header values. This code is taken directly from node-fetch@2's header value validation code.
const invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/;
if (invalidHeaderCharRegex.test('<YOUR_API_KEY>')) {
console.log('potentially affected');
}
console.log('unaffected');
If the provided API key is not a valid header value, whenever Apollo Server uses that API key in a request (to Studio, for example), node-fetch will throw an error which contains the header value. This error is logged in various ways depending on the user's configuration, but most likely the console or some configured logging service.
Workarounds
- Try retrieving a new API key from Studio. Note: this may not work if the invalid character is not part of the secret (it may be derived from identifiers like graph name, user name).
- Override the
fetcher - Disable schema reporting and/or usage reporting
Solution
- Apollo Server will now call
.trim()on incoming API keys in order to eliminate leading/trailing whitespace and log a warning when it does so. - Apollo Server will now perform the same validation of API keys as
node-fetch@2performs on header values on startup. Apollo Server will throw an error on startup (i.e., fail to start completely) and notify the user their API key is invalid along with the offending characters.
Impact
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
This problem is patched in the latest version of Apollo Server as soon as this advisory is published.
Frequently Asked Questions
- What is GHSA-J5G3-5C8R-7QFX? GHSA-J5G3-5C8R-7QFX is a low-severity security vulnerability in @apollo/server (npm), affecting versions < 4.9.3. It is fixed in 4.9.3, 3.12.1, 2.26.1.
- Which packages are affected by GHSA-J5G3-5C8R-7QFX?
@apollo/server(npm) (versions < 4.9.3)apollo-server-core(npm) (versions >= 3.0.0, < 3.12.1)
- Is there a fix for GHSA-J5G3-5C8R-7QFX? Yes. GHSA-J5G3-5C8R-7QFX is fixed in 4.9.3, 3.12.1, 2.26.1. Upgrade to this version or later.
- Is GHSA-J5G3-5C8R-7QFX exploitable, and should I be worried? Whether GHSA-J5G3-5C8R-7QFX is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether GHSA-J5G3-5C8R-7QFX is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix GHSA-J5G3-5C8R-7QFX?
- Upgrade
@apollo/serverto 4.9.3 or later - Upgrade
apollo-server-coreto 3.12.1 or later - Upgrade
apollo-server-coreto 2.26.1 or later
- Upgrade