Unwanted access to the entire file system vulnerability due to a missing check in `staticFiles` HTTP handler in graphql-mesh
Description
GraphQL Mesh is a GraphQL Federation framework and gateway for both GraphQL Federation and non-GraphQL Federation subgraphs, non-GraphQL services, such as REST and gRPC, and also databases such as MongoDB, MySQL, and PostgreSQL. Missing check vulnerability in the static file handler allows any client to access the files in the server's file system. When staticFiles is set in the serve settings in the configuration file, the following handler doesn't check if absolutePath is still under the directory provided as staticFiles. Users have two options to fix vulnerability; 1. Update @graphql-mesh/cli to a version higher than 0.82.21, and if you use @graphql-mesh/http, update it to a version higher than 0.3.18 2. Remove staticFiles option from the configuration, and use other solutions to serve static files.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
@graphql-mesh/clinpm | >= 0.78.0, < 0.82.22 | 0.82.22 |
@graphql-mesh/httpnpm | < 0.3.19 | 0.3.19 |
Affected products
1- Range: @graphql-mesh/cli: >= 0.78.0, < 0.82.22
Patches
195d93e7c140cMerge pull request from GHSA-j2wh-wrv3-4x4g
6 files changed · +55 −2
.changeset/dry-countries-travel.md+5 −0 added@@ -0,0 +1,5 @@ +--- +'@graphql-mesh/http': patch +--- + +When `staticFiles` is set, do not allow to access upper directories
packages/http/src/index.ts+3 −2 modified@@ -86,8 +86,9 @@ export function createMeshHTTPHandler<TServerContext>({ if (!relativePath) { relativePath = 'index.html'; } - const absolutePath = path.join(baseDir, staticFiles, relativePath); - if (await pathExists(absolutePath)) { + const absoluteStaticFilesPath = path.join(baseDir, staticFiles); + const absolutePath = path.join(absoluteStaticFilesPath, relativePath); + if (absolutePath.startsWith(absoluteStaticFilesPath) && (await pathExists(absolutePath))) { const readStream = fs.createReadStream(absolutePath); return new Response(readStream as any, { status: 200,
packages/http/test/fixtures/static-files/index.html+12 −0 added@@ -0,0 +1,12 @@ +<html> + <head> + <title>Static Files</title> + <link rel="stylesheet" href="style.css" /> + <script src="script.js"></script> + </head> + <body> + <h1>Static Files</h1> + <p>Some static files.</p> + <p id="test"></p> + </body> +</html>
packages/http/test/fixtures/static-files/script.js+1 −0 added@@ -0,0 +1 @@ +document.getElementById('test').innerHTML = 'Hello World!';
packages/http/test/fixtures/static-files/style.css+8 −0 added@@ -0,0 +1,8 @@ +body { + background: #fff; + color: #000; + font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; + font-size: 14px; + line-height: 1.42857143; + margin: 0; +}
packages/http/test/http.spec.ts+26 −0 added@@ -0,0 +1,26 @@ +import { createMeshHTTPHandler } from '@graphql-mesh/http'; +import { MeshInstance } from '@graphql-mesh/runtime'; +import { getTestMesh } from '../../testing/getTestMesh'; + +describe('http', () => { + let mesh: MeshInstance; + beforeEach(async () => { + mesh = await getTestMesh(); + }); + it('should not allow upper directory access when `staticFiles` is set', async () => { + const httpHandler = createMeshHTTPHandler({ + baseDir: __dirname, + getBuiltMesh: async () => mesh, + rawServeConfig: { + staticFiles: './fixtures/static-files', + }, + }); + const response = await httpHandler.fetch( + 'http://localhost:4000/..%2f/..%2f/..%2f/package.json', + ); + expect(response.status).toBe(404); + }); + afterEach(() => { + mesh.destroy(); + }); +});
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
5- github.com/advisories/GHSA-j2wh-wrv3-4x4gghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2025-27098ghsaADVISORY
- github.com/Urigo/graphql-mesh/commit/95d93e7c140c2995b37e9d822aa3fe4e24ed2e78ghsaWEB
- github.com/Urigo/graphql-mesh/security/advisories/GHSA-j2wh-wrv3-4x4gghsaWEB
- github.com/ardatan/graphql-mesh/security/advisories/GHSA-j2wh-wrv3-4x4gghsax_refsource_CONFIRMWEB
News mentions
0No linked articles in our index yet.