mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 08:23:15 +01:00
Add accessPath on Location objects to syft-json output (#2287)
* add accessPath on Location objects to syft-json output Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * generate json schema v12.0.1 Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> --------- Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
parent
dc14dbb326
commit
502971a1b2
@ -3,5 +3,5 @@ package internal
|
|||||||
const (
|
const (
|
||||||
// JSONSchemaVersion is the current schema version output by the JSON encoder
|
// JSONSchemaVersion is the current schema version output by the JSON encoder
|
||||||
// This is roughly following the "SchemaVer" guidelines for versioning the JSON schema. Please see schema/json/README.md for details on how to increment.
|
// This is roughly following the "SchemaVer" guidelines for versioning the JSON schema. Please see schema/json/README.md for details on how to increment.
|
||||||
JSONSchemaVersion = "12.0.0"
|
JSONSchemaVersion = "12.0.1"
|
||||||
)
|
)
|
||||||
|
|||||||
2204
schema/json/schema-12.0.1.json
Normal file
2204
schema/json/schema-12.0.1.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -20,8 +20,8 @@ type LocationData struct {
|
|||||||
Coordinates `cyclonedx:""` // Empty string here means there is no intermediate property name, e.g. syft:locations:0:path without "coordinates"
|
Coordinates `cyclonedx:""` // Empty string here means there is no intermediate property name, e.g. syft:locations:0:path without "coordinates"
|
||||||
// note: it is IMPORTANT to ignore anything but the coordinates for a Location when considering the ID (hash value)
|
// note: it is IMPORTANT to ignore anything but the coordinates for a Location when considering the ID (hash value)
|
||||||
// since the coordinates are the minimally correct ID for a location (symlinks should not come into play)
|
// since the coordinates are the minimally correct ID for a location (symlinks should not come into play)
|
||||||
VirtualPath string `hash:"ignore" json:"-"` // The path to the file which may or may not have hardlinks / symlinks
|
VirtualPath string `hash:"ignore" json:"accessPath"` // The path to the file which may or may not have hardlinks / symlinks
|
||||||
ref file.Reference `hash:"ignore"` // The file reference relative to the stereoscope.FileCatalog that has more information about this location.
|
ref file.Reference `hash:"ignore"` // The file reference relative to the stereoscope.FileCatalog that has more information about this location.
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l LocationData) Reference() file.Reference {
|
func (l LocationData) Reference() file.Reference {
|
||||||
@ -179,7 +179,7 @@ func (l Location) String() string {
|
|||||||
|
|
||||||
str += fmt.Sprintf("RealPath=%q", l.RealPath)
|
str += fmt.Sprintf("RealPath=%q", l.RealPath)
|
||||||
|
|
||||||
if l.VirtualPath != "" {
|
if l.VirtualPath != "" && l.VirtualPath != l.RealPath {
|
||||||
str += fmt.Sprintf(" VirtualPath=%q", l.VirtualPath)
|
str += fmt.Sprintf(" VirtualPath=%q", l.VirtualPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -117,7 +117,7 @@ func TestEncodeFullJSONDocument(t *testing.T) {
|
|||||||
Artifacts: sbom.Artifacts{
|
Artifacts: sbom.Artifacts{
|
||||||
Packages: catalog,
|
Packages: catalog,
|
||||||
FileMetadata: map[file.Coordinates]file.Metadata{
|
FileMetadata: map[file.Coordinates]file.Metadata{
|
||||||
file.NewLocation("/a/place").Coordinates: {
|
file.NewVirtualLocation("/a/place", "/a/symlink/to/place").Coordinates: {
|
||||||
FileInfo: stereoFile.ManualInfo{
|
FileInfo: stereoFile.ManualInfo{
|
||||||
NameValue: "/a/place",
|
NameValue: "/a/place",
|
||||||
ModeValue: 0775,
|
ModeValue: 0775,
|
||||||
|
|||||||
@ -8,7 +8,8 @@
|
|||||||
"foundBy": "the-cataloger-1",
|
"foundBy": "the-cataloger-1",
|
||||||
"locations": [
|
"locations": [
|
||||||
{
|
{
|
||||||
"path": "/some/path/pkg1"
|
"path": "/some/path/pkg1",
|
||||||
|
"accessPath": "/some/path/pkg1"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"licenses": [
|
"licenses": [
|
||||||
@ -48,7 +49,8 @@
|
|||||||
"foundBy": "the-cataloger-2",
|
"foundBy": "the-cataloger-2",
|
||||||
"locations": [
|
"locations": [
|
||||||
{
|
{
|
||||||
"path": "/some/path/pkg1"
|
"path": "/some/path/pkg1",
|
||||||
|
"accessPath": "/some/path/pkg1"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"licenses": [],
|
"licenses": [],
|
||||||
|
|||||||
@ -8,7 +8,8 @@
|
|||||||
"foundBy": "the-cataloger-1",
|
"foundBy": "the-cataloger-1",
|
||||||
"locations": [
|
"locations": [
|
||||||
{
|
{
|
||||||
"path": "/a/place/a"
|
"path": "/a/place/a",
|
||||||
|
"accessPath": "/a/place/a"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"licenses": [
|
"licenses": [
|
||||||
@ -43,7 +44,8 @@
|
|||||||
"foundBy": "the-cataloger-2",
|
"foundBy": "the-cataloger-2",
|
||||||
"locations": [
|
"locations": [
|
||||||
{
|
{
|
||||||
"path": "/b/place/b"
|
"path": "/b/place/b",
|
||||||
|
"accessPath": "/b/place/b"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"licenses": [],
|
"licenses": [],
|
||||||
|
|||||||
@ -9,7 +9,8 @@
|
|||||||
"locations": [
|
"locations": [
|
||||||
{
|
{
|
||||||
"path": "/somefile-1.txt",
|
"path": "/somefile-1.txt",
|
||||||
"layerID": "sha256:100d5a55f9032faead28b7427fa3e650e4f0158f86ea89d06e1489df00cb8c6f"
|
"layerID": "sha256:100d5a55f9032faead28b7427fa3e650e4f0158f86ea89d06e1489df00cb8c6f",
|
||||||
|
"accessPath": "/somefile-1.txt"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"licenses": [
|
"licenses": [
|
||||||
@ -45,7 +46,8 @@
|
|||||||
"locations": [
|
"locations": [
|
||||||
{
|
{
|
||||||
"path": "/somefile-2.txt",
|
"path": "/somefile-2.txt",
|
||||||
"layerID": "sha256:000fb9200890d3a19138478b20023023c0dce1c54352007c2863716780f049eb"
|
"layerID": "sha256:000fb9200890d3a19138478b20023023c0dce1c54352007c2863716780f049eb",
|
||||||
|
"accessPath": "/somefile-2.txt"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"licenses": [],
|
"licenses": [],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user