@apollo/server
Affected
- introduced
0, fixed4.9.3(semver)
Fixed versions
4.9.3
Fix
- Fixed version
4.9.3npm install @apollo/[email protected]
Advisory
Also known as: None
Prevent logging invalid header values
Impact
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):
node-fetch) or configured their own node-fetch fetcherThe 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.
Patches
This problem is patched in the latest version of Apollo Server as soon as this advisory is published.
Workarounds
fetcher Solution
.trim() on incoming API keys in order to eliminate leading/trailing whitespace and log a warning when it does so.node-fetch@2 performs 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.Low Basis: The source's own band: LOW
0, fixed 4.9.3 (semver)4.9.3
4.9.3npm install @apollo/[email protected]3.0.0, fixed 3.12.1 (semver)3.12.1
3.12.1npm install [email protected]0, fixed 2.26.1 (semver)2.26.1
2.26.1npm install [email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0