{"answers":{"affected":"2 open source packages ship an affected version, including @asymmetric-effort/nogginlessdom.","exploited":"There is no known exploitation of GHSA-322x-v876-g883 in the wild and no public exploit code.","fix":"Upgrade @asymmetric-effort/nogginlessdom to 0.0.22 or later.","what":"GHSA-322x-v876-g883 is a path traversal vulnerability in @asymmetric-effort/nogginlessdom, published on 2 Jul 2026. It can only be exploited from the same machine or local network, with no action from the victim."},"fix_prompt":"Check this codebase for GHSA-322x-v876-g883 and fix it if it is affected.\n\nWhat it is: GHSA-322x-v876-g883 is a path traversal vulnerability in @asymmetric-effort/nogginlessdom, published on 2 Jul 2026. It can only be exploited from the same machine or local network, with no action from the victim.\nExploitation: There is no known exploitation of GHSA-322x-v876-g883 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- @asymmetric-effort/nogginlessdom (npm): affected all versions; fixed in 0.0.22\n- @asymmetric-effort/nogginlessdom (npm): affected all versions; fixed in 0.0.22\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-322x-v876-g883/ (Markdown: https://insights.sbomify.com/GHSA-322x-v876-g883/index.md)","id":"GHSA-322x-v876-g883","markdown":"https://insights.sbomify.com/GHSA-322x-v876-g883/index.md","name":"GHSA-322x-v876-g883","record":{"aliases":[],"analysis":{"component_type":"library","fix_type":"patch","impacts":["code_execution","data_modify"],"network_reachable":"adjacent_or_local","non_default_config":true,"product_category":"npm testing library","requires_auth":"none","summary":"Attackers can write arbitrary files via path traversal in snapshot updates, potentially compromising CI/CD pipelines and executing code.","user_interaction":"not_required","vuln_class":"path_traversal"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"## Summary\n\nThe `matchFileSnapshot` function in `src/assertions/snapshots.ts` accepted a `filePath` parameter with zero validation. When snapshot update mode was active (`UPDATE_SNAPSHOTS=1` or `setUpdateMode('all')`), an attacker who controls test input could write arbitrary content to any filesystem path the process has write access to, including creating intermediate directories.\n\n## Affected Code\n\n**File:** `src/assertions/snapshots.ts`, lines 732-769\n\n```typescript\nexport function matchFileSnapshot(actual: unknown, filePath: string): void {\n  const serialized = serialize(actual);\n  const mode = resolveUpdateMode();\n  const fileExists = fs.existsSync(filePath);\n\n  if (!fileExists) {\n    if (mode === 'all' || mode === 'new') {\n      const dir = path.dirname(filePath);\n      if (!fs.existsSync(dir)) {\n        fs.mkdirSync(dir, { recursive: true });\n      }\n      fs.writeFileSync(filePath, serialized, 'utf-8');\n```\n\nThe `filePath` flows from `expect(value).toMatchFileSnapshot(filePath)` at `index.ts:1033-1035` with no sanitization, no check that the path is within an expected directory, and no symlink resolution.\n\n## Proof of Concept\n\n```typescript\nimport { expect, setUpdateMode } from '@asymmetric-effort/nogginlessdom';\n\nsetUpdateMode('all');\n\n// Writes arbitrary content to any writable path\nexpect('malicious content').toMatchFileSnapshot('/tmp/exploit/payload.txt');\n\n// Path traversal via relative components\nexpect('data').toMatchFileSnapshot('../../../tmp/evil.txt');\n\n// In CI environments, could overwrite CI config\nexpect('injected step').toMatchFileSnapshot('/home/runner/.github/workflows/backdoor.yml');\n```\n\n## Impact\n\nIn CI/CD environments where test files may come from untrusted pull requests, this allows writing to any writable filesystem location with directory creation. An attacker could overwrite configuration files, inject code into build artifacts, or modify CI pipeline definitions.\n\n## Fix\n\nFixed in commit https://github.com/asymmetric-effort/NogginLessDom/commit/785e6ac6e124d1a89b3ccf40bbd75fc8e4cb215d on `main`. The `matchFileSnapshot` function now validates that the resolved file path is within the project root directory (defaults to `process.cwd()`, configurable via optional `projectRoot` parameter). Paths that resolve outside the project directory are rejected with a descriptive error.\n\n```typescript\nexport function matchFileSnapshot(\n  actual: unknown,\n  filePath: string,\n  projectRoot?: string,\n): void {\n  const root = projectRoot ?? process.cwd();\n  const resolved = path.resolve(root, filePath);\n  if (!resolved.startsWith(root + path.sep) \u0026\u0026 resolved !== root) {\n    throw new Error(\n      `File snapshot path must be within the project directory: ${filePath}`,\n    );\n  }\n  // ... all subsequent file I/O uses `resolved` instead of `filePath`\n}\n```","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":"@asymmetric-effort/nogginlessdom's Path Traversal in matchFileSnapshot allows arbitrary file write","id":"GHSA-322x-v876-g883","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"npm","product":null,"products":[],"type":"path_traversal","year":"2026"},"n_packages":2,"n_references":null,"packages":[{"ecosystem":"npm","fixed":["0.0.22"],"introduced":["0"],"last_affected":[],"package":"@asymmetric-effort/nogginlessdom","purl":null,"source":"GHSA-322x-v876-g883"},{"ecosystem":"npm","fixed":["0.0.22"],"introduced":["0"],"last_affected":[],"package":"@asymmetric-effort/nogginlessdom","purl":"pkg:npm/%40asymmetric-effort/nogginlessdom","source":"GHSA-322x-v876-g883"}],"products":null,"published":"2026-07-02","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":"Attackers can write arbitrary files via path traversal in snapshot updates, potentially compromising CI/CD pipelines and executing code.","url":"https://insights.sbomify.com/GHSA-322x-v876-g883/"}