Skip to content

Security: js-yaml prototype-pollution vulnerability via bundled dependency #178

@huulanka

Description

@huulanka

Description:

gray-matter transitively depends on a vulnerable js-yaml version (<4.1.1) which is subject to prototype pollution (GHSA-mh29-5h37-fv8m / CVE-2025-64718). This causes npm audit to report a moderate severity vulnerability for projects that install gray-matter.

Reproduction (local output from my project):

  • npm audit report:
    js-yaml <4.1.1
    Severity: moderate
    js-yaml has prototype pollution in merge (<<) - GHSA-mh29-5h37-fv8m
    node_modules/gray-matter/node_modules/js-yaml
    gray-matter <=1.2.6 || >=2.0.2
    Depends on vulnerable versions of js-yaml
    node_modules/gray-matter

Expected behavior:

gray-matter releases should not depend on js-yaml versions older than 4.1.1. Projects installing gray-matter should not trigger an npm audit vulnerability for js-yaml.

References:

Notes:

  • I attempted to upgrade js-yaml to v4.1.1 locally, but this breaks gray-matter because gray-matter uses the removed APIs yaml.safeLoad / yaml.safeDump.
  • Example runtime error observed after forcing js-yaml@4.1.1:

    Error: Function yaml.safeLoad is removed in js-yaml 4. Use yaml.load instead, which is now safe by default.

  • Current gray-matter code (lib/engines.js) uses yaml.safeLoad and yaml.safeDump, so consumers cannot safely upgrade js-yaml themselves without a gray-matter change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions