* fix(javascript): read every document of a pnpm-lock.yaml stream pnpm-lock.yaml can be a multi-document YAML stream. pnpm keeps config dependencies and the pinned package-manager version in a leading document and the project's dependency graph in the next one. That layout has shipped since pnpm 11 for projects using config dependencies, and pnpm 12 records the package-manager pin by default, so two documents is now the common case. The cataloger called yaml.Unmarshal, which reads the first document only. On such a lockfile the SBOM contains pnpm's own release binaries and none of the project's dependencies. Both documents declare the same lockfileVersion and the result is well-formed and non-empty, so nothing signals that it is wrong. Split the stream and parse each document, merging the results. A single-document lockfile yields exactly one document, so its behaviour is unchanged. A document that omits lockfileVersion falls back to the version from the first one rather than being dropped. Fixes #5168 Signed-off-by: hamodywe <iosapk.org@gmail.com> * refactor(javascript): stream pnpm-lock.yaml documents instead of buffering The multi-document fix read the whole lockfile, decoded it to a `yaml.Node` tree, re-marshaled every document back to `[]byte` and then re-parsed each one twice. `yaml.Node` already has a `Decode` method, so the decoder can walk the stream straight off the reader and hand each document's node to the parser. On a 4.8MB single-document lockfile that takes total allocations from 1069MB to 250MB, which is also below where things sat before multi-document support. It drops the `io.ReadAll` and its `noUnboundedReads` suppression, and puts pnpm in line with every other YAML cataloger in the tree, all of which already stream. `pnpmLockfileParser.Parse` now takes a `*yaml.Node` rather than `[]byte`. It is package-private with two implementations and one production call site. Documents accumulate into a single map keyed by `name@version`, so the stream follows one collision rule rather than two: the last entry to appear wins, which is what already happens within a document. That replaces the separate first-wins-with-fill-in merge pass. A conflicting integrity between documents is now traced rather than resolved silently. Three behaviour fixes come with it: - an empty or comment-only leading document no longer takes down the whole file. It decodes to a null node, not a zero-kind one, so the old guard never fired and the stream failed with `invalid lockfile version ""`. - a malformed document no longer discards the documents that already parsed. It is reported through `unknown` instead, matching how the rest of the cataloger reports partial results. - parse errors carry the document index, and their line numbers again point at the user's file rather than into a re-marshaled buffer. Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * chore(javascript): trim the duplicated pnpm multi-document comment The six-line explanation of why a pnpm lockfile can hold two documents sat verbatim in both the parser and its test. Keep it next to the code, where someone debugging will be, and leave the test pointing at it. Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> --------- Signed-off-by: hamodywe <iosapk.org@gmail.com> Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
Syft
A CLI tool and Go library for generating a Software Bill of Materials (SBOM) from container images and filesystems. Exceptional for vulnerability detection when used with a scanner like Grype.
Features
- Generates SBOMs for container images, filesystems, archives (see the docs for a full list of supported scan targets)
- Supports dozens of packaging ecosystems (e.g. Alpine (apk), Debian (dpkg), RPM, Go, Python, Java, JavaScript, Ruby, Rust, PHP, .NET, and many more)
- Supports OCI, Docker, Singularity, and more image formats
- Works seamlessly with Grype for vulnerability scanning
- Multiple output formats (CycloneDX, SPDX, Syft JSON, and more) including the ability to convert between SBOM formats
- Create signed SBOM attestations using the in-toto specification
Tip
New to Syft? Check out the Getting Started guide for a walkthrough!
Installation
The quickest way to get up and going:
curl -sSfL https://get.anchore.io/syft | sudo sh -s -- -b /usr/local/bin
Tip
See Installation docs for more ways to get Syft, including Homebrew, Docker, Scoop, Chocolatey, Nix, and more!
The basics
See the packages within a container image or directory:
# container image
syft alpine:latest
# directory
syft ./my-project
To get an SBOM, specify one or more output formats:
# SBOM to stdout
syft <image> -o cyclonedx-json
# Multiple SBOMs to files
syft <image> -o spdx-json=./spdx.json -o cyclonedx-json=./cdx.json
Tip
Check out the Getting Started guide to explore all of the capabilities and features.
Want to know all of the ins-and-outs of Syft? Check out the CLI docs, configuration docs, and JSON schema.
Contributing
We encourage users to help make these tools better by submitting issues when you find a bug or want a new feature. Check out our contributing overview and developer-specific documentation if you are interested in providing code contributions.
Syft development is sponsored by Anchore, and is released under the Apache-2.0 License.
The Syft logo by Anchore is licensed under CC BY 4.0
For commercial support options with Syft or Grype, please contact Anchore.
Come talk to us!
The Syft Team holds regular community meetings online. All are welcome to join to bring topics for discussion.
- Check the calendar for the next meeting date.
- Add items to the agenda (join this group for write access to the agenda)
- See you there!
