mirror of
https://github.com/anchore/syft.git
synced 2026-11-01 06:56:40 +01:00
feat: Add the origin field to the output format of syftjson (#1327)
* moved the relevant fields to the Metadata field Signed-off-by: Asaf Greenholts <asaf@cidersecurity.io> * added metadata types Signed-off-by: Asaf Greenholts <asaf@cidersecurity.io> * Added hashes to metadata of packge-lock.json and Pipfile.lock Signed-off-by: Asaf Greenholts <asaf@cidersecurity.io> * move package metadata types to "pkg" package Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * re-generate json schema to include new npm, python, and binary metadatas Signed-off-by: Alex Goodman <alex.goodman@anchore.com> Signed-off-by: Asaf Greenholts <asaf@cidersecurity.io> Signed-off-by: Alex Goodman <alex.goodman@anchore.com> Co-authored-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
co-authored by
Alex Goodman
parent
85bddaa43d
commit
260cb4c72d
+26
-19
@@ -27,26 +27,33 @@ can be extended to include specific package metadata struct shapes in the future
|
||||
// This should represent all possible metadatas represented in the pkg.Package.Metadata field (an interface{}).
|
||||
// When a new package metadata definition is created it will need to be manually added here. The variable name does
|
||||
// not matter as long as it is exported.
|
||||
|
||||
// TODO: this should be generated from reflection of whats in the pkg package
|
||||
type artifactMetadataContainer struct {
|
||||
Apk pkg.ApkMetadata
|
||||
Alpm pkg.AlpmMetadata
|
||||
Dpkg pkg.DpkgMetadata
|
||||
Gem pkg.GemMetadata
|
||||
Java pkg.JavaMetadata
|
||||
Npm pkg.NpmPackageJSONMetadata
|
||||
Python pkg.PythonPackageMetadata
|
||||
Rpm pkg.RpmMetadata
|
||||
Cargo pkg.CargoPackageMetadata
|
||||
Go pkg.GolangMetadata
|
||||
Php pkg.PhpComposerJSONMetadata
|
||||
Dart pkg.DartPubMetadata
|
||||
Dotnet pkg.DotnetDepsMetadata
|
||||
Portage pkg.PortageMetadata
|
||||
Conan pkg.ConanMetadata
|
||||
ConanLock pkg.ConanLockMetadata
|
||||
KbPackage pkg.KbPackageMetadata
|
||||
Hackage pkg.HackageMetadata
|
||||
SwiftCocopods pkg.CocoapodsMetadata
|
||||
Alpm pkg.AlpmMetadata
|
||||
Apk pkg.ApkMetadata
|
||||
Binary pkg.BinaryMetadata
|
||||
Cocopods pkg.CocoapodsMetadata
|
||||
Conan pkg.ConanMetadata
|
||||
ConanLock pkg.ConanLockMetadata
|
||||
Dart pkg.DartPubMetadata
|
||||
Dotnet pkg.DotnetDepsMetadata
|
||||
Dpkg pkg.DpkgMetadata
|
||||
Gem pkg.GemMetadata
|
||||
Go pkg.GolangMetadata
|
||||
Hackage pkg.HackageMetadata
|
||||
Java pkg.JavaMetadata
|
||||
KbPackage pkg.KbPackageMetadata
|
||||
NpmPackage pkg.NpmPackageJSONMetadata
|
||||
NpmPackageLock pkg.NpmPackageLockJSONMetadata
|
||||
MixLock pkg.MixLockMetadata
|
||||
Php pkg.PhpComposerJSONMetadata
|
||||
Portage pkg.PortageMetadata
|
||||
PythonPackage pkg.PythonPackageMetadata
|
||||
PythonPipfilelock pkg.PythonPipfileLockMetadata
|
||||
Rebar pkg.RebarLockMetadata
|
||||
Rpm pkg.RpmMetadata
|
||||
RustCargo pkg.CargoPackageMetadata
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -200,6 +200,25 @@
|
||||
"files"
|
||||
]
|
||||
},
|
||||
"BinaryMetadata": {
|
||||
"properties": {
|
||||
"classifier": {
|
||||
"type": "string"
|
||||
},
|
||||
"realPath": {
|
||||
"type": "string"
|
||||
},
|
||||
"virtualPath": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"required": [
|
||||
"classifier",
|
||||
"realPath",
|
||||
"virtualPath"
|
||||
]
|
||||
},
|
||||
"CargoPackageMetadata": {
|
||||
"properties": {
|
||||
"name": {
|
||||
@@ -766,6 +785,29 @@
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"MixLockMetadata": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
},
|
||||
"pkgHash": {
|
||||
"type": "string"
|
||||
},
|
||||
"pkgHashExt": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"version",
|
||||
"pkgHash",
|
||||
"pkgHashExt"
|
||||
]
|
||||
},
|
||||
"NpmPackageJSONMetadata": {
|
||||
"properties": {
|
||||
"name": {
|
||||
@@ -814,6 +856,21 @@
|
||||
"private"
|
||||
]
|
||||
},
|
||||
"NpmPackageLockJSONMetadata": {
|
||||
"properties": {
|
||||
"resolved": {
|
||||
"type": "string"
|
||||
},
|
||||
"integrity": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"required": [
|
||||
"resolved",
|
||||
"integrity"
|
||||
]
|
||||
},
|
||||
"Package": {
|
||||
"properties": {
|
||||
"id": {
|
||||
@@ -869,6 +926,9 @@
|
||||
{
|
||||
"$ref": "#/$defs/ApkMetadata"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/BinaryMetadata"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/CargoPackageMetadata"
|
||||
},
|
||||
@@ -905,9 +965,15 @@
|
||||
{
|
||||
"$ref": "#/$defs/KbPackageMetadata"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/MixLockMetadata"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/NpmPackageJSONMetadata"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/NpmPackageLockJSONMetadata"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/PhpComposerJSONMetadata"
|
||||
},
|
||||
@@ -917,6 +983,12 @@
|
||||
{
|
||||
"$ref": "#/$defs/PythonPackageMetadata"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/PythonPipfileLockMetadata"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/RebarLockMetadata"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/RpmMetadata"
|
||||
}
|
||||
@@ -1291,6 +1363,47 @@
|
||||
"sitePackagesRootPath"
|
||||
]
|
||||
},
|
||||
"PythonPipfileLockMetadata": {
|
||||
"properties": {
|
||||
"hashes": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"index": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"required": [
|
||||
"hashes",
|
||||
"index"
|
||||
]
|
||||
},
|
||||
"RebarLockMetadata": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
},
|
||||
"pkgHash": {
|
||||
"type": "string"
|
||||
},
|
||||
"pkgHashExt": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"version",
|
||||
"pkgHash",
|
||||
"pkgHashExt"
|
||||
]
|
||||
},
|
||||
"Relationship": {
|
||||
"properties": {
|
||||
"parent": {
|
||||
|
||||
Reference in New Issue
Block a user