Skip to content

yarn.lock (v1) cataloger silently returns 118 of 745 packages — most entries dropped without error #5204

Description

@c-schmitz

What happened

Scanning a single, valid Yarn v1 yarn.lock (one # yarn lockfile v1 header, 745 resolved packages), Syft catalogs only 118 npm packages and reports no warning or error. The very first entry (@ampproject/remapping@2.2.0) and the entire @babel/* set are missing from the output.

foundBy is javascript-lock-cataloger reading /yarn.lock, so the file is being parsed — the majority of entries are simply dropped.

Environment

syft 1.51.0
BuildDate:      2026-08-10T14:48:50Z
Platform:       linux/amd64
GoVersion:      go1.26.3
SchemaVersion:  16.1.10

Steps to reproduce

Uses a public, unmodified lockfile from the LimeSurvey repository:

mkdir /tmp/syft-yarn-repro && cd /tmp/syft-yarn-repro
curl -sSLO https://raw.githubusercontent.com/LimeSurvey/LimeSurvey/2bcfc80760734c0339f08a4fec445f53ffcaaab5/assets/packages/adminbasics/yarn.lock

# It is a single, valid v1 lockfile:
grep -c '# yarn lockfile' yarn.lock      # => 1
grep -c '^  version "' yarn.lock          # => 745  (resolved packages)

# Syft only catalogs 118:
syft scan dir:. -o syft-json \
  | jq '[.artifacts[] | select(.type=="npm")] | length'          # => 118  (expected ~745)

# The first entry in the lockfile is dropped entirely:
syft scan dir:. -o syft-json \
  | jq -r '.artifacts[] | select(.type=="npm") | .name' \
  | grep -x '@ampproject/remapping'                               # => (empty)

Expected behavior

All ~745 resolved packages from the yarn.lock are cataloged (or, at minimum, a warning is emitted if some entries cannot be parsed).

Actual behavior

Only 118 npm packages are returned, silently. No error or warning is produced, even at -vv.

Additional diagnostics

  • Debug run (-vv) shows no parse errors/warnings for the lockfile.
  • Not a cataloger restriction: syft config --load reports default-catalogers: [] and select-catalogers: []; there is no .syft.yaml present.
  • The file is clean ASCII, no CRLF; version count and resolved count both equal 745.
  • Both scoped and unscoped entries are affected:
    • Survivors: 2 scoped + 116 unscoped = 118
    • Lockfile total: 163 scoped + 577 unscoped = 740 header lines (745 resolved versions).
  • Examples of packages kept: ansi-colors, arr-diff, base, cache-base, class-utils, collection-visit, color-convert, @babel/parser.
  • Examples of packages dropped: @ampproject/remapping, @babel/core, and most of @babel/*.
  • Scanning the directory alone (syft scan dir:.) reports foundBy = javascript-lock-cataloger with location /yarn.lock, confirming the yarn.lock is the source and the loss happens during parsing.

Impact

SBOMs generated from projects that use this (common) yarn.lock shape under-report dependencies by ~84%, silently breaking dependency inventory and downstream vulnerability scanning (e.g. Grype).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions