Skip to content

Commit 0c5b5d0

Browse files
1 parent b9b7312 commit 0c5b5d0

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"schema_version": "1.4.0",
3+
"id": "GHSA-wmfp-5q7x-987x",
4+
"modified": "2026-03-10T01:04:34Z",
5+
"published": "2026-03-10T01:04:34Z",
6+
"aliases": [
7+
"CVE-2026-30952"
8+
],
9+
"summary": "liquidjs has a path traversal fallback vulnerability",
10+
"details": "### Impact\nThe `layout`, `render`, and `include` tags allow arbitrary file access via absolute paths (either as string literals or through Liquid variables when `dynamicPartials: true` is enabled). This poses a security risk when malicious users are allowed to control the template content or specify the filepath to be included as a Liquid variable.\n\n### Patches\nThe issue is fixed via [#855](https://github.com/harttle/liquidjs/pull/855) and published version 10.25.0 on npm.\n\n### Workarounds\n#### Change the files in build time\nIn build time, through Shell script or Webpack `string-replace-loader`, change the file content of correxponding file (depending on your package `type`, for CommonJS it's `dist/liquid.node.js`) under `dist/`, \n\n```diff\n if (fs.fallback !== undefined) {\n const filepath = fs.fallback(file)\n- if (filepath !== undefined) yield filepath\n+ if (filepath !== undefined) {\n+ for (const dir of dirs) {\n+ if (!enforceRoot || this.contains(dir, filepath)) {\n+ yield filepath\n+ break\n+ }\n+ }\n }\n }\n```\n\n#### Overriding by `fs` LiquidJS option\nAdding a [`fs` option](https://liquidjs.com/api/interfaces/FS.html) to override the [default `fs` implementation](https://github.com/harttle/liquidjs/blob/1b85fdaa9c535021f7030a239a64003af26d31b5/src/fs/fs-impl.ts#L36-L40):\n\n```javascript\nconst { statSync, readFileSync, promises: { stat, readFile } } = require('fs')\nconst { resolve, extname, dirname, sep } = require('path')\n\nconst fs = {\n exists: async (fp) => { try { await stat(fp); return true; } catch { return false } },\n existsSync: (fp) => { try { statSync(fp); return true } catch { return false } },\n resolve: (root, file, ext) => resolve(root, file + (extname(file) ? '' : ext)),\n contains: (root, file) => {\n const r = resolve(root)\n return file.startsWith(r.endsWith(sep) ? r : r + sep)\n },\n readFile: (fp) => readFile(fp, 'utf8'),\n readFileSync: (fp) => readFileSync(fp, 'utf8'),\n fallback: () => undefined,\n dirname,\n sep\n};\n\nconst engine = new Liquid({ fs })\n```\n\n### References\nDiscussions: https://github.com/harttle/liquidjs/pull/851\nCode fix: https://github.com/harttle/liquidjs/pull/855",
11+
"severity": [
12+
{
13+
"type": "CVSS_V4",
14+
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"
15+
}
16+
],
17+
"affected": [
18+
{
19+
"package": {
20+
"ecosystem": "npm",
21+
"name": "liquidjs"
22+
},
23+
"ranges": [
24+
{
25+
"type": "ECOSYSTEM",
26+
"events": [
27+
{
28+
"introduced": "0"
29+
},
30+
{
31+
"fixed": "10.25.0"
32+
}
33+
]
34+
}
35+
]
36+
}
37+
],
38+
"references": [
39+
{
40+
"type": "WEB",
41+
"url": "https://github.com/harttle/liquidjs/security/advisories/GHSA-wmfp-5q7x-987x"
42+
},
43+
{
44+
"type": "WEB",
45+
"url": "https://github.com/harttle/liquidjs/pull/851"
46+
},
47+
{
48+
"type": "WEB",
49+
"url": "https://github.com/harttle/liquidjs/pull/855"
50+
},
51+
{
52+
"type": "WEB",
53+
"url": "https://github.com/harttle/liquidjs/commit/3cd024d652dc883c46307581e979fe32302adbac"
54+
},
55+
{
56+
"type": "PACKAGE",
57+
"url": "https://github.com/harttle/liquidjs"
58+
}
59+
],
60+
"database_specific": {
61+
"cwe_ids": [
62+
"CWE-22"
63+
],
64+
"severity": "HIGH",
65+
"github_reviewed": true,
66+
"github_reviewed_at": "2026-03-10T01:04:34Z",
67+
"nvd_published_at": null
68+
}
69+
}

0 commit comments

Comments
 (0)