Repository navigation
Conversation
Signed-off-by: Eljees <3.14hell@gmail.com>
|
Ping — this has been open since 28 July with no review yet. CycloneDX 1.5+ carries component file locations in Unit tests, lint and static analysis are green on Happy to close it if you would rather fix #3880 differently. |
|
Adding the real-world case this was missing. The tests here are hand-written decoder units; what follows is a document produced by an unmodified third-party generator, which is the situation the change is actually for.
"components": [{
"name": "lodash", "version": "4.17.21", "purl": "pkg:npm/lodash@4.17.21",
"evidence": {
"identity": [{ "field": "purl", "confidence": 1, "concludedValue": "package-lock.json" }],
"occurrences": [{ "location": "src/index.js", "line": 1 }]
}
}]Feeding that document to So the file the generator recorded is dropped today, on a default invocation of a mainstream tool, at the current spec version (the document declares Housekeeping, since the branch was cut in August: it merges into current Happy to add the generated document as a testdata fixture if you would rather the regression be pinned to a real file than to the hand-written snippets. 🤖 Generated with Claude Code |
…dence-locations * origin/main: (238 commits) deps: bump brotli (anchore#5543) chore(deps): bump github.com/gpustack/gguf-parser-go (anchore#5541) chore(deps): bump github.com/moby/sys/mountinfo from 0.7.2 to 0.7.3 (anchore#5540) chore(deps): bump github.com/bmatcuk/doublestar/v4 from 4.10.3 to 4.10.4 (anchore#5537) chore(deps): bump github.com/gkampitakis/go-snaps from 0.5.24 to 0.5.25 (anchore#5539) chore(deps): bump golang.org/x/net from 0.61.0 to 0.62.0 (anchore#5538) chore(deps): bump go.yaml.in/yaml/v3 from 3.0.5 to 3.0.6 (anchore#5536) chore(deps): update anchore dependencies (anchore#5513) fix(installer): repair OpenSSL fallback in hash_sha256 (anchore#5521) feat(executable): capture GNU ELF build IDs (anchore#5426) perf: build lower layer squashes only when a scan reads them (anchore#5492) fix(terraform): generate NVD-style terraform_provider CPEs for terraform lock packages (anchore#5261) fix: keep dot-separated pre-release identifiers in Go ldflags versions (anchore#5422) fix: do not generate CPEs for msrc-kb packages (anchore#5510) chore(deps): update anchore dependencies (anchore#5479) chore(deps): update tool versions (anchore#5509) chore(deps): bump github.com/github/go-spdx/v2 from 2.7.1 to 2.8.0 (anchore#5502) chore(deps): bump github.com/go-jose/go-jose/v4 from 4.1.5 to 4.1.6 (anchore#5504) chore(deps): bump github.com/deitch/magic (anchore#5503) chore(deps): bump github.com/gpustack/gguf-parser-go (anchore#5500) ... Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
|
Looking at this one today. Apologies for the delay here |
…location Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
|
@Eljees thanks for this, and apologies for how long it sat without a review. I picked it up and pushed on top of your branch rather than ask you for another round to keep this moving. Added
Behavior changes
Open questionRunning cdxgen 12.8.4 and syft on the same one-dependency project:
Syft locations mean "what led to discovering this package", which is closer to cdxgen's Before merging
|
Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
Evidence occurrences are the home for package locations in CycloneDX. From spec 1.7 (the default) the syft:location properties are no longer written; documents pinned to 1.5 or 1.6 keep the properties alongside the occurrences, and documents older than 1.5 keep only the properties. Decoded occurrence paths are rooted, as file component names are, so a package location and the file component it names agree. Changelog: - CycloneDX 1.7 output (the default, or pinned to 1.7) no longer carries syft:location properties. Package locations are in evidence.occurrences, one per distinct path; the layer ID and the path within an archive are not written. - CycloneDX output pinned to 1.5 or 1.6 grows: each location path is written both as a syft:location property and as an evidence occurrence. - Decoding a CycloneDX document whose components have evidence occurrences now yields package locations. For components without a bom-ref this changes the derived package ID. Tests: occurrences of files within archives, rooting, package IDs with and without a bom-ref, and a format-level round trip per spec version. Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
An evidence occurrence only has a path, so with the syft:location
properties gone from spec 1.7 a file found in several layers decoded as
one location with no layer. Write an occurrence for each distinct set of
coordinates and state the layer and the full path through any archives
in its additionalContext ("layerID: <id>; fullPath: <path>"), which the
decoder reads back.
Documents older than 1.7 keep the syft:location properties, so their
occurrences stay one per distinct path with no additional context.
Changelog:
- CycloneDX 1.7 output (the default, or pinned to 1.7) no longer carries
syft:location properties. Package locations are in
evidence.occurrences, one per location, with the layer ID and the path
within an archive in additionalContext. Other syft properties are
unchanged.
- CycloneDX output pinned to 1.5 or 1.6 grows: each location path is
written both as a syft:location property and as an evidence occurrence.
- Decoding a CycloneDX document whose components have evidence
occurrences now yields package locations. For components without a
bom-ref this changes the derived package ID.
Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
cyclonedx-go writes the additionalContext of an evidence occurrence as an XML attribute, where the schema defines an element, so a CycloneDX 1.7 XML document that stated the layer there failed schema validation. An XML document of any spec version keeps the syft:location properties and writes one occurrence per distinct path, as documents older than 1.7 do. Changelog: - CycloneDX 1.7 JSON output (the default, or pinned to 1.7) no longer carries syft:location properties. Package locations are in evidence.occurrences, one per location, with the layer ID and the path within an archive in additionalContext. - CycloneDX XML output, and JSON output pinned to 1.5 or 1.6, grows: each location path is written both as a syft:location property and as an evidence occurrence. Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
Description
CycloneDX 1.5+ represents component file locations in the standard
evidence.occurrences[].locationfield. Syft only decoded its proprietarysyft:locationproperties, so locations from third-party CycloneDX BOMs were dropped during import.This change:
syft:locationproperties without changing backward compatibilityLocationSetType of change
Checklist
Issue references
Fixes #3880