Skip to content

bug(yarn): packages pinned by resolutions are marked as production dependencies #11568

Open

Description

@nikpivkin

Discussed in #11532

Description

Yarn v2+ writes a package pinned by resolutions to yarn.lock under the pinned version. Packages that depend on it still list the range they asked for. Trivy finds no lockfile entry for that range and loses the edge, so the pinned package gets no relationship and is reported as a production dependency even when only dev dependencies pull it in. Its own dependencies lose the dev flag too, and the dependent gets an empty string in DependsOn.

Yarn v1 is not affected because it keeps the original range in the entry key (markdown-it@14.3.0, markdown-it@~14.1.0:).

Steps to reproduce

Create package.json.

{
  "name": "app",
  "version": "1.0.0",
  "devDependencies": {
    "markdownlint-cli": "0.45.0"
  },
  "resolutions": {
    "markdown-it": "14.3.0"
  }
}

Run yarn install --mode=update-lockfile with Yarn 4.9.2. The relevant part of yarn.lock looks like this.

"markdown-it@npm:14.3.0":
  version: 14.3.0
  resolution: "markdown-it@npm:14.3.0"
"markdownlint-cli@npm:0.45.0":
  version: 0.45.0
  resolution: "markdownlint-cli@npm:0.45.0"
  dependencies:
    markdown-it: "npm:~14.1.0"

Run trivy fs --scanners vuln ..

yarn.lock (yarn)

Total: 4 (UNKNOWN: 0, LOW: 1, MEDIUM: 1, HIGH: 2, CRITICAL: 0)
┌─────────────┬─────────────────────┬──────────┬────────┬───────────────────┬────────────────┬─────────────────────────────────────────────────────────────┐
│   Library   │    Vulnerability    │ Severity │ Status │ Installed Version │ Fixed Version  │                            Title                            │
├─────────────┼─────────────────────┼──────────┼────────┼───────────────────┼────────────────┼─────────────────────────────────────────────────────────────┤
│ markdown-it │ CVE-2026-111758     │ HIGH     │ fixed  │ 14.3.0            │ 14.3.3, 15.0.3 │ markdown-it: markdown-it: Denial of Service via unclosed    │
│             │                     │          │        │                   │                │ link reference definitions                                  │
│             │                     │          │        │                   │                │ https://avd.aquasec.com/nvd/cve-2026-111758                 │
│             ├─────────────────────┤          │        │                   ├────────────────┼─────────────────────────────────────────────────────────────┤
│             │ CVE-2026-111759     │          │        │                   │ 15.0.2, 14.3.2 │ markdown-it: markdown-it: Denial of Service via mismatched  │
│             │                     │          │        │                   │                │ quote parsing                                               │
│             │                     │          │        │                   │                │ https://avd.aquasec.com/nvd/cve-2026-111759                 │
│             ├─────────────────────┼──────────┤        │                   ├────────────────┼─────────────────────────────────────────────────────────────┤
│             │ GHSA-253c-mchw-3w2r │ MEDIUM   │        │                   │ 15.0.1, 14.3.1 │ markdown-it linkify: true has two quadratic paths, so a few │
│             │                     │          │        │                   │                │ hundred KB...                                               │
│             │                     │          │        │                   │                │ https://github.com/advisories/GHSA-253c-mchw-3w2r           │
│             ├─────────────────────┼──────────┤        │                   ├────────────────┼─────────────────────────────────────────────────────────────┤
│             │ CVE-2026-111766     │ LOW      │        │                   │ 14.3.3, 15.0.3 │ markdown-it: markdown-it: Denial of Service via repeated    │
│             │                     │          │        │                   │                │ unterminated inline HTML constructs                         │
│             │                     │          │        │                   │                │ https://avd.aquasec.com/nvd/cve-2026-111766                 │
└─────────────┴─────────────────────┴──────────┴────────┴───────────────────┴────────────────┴─────────────────────────────────────────────────────────────┘

Run trivy fs --scanners vuln --format json --list-all-pkgs --include-dev-deps .. markdown-it@14.3.0 has no Dev and no Relationship, and markdownlint-cli@0.45.0 has "" in DependsOn.

{
  "ID": "markdownlint-cli@0.45.0",
  "Name": "markdownlint-cli",
  "Version": "0.45.0",
  "Relationship": "direct",
  "Dev": true,
  "DependsOn": [
    "commander@13.1.0",
    "glob@11.0.3",
    "ignore@7.0.14",
    "js-yaml@4.1.1",
    "jsonc-parser@3.3.1",
    "jsonpointer@5.0.1",
    "",
    "markdownlint@0.38.0",
    "minimatch@10.0.3",
    "run-con@1.3.3",
    "smol-toml@1.3.4"
  ]
},
{
  "ID": "markdown-it@14.3.0",
  "Name": "markdown-it",
  "Version": "14.3.0",
  "DependsOn": [
    "argparse@2.0.1",
    "entities@4.5.0",
    "linkify-it@5.0.2",
    "mdurl@2.1.0",
    "punycode.js@2.3.1",
    "uc.micro@2.1.0"
  ]
}

markdown-it@14.3.0 should be an indirect dev dependency and should not be reported without --include-dev-deps.

The same happens with a scoped resolution like "markdownlint-cli/markdown-it": "14.3.0". If the project also depends on another version of markdown-it (for example "markdown-it": "^13.0.0"), yarn.lock has two markdown-it entries and does not show which of them ~14.1.0 was resolved to.

Activity

  1. added
    kind/bug
    on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions