GHSA-322x-v876-g883: @asymmetric effort/nogginlessdom Path Traversal Vulnerability

HIGH
CWE-22
Published
Advisory Summary

GHSA-322x-v876-g883 is a HIGH path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting @asymmetric effort/nogginlessdom libraries in the npm ecosystem. The issue involves @asymmetric-effort/nogginlessdom's path traversal in matchfilesnapshot allows arbitrary file write. Remediation is available by upgrading affected packages to version 0.0.22.

GHSA-322x-v876-g883 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-322x-v876-g883
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product @asymmetric effort/nogginlessdom
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-322x-v876-g883

To remediate this vulnerability, upgrade all affected @asymmetric effort/nogginlessdom dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@asymmetric-effort/nogginlessdom fixed: 0.0.22
npm install @asymmetric-effort/nogginlessdom@0.0.22
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @asymmetric-effort/nogginlessdom

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-322x-v876-g883, inspect your project dependencies using npm:

npm ls @asymmetric-effort/nogginlessdom

Analyze the terminal output to locate any version of @asymmetric effort/nogginlessdom in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.0.22), your application is affected.

Note: The npm ls @asymmetric-effort/nogginlessdom command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In @asymmetric effort/nogginlessdom, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary The `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. ## Affected Code **File:** `src/assertions/snapshots.ts`, lines 732-769 ```typescript export function matchFileSnapshot(actual: unknown, filePath: string): void { const serialized = serialize(actual); const mode = resolveUpdateMode(); const fileExists = fs.existsSync(filePath); if (!fileExists) { if (mode === 'all' || mode === 'new') { const dir = path.dirname(filePath); if (!fs.existsSync(dir)) { fs.mkdirSync(dir, { recursive: true }); } fs.writeFileSync(filePath, serialized, 'utf-8'); ``` The `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. ## Proof of Concept ```typescript import { expect, setUpdateMode } from '@asymmetric-effort/nogginlessdom'; setUpdateMode('all'); // Writes arbitrary content to any writable path expect('malicious content').toMatchFileSnapshot('/tmp/exploit/payload.txt'); // Path traversal via relative components expect('data').toMatchFileSnapshot('../../../tmp/evil.txt'); // In CI environments, could overwrite CI config expect('injected step').toMatchFileSnapshot('/home/runner/.github/workflows/backdoor.yml'); ``` ## Impact In 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. ## Fix Fixed 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. ```typescript export function matchFileSnapshot( actual: unknown, filePath: string, projectRoot?: string, ): void { const root = projectRoot ?? process.cwd(); const resolved = path.resolve(root, filePath); if (!resolved.startsWith(root + path.sep) && resolved !== root) { throw new Error( `File snapshot path must be within the project directory: ${filePath}`, ); } // ... all subsequent file I/O uses `resolved` instead of `filePath` } ```

GHSA-322x-v876-g883 Affected @asymmetric effort/nogginlessdom Versions

1 component(s)
Fixed Versions:
0.0.22
Product / Package Ecosystem Affected Versions Fixed Version
@asymmetric-effort/nogginlessdom
npm
< 0.0.22
0.0.22

References

Frequently Asked Questions

What is GHSA-322x-v876-g883?
GHSA-322x-v876-g883 is a security vulnerability in @asymmetric effort/nogginlessdom involving @asymmetric-effort/nogginlessdom's Path Traversal in matchFileSnapshot allows arbitrary file write under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which @asymmetric effort/nogginlessdom versions are affected?
Affected versions include releases prior to 0.0.22 across affected packages: @asymmetric-effort/nogginlessdom.
What version fixes GHSA-322x-v876-g883?
Upgrading to 0.0.22 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @asymmetric-effort/nogginlessdom affected?
Yes, @asymmetric-effort/nogginlessdom is affected in releases prior to 0.0.22. Upgrade your dependency to 0.0.22 or later.
What CWE is associated with GHSA-322x-v876-g883?
GHSA-322x-v876-g883 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check npm dependencies for GHSA-322x-v876-g883?
Run the dependency tree command: 'npm ls @asymmetric-effort/nogginlessdom'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-322x-v876-g883",
  "modified" : "2026-07-02T20:19:20Z",
  "published" : "2026-07-02T20:19:20Z",
  "aliases" : [ ],
  "summary" : "@asymmetric-effort/nogginlessdom's Path Traversal in matchFileSnapshot allows arbitrary file write",
  "details" : "## 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) && 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```",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@asymmetric-effort/nogginlessdom"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.22"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.0.21"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/asymmetric-effort/NogginLessDom/security/advisories/GHSA-322x-v876-g883"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/asymmetric-effort/NogginLessDom/commit/785e6ac6e124d1a89b3ccf40bbd75fc8e4cb215d"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/asymmetric-effort/NogginLessDom"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-07-02T20:19:20Z",
    "nvd_published_at" : null
  }
}