{"answers":{"affected":"6 open source packages ship an affected version, including @apollo/server and apollo-server-core.","exploited":"There is no known exploitation of GHSA-j5g3-5c8r-7qfx in the wild and no public exploit code.","fix":"Upgrade @apollo/server to 4.9.3 or later.","what":"GHSA-j5g3-5c8r-7qfx is a vulnerability in @apollo/server, published on 30 Aug 2023. An attacker can exploit it over the internet without logging in, with no action from the victim."},"fix_prompt":"Check this codebase for GHSA-j5g3-5c8r-7qfx and fix it if it is affected.\n\nWhat it is: GHSA-j5g3-5c8r-7qfx is a vulnerability in @apollo/server, published on 30 Aug 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.\nExploitation: There is no known exploitation of GHSA-j5g3-5c8r-7qfx in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- @apollo/server (npm): affected all versions; fixed in 4.9.3\n- @apollo/server (npm): affected all versions; fixed in 4.9.3\n- apollo-server-core (npm): affected all versions; fixed in 2.26.1\n- apollo-server-core (npm): affected all versions; fixed in 2.26.1\n- apollo-server-core (npm): affected from 3.0.0; fixed in 3.12.1\n- apollo-server-core (npm): affected from 3.0.0; fixed in 3.12.1\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-j5g3-5c8r-7qfx/ (Markdown: https://insights.sbomify.com/GHSA-j5g3-5c8r-7qfx/index.md)","id":"GHSA-j5g3-5c8r-7qfx","markdown":"https://insights.sbomify.com/GHSA-j5g3-5c8r-7qfx/index.md","name":"GHSA-j5g3-5c8r-7qfx","record":{"aliases":[],"analysis":{"component_type":"server_software","fix_type":"upgrade","impacts":["data_read"],"network_reachable":"yes","non_default_config":true,"product_category":"Apollo Server","requires_auth":"none","summary":"Apollo Server may log sensitive Studio API keys if they contain invalid characters, exposing secrets to logs when using specific fetchers and reporting features.","user_interaction":"not_required","vuln_class":"information_disclosure"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"## Impact\n### What kind of vulnerability is it?\nApollo 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.\n\n### Who is impacted?\nUsers who (all of the below):\n* use either the schema reporting or usage reporting feature\n* use an Apollo Studio API key which has invalid header values\n* use the default fetcher (`node-fetch`) or configured their own `node-fetch` fetcher\n\nThe 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.\n```js\nconst invalidHeaderCharRegex = /[^\\t\\x20-\\x7e\\x80-\\xff]/;\nif (invalidHeaderCharRegex.test('\u003cYOUR_API_KEY\u003e')) {\n  console.log('potentially affected');\n}\nconsole.log('unaffected');\n```\n\nIf 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.\n\n### Patches\nThis problem is patched in the latest version of Apollo Server as soon as this advisory is published.\n\n### Workarounds\n* 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).\n* Override the `fetcher` \n* Disable schema reporting and/or usage reporting\n\n### Solution\n* 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.\n* Apollo Server will now perform the same validation of API keys as `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.","ecosystems":["npm"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"Prevent logging invalid header values","id":"GHSA-j5g3-5c8r-7qfx","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"npm","product":null,"products":[],"type":"information_disclosure","year":"2023"},"n_packages":6,"n_references":null,"packages":[{"ecosystem":"npm","fixed":["4.9.3"],"introduced":["0"],"last_affected":[],"package":"@apollo/server","purl":null,"source":"GHSA-j5g3-5c8r-7qfx"},{"ecosystem":"npm","fixed":["4.9.3"],"introduced":["0"],"last_affected":[],"package":"@apollo/server","purl":"pkg:npm/%40apollo/server","source":"GHSA-j5g3-5c8r-7qfx"},{"ecosystem":"npm","fixed":["2.26.1"],"introduced":["0"],"last_affected":[],"package":"apollo-server-core","purl":null,"source":"GHSA-j5g3-5c8r-7qfx"},{"ecosystem":"npm","fixed":["2.26.1"],"introduced":["0"],"last_affected":[],"package":"apollo-server-core","purl":"pkg:npm/apollo-server-core","source":"GHSA-j5g3-5c8r-7qfx"},{"ecosystem":"npm","fixed":["3.12.1"],"introduced":["3.0.0"],"last_affected":[],"package":"apollo-server-core","purl":null,"source":"GHSA-j5g3-5c8r-7qfx"},{"ecosystem":"npm","fixed":["3.12.1"],"introduced":["3.0.0"],"last_affected":[],"package":"apollo-server-core","purl":"pkg:npm/apollo-server-core","source":"GHSA-j5g3-5c8r-7qfx"}],"products":null,"published":"2023-08-30","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"Apollo Server may log sensitive Studio API keys if they contain invalid characters, exposing secrets to logs when using specific fetchers and reporting features.","url":"https://insights.sbomify.com/GHSA-j5g3-5c8r-7qfx/"}