From d7875ca014beed0cdcbb46bf7d4f9e8d4c349e5f Mon Sep 17 00:00:00 2001 From: Alex Goodman Date: Tue, 9 Dec 2025 11:31:48 -0500 Subject: [PATCH] add file-based toolchain detection Signed-off-by: Alex Goodman --- cmd/syft/internal/options/catalog.go | 22 +- cmd/syft/internal/options/file.go | 2 +- internal/constants.go | 3 +- schema/json/schema-16.1.11.json | 4603 +++++++++++++++++ schema/json/schema-latest.json | 30 +- syft/file/cataloger/executable/cataloger.go | 95 +- syft/file/cataloger/executable/elf.go | 45 + syft/file/cataloger/executable/elf_test.go | 71 + syft/file/cataloger/executable/macho.go | 8 + syft/file/cataloger/executable/macho_test.go | 36 + syft/file/cataloger/executable/pe.go | 7 + syft/file/cataloger/executable/pe_test.go | 37 + .../cataloger/executable/testdata/.gitignore | 3 +- .../executable/testdata/golang/Dockerfile | 18 + .../executable/testdata/golang/Makefile | 42 + .../executable/testdata/golang/cgo_main.go | 18 + .../executable/testdata/golang/go.mod | 8 + .../executable/testdata/golang/go.sum | 4 + .../executable/testdata/golang/main.go | 28 + .../executable/testdata/toolchains/.gitignore | 3 + .../executable/testdata/toolchains/Makefile | 39 + .../testdata/toolchains/clang/Dockerfile | 6 + .../testdata/toolchains/clang/Makefile | 39 + .../toolchains/clang/project/Makefile | 9 + .../testdata/toolchains/clang/project/hello.c | 6 + .../testdata/toolchains/fortran/Dockerfile | 1 + .../testdata/toolchains/fortran/Makefile | 39 + .../toolchains/fortran/project/Makefile | 9 + .../toolchains/fortran/project/hello.f90 | 3 + .../testdata/toolchains/gcc/Dockerfile | 1 + .../testdata/toolchains/gcc/Makefile | 39 + .../testdata/toolchains/gcc/project/Makefile | 9 + .../testdata/toolchains/gcc/project/hello.c | 6 + .../testdata/toolchains/gccgo/Dockerfile | 3 + .../testdata/toolchains/gccgo/Makefile | 39 + .../toolchains/gccgo/project/Makefile | 9 + .../toolchains/gccgo/project/hello.go | 5 + .../testdata/toolchains/gdc/Dockerfile | 3 + .../testdata/toolchains/gdc/Makefile | 39 + .../testdata/toolchains/gdc/project/Makefile | 9 + .../testdata/toolchains/gdc/project/hello.d | 5 + .../testdata/toolchains/gnat/Dockerfile | 3 + .../testdata/toolchains/gnat/Makefile | 39 + .../testdata/toolchains/gnat/project/Makefile | 9 + .../toolchains/gnat/project/hello.adb | 6 + .../toolchains/gnat/project/hello.ali | 51 + .../testdata/toolchains/gnat/project/hello.o | Bin 0 -> 1464 bytes .../testdata/toolchains/gold/Dockerfile | 3 + .../testdata/toolchains/gold/Makefile | 39 + .../testdata/toolchains/gold/project/Makefile | 9 + .../testdata/toolchains/gold/project/hello.c | 6 + .../testdata/toolchains/lld/Dockerfile | 6 + .../testdata/toolchains/lld/Makefile | 39 + .../testdata/toolchains/lld/project/Makefile | 9 + .../testdata/toolchains/lld/project/hello.c | 6 + .../testdata/toolchains/mold/Dockerfile | 3 + .../testdata/toolchains/mold/Makefile | 39 + .../testdata/toolchains/mold/project/Makefile | 9 + .../testdata/toolchains/mold/project/hello.c | 6 + .../testdata/toolchains/rust/Dockerfile | 1 + .../testdata/toolchains/rust/Makefile | 39 + .../testdata/toolchains/rust/project/Makefile | 9 + .../testdata/toolchains/rust/project/hello.rs | 3 + syft/file/cataloger/executable/toolchains.go | 248 + .../cataloger/executable/toolchains_test.go | 223 + syft/file/executable.go | 21 + 66 files changed, 6163 insertions(+), 64 deletions(-) create mode 100644 schema/json/schema-16.1.11.json create mode 100644 syft/file/cataloger/executable/testdata/golang/Dockerfile create mode 100644 syft/file/cataloger/executable/testdata/golang/Makefile create mode 100644 syft/file/cataloger/executable/testdata/golang/cgo_main.go create mode 100644 syft/file/cataloger/executable/testdata/golang/go.mod create mode 100644 syft/file/cataloger/executable/testdata/golang/go.sum create mode 100644 syft/file/cataloger/executable/testdata/golang/main.go create mode 100644 syft/file/cataloger/executable/testdata/toolchains/.gitignore create mode 100644 syft/file/cataloger/executable/testdata/toolchains/Makefile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/clang/Dockerfile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/clang/Makefile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/clang/project/Makefile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/clang/project/hello.c create mode 100644 syft/file/cataloger/executable/testdata/toolchains/fortran/Dockerfile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/fortran/Makefile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/fortran/project/Makefile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/fortran/project/hello.f90 create mode 100644 syft/file/cataloger/executable/testdata/toolchains/gcc/Dockerfile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/gcc/Makefile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/gcc/project/Makefile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/gcc/project/hello.c create mode 100644 syft/file/cataloger/executable/testdata/toolchains/gccgo/Dockerfile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/gccgo/Makefile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/gccgo/project/Makefile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/gccgo/project/hello.go create mode 100644 syft/file/cataloger/executable/testdata/toolchains/gdc/Dockerfile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/gdc/Makefile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/gdc/project/Makefile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/gdc/project/hello.d create mode 100644 syft/file/cataloger/executable/testdata/toolchains/gnat/Dockerfile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/gnat/Makefile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/gnat/project/Makefile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/gnat/project/hello.adb create mode 100644 syft/file/cataloger/executable/testdata/toolchains/gnat/project/hello.ali create mode 100644 syft/file/cataloger/executable/testdata/toolchains/gnat/project/hello.o create mode 100644 syft/file/cataloger/executable/testdata/toolchains/gold/Dockerfile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/gold/Makefile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/gold/project/Makefile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/gold/project/hello.c create mode 100644 syft/file/cataloger/executable/testdata/toolchains/lld/Dockerfile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/lld/Makefile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/lld/project/Makefile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/lld/project/hello.c create mode 100644 syft/file/cataloger/executable/testdata/toolchains/mold/Dockerfile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/mold/Makefile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/mold/project/Makefile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/mold/project/hello.c create mode 100644 syft/file/cataloger/executable/testdata/toolchains/rust/Dockerfile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/rust/Makefile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/rust/project/Makefile create mode 100644 syft/file/cataloger/executable/testdata/toolchains/rust/project/hello.rs create mode 100644 syft/file/cataloger/executable/toolchains.go create mode 100644 syft/file/cataloger/executable/toolchains_test.go diff --git a/cmd/syft/internal/options/catalog.go b/cmd/syft/internal/options/catalog.go index 3ff68ecbd..e34c1cd48 100644 --- a/cmd/syft/internal/options/catalog.go +++ b/cmd/syft/internal/options/catalog.go @@ -17,8 +17,6 @@ import ( "github.com/anchore/syft/syft/cataloging" "github.com/anchore/syft/syft/cataloging/filecataloging" "github.com/anchore/syft/syft/cataloging/pkgcataloging" - "github.com/anchore/syft/syft/file/cataloger/executable" - "github.com/anchore/syft/syft/file/cataloger/filecontent" "github.com/anchore/syft/syft/pkg/cataloger/binary" "github.com/anchore/syft/syft/pkg/cataloger/cpp" "github.com/anchore/syft/syft/pkg/cataloger/dotnet" @@ -147,18 +145,14 @@ func (cfg Catalog) ToFilesConfig() filecataloging.Config { log.WithFields("error", err).Warn("unable to configure file hashers") } - return filecataloging.Config{ - Selection: cfg.File.Metadata.Selection, - Hashers: hashers, - Content: filecontent.Config{ - Globs: cfg.File.Content.Globs, - SkipFilesAboveSize: cfg.File.Content.SkipFilesAboveSize, - }, - Executable: executable.Config{ - MIMETypes: executable.DefaultConfig().MIMETypes, - Globs: cfg.File.Executable.Globs, - }, - } + c := filecataloging.DefaultConfig() + c.Selection = cfg.File.Metadata.Selection + c.Hashers = hashers + c.Content.Globs = cfg.File.Content.Globs + c.Content.SkipFilesAboveSize = cfg.File.Content.SkipFilesAboveSize + c.Executable.Globs = cfg.File.Executable.Globs + + return c } func (cfg Catalog) ToLicenseConfig() cataloging.LicenseConfig { diff --git a/cmd/syft/internal/options/file.go b/cmd/syft/internal/options/file.go index 6ac9c8d2b..de12a93d5 100644 --- a/cmd/syft/internal/options/file.go +++ b/cmd/syft/internal/options/file.go @@ -64,7 +64,7 @@ func (c *fileConfig) PostLoad() error { } func (c *fileConfig) DescribeFields(descriptions clio.FieldDescriptionSet) { - descriptions.Add(&c.Metadata.Selection, `select which files should be captured by the file-metadata cataloger and included in the SBOM. + descriptions.Add(&c.Metadata.Selection, `select which files should be captured by the file-metadata cataloger and included in the SBOM. Options include: - "all": capture all files from the search space - "owned-by-package": capture only files owned by packages diff --git a/internal/constants.go b/internal/constants.go index 4aa1849d3..848f4da1d 100644 --- a/internal/constants.go +++ b/internal/constants.go @@ -3,7 +3,7 @@ package internal const ( // 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. - JSONSchemaVersion = "16.1.10" + JSONSchemaVersion = "16.1.11" // Changelog // 16.1.0 - reformulated the python pdm fields (added "URL" and removed the unused "path" field). @@ -17,4 +17,5 @@ const ( // 16.1.8 - add VcpkgManifest metadata type for vcpkg manifest support // 16.1.9 - add Symbols (grouped by owning package import path) to GolangBinaryBuildinfoEntry metadata // 16.1.10 - add SafeTensorsModelInfo metadata type for the safetensors AI model cataloger + // 16.1.11 - add file executable toolchain information ) diff --git a/schema/json/schema-16.1.11.json b/schema/json/schema-16.1.11.json new file mode 100644 index 000000000..e0262493d --- /dev/null +++ b/schema/json/schema-16.1.11.json @@ -0,0 +1,4603 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "anchore.io/schema/syft/json/16.1.11/document", + "$ref": "#/$defs/Document", + "$defs": { + "AlpmDbEntry": { + "properties": { + "basepackage": { + "type": "string", + "description": "BasePackage is the base package name this package was built from (source package in Arch build system)" + }, + "package": { + "type": "string", + "description": "Package is the package name as found in the desc file" + }, + "version": { + "type": "string", + "description": "Version is the package version as found in the desc file" + }, + "description": { + "type": "string", + "description": "Description is a human-readable package description" + }, + "architecture": { + "type": "string", + "description": "Architecture is the target CPU architecture as defined in Arch architecture spec (e.g. x86_64, aarch64, or \"any\" for arch-independent packages)" + }, + "size": { + "type": "integer", + "description": "Size is the installed size in bytes" + }, + "packager": { + "type": "string", + "description": "Packager is the name and email of the person who packaged this (RFC822 format)" + }, + "url": { + "type": "string", + "description": "URL is the upstream project URL" + }, + "validation": { + "type": "string", + "description": "Validation is the validation method used for package integrity (e.g. pgp signature, sha256 checksum)" + }, + "reason": { + "type": "integer", + "description": "Reason is the installation reason tracked by pacman (0=explicitly installed by user, 1=installed as dependency)" + }, + "files": { + "items": { + "$ref": "#/$defs/AlpmFileRecord" + }, + "type": "array", + "description": "Files are the files installed by this package" + }, + "backup": { + "items": { + "$ref": "#/$defs/AlpmFileRecord" + }, + "type": "array", + "description": "Backup is the list of configuration files that pacman backs up before upgrades" + }, + "provides": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Provides are virtual packages provided by this package (allows other packages to depend on capabilities rather than specific packages)" + }, + "depends": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Depends are the runtime dependencies required by this package" + } + }, + "type": "object", + "required": [ + "basepackage", + "package", + "version", + "description", + "architecture", + "size", + "packager", + "url", + "validation", + "reason", + "files", + "backup" + ], + "description": "AlpmDBEntry is a struct that represents the package data stored in the pacman flat-file stores for arch linux." + }, + "AlpmFileRecord": { + "properties": { + "path": { + "type": "string", + "description": "Path is the file path relative to the filesystem root" + }, + "type": { + "type": "string", + "description": "Type is the file type (e.g. regular file, directory, symlink)" + }, + "uid": { + "type": "string", + "description": "UID is the file owner user ID as recorded by pacman" + }, + "gid": { + "type": "string", + "description": "GID is the file owner group ID as recorded by pacman" + }, + "time": { + "type": "string", + "format": "date-time", + "description": "Time is the file modification timestamp" + }, + "size": { + "type": "string", + "description": "Size is the file size in bytes" + }, + "link": { + "type": "string", + "description": "Link is the symlink target path if this is a symlink" + }, + "digest": { + "items": { + "$ref": "#/$defs/Digest" + }, + "type": "array", + "description": "Digests contains file content hashes for integrity verification" + } + }, + "type": "object", + "description": "AlpmFileRecord represents a single file entry within an Arch Linux package with its associated metadata tracked by pacman." + }, + "ApkDbEntry": { + "properties": { + "package": { + "type": "string", + "description": "Package is the package name as found in the installed file" + }, + "originPackage": { + "type": "string", + "description": "OriginPackage is the original source package name this binary was built from (used to track which aport/source built this)" + }, + "maintainer": { + "type": "string", + "description": "Maintainer is the package maintainer name and email" + }, + "version": { + "type": "string", + "description": "Version is the package version as found in the installed file" + }, + "architecture": { + "type": "string", + "description": "Architecture is the target CPU architecture" + }, + "url": { + "type": "string", + "description": "URL is the upstream project URL" + }, + "description": { + "type": "string", + "description": "Description is a human-readable package description" + }, + "size": { + "type": "integer", + "description": "Size is the package archive size in bytes (.apk file size)" + }, + "installedSize": { + "type": "integer", + "description": "InstalledSize is the total size of installed files in bytes" + }, + "pullDependencies": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Dependencies are the runtime dependencies required by this package" + }, + "provides": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Provides are virtual packages provided by this package (for capability-based dependencies)" + }, + "pullChecksum": { + "type": "string", + "description": "Checksum is the package content checksum for integrity verification" + }, + "gitCommitOfApkPort": { + "type": "string", + "description": "GitCommit is the git commit hash of the APK port definition in Alpine's aports repository" + }, + "files": { + "items": { + "$ref": "#/$defs/ApkFileRecord" + }, + "type": "array", + "description": "Files are the files installed by this package" + } + }, + "type": "object", + "required": [ + "package", + "originPackage", + "maintainer", + "version", + "architecture", + "url", + "description", + "size", + "installedSize", + "pullDependencies", + "provides", + "pullChecksum", + "gitCommitOfApkPort", + "files" + ], + "description": "ApkDBEntry represents all captured data for the alpine linux package manager flat-file store." + }, + "ApkFileRecord": { + "properties": { + "path": { + "type": "string", + "description": "Path is the file path relative to the filesystem root" + }, + "ownerUid": { + "type": "string", + "description": "OwnerUID is the file owner user ID" + }, + "ownerGid": { + "type": "string", + "description": "OwnerGID is the file owner group ID" + }, + "permissions": { + "type": "string", + "description": "Permissions is the file permission mode string (e.g. \"0755\", \"0644\")" + }, + "digest": { + "$ref": "#/$defs/Digest", + "description": "Digest is the file content hash for integrity verification" + } + }, + "type": "object", + "required": [ + "path" + ], + "description": "ApkFileRecord represents a single file listing and metadata from a APK DB entry (which may have many of these file records)." + }, + "AppleAppBundleEntry": { + "properties": { + "bundleIdentifier": { + "type": "string", + "description": "BundleIdentifier is the unique identifier for the bundle (e.g. \"com.apple.Safari\")" + }, + "name": { + "type": "string", + "description": "Name is the short name of the bundle" + }, + "displayName": { + "type": "string", + "description": "DisplayName is the user-facing name of the bundle" + }, + "executable": { + "type": "string", + "description": "Executable is the name of the executable within the bundle" + }, + "shortVersion": { + "type": "string", + "description": "ShortVersion is the release (marketing) version of the bundle" + }, + "version": { + "type": "string", + "description": "Version is the build version of the bundle, which often differs from the short version" + }, + "packageType": { + "type": "string", + "description": "PackageType is the four-letter type code (e.g. \"APPL\" for apps, \"FMWK\" for frameworks, \"BNDL\" for bundles)" + }, + "supportedPlatforms": { + "items": { + "type": "string" + }, + "type": "array", + "description": "SupportedPlatforms lists the platforms the bundle targets (e.g. \"MacOSX\", \"iPhoneOS\")" + }, + "minimumSystemVersion": { + "type": "string", + "description": "MinimumSystemVersion is the minimum macOS version required to run the bundle" + }, + "minimumOSVersion": { + "type": "string", + "description": "MinimumOSVersion is the minimum OS version required for non-macOS platforms (e.g. iOS)" + }, + "copyright": { + "type": "string", + "description": "Copyright is the human-readable copyright notice for the bundle" + }, + "platformName": { + "type": "string", + "description": "PlatformName is the platform name of the SDK used to build the bundle (e.g. \"macosx\")" + }, + "sdkName": { + "type": "string", + "description": "SDKName is the name of the SDK used to build the bundle (e.g. \"macosx14.0\")" + } + }, + "type": "object", + "description": "AppleAppBundleEntry represents metadata about an Apple application bundle (CFBundle) extracted from Info.plist files." + }, + "BinarySignature": { + "properties": { + "matches": { + "items": { + "$ref": "#/$defs/ClassifierMatch" + }, + "type": "array" + } + }, + "type": "object", + "required": [ + "matches" + ], + "description": "BinarySignature represents a set of matched values within a binary file." + }, + "BitnamiSbomEntry": { + "properties": { + "name": { + "type": "string", + "description": "Name is the package name as found in the Bitnami SPDX file" + }, + "arch": { + "type": "string", + "description": "Architecture is the target CPU architecture (amd64 or arm64 in Bitnami images)" + }, + "distro": { + "type": "string", + "description": "Distro is the distribution name this package is for (base OS like debian, ubuntu, etc.)" + }, + "revision": { + "type": "string", + "description": "Revision is the Bitnami-specific package revision number (incremented for Bitnami rebuilds of same upstream version)" + }, + "version": { + "type": "string", + "description": "Version is the package version as found in the Bitnami SPDX file" + }, + "path": { + "type": "string", + "description": "Path is the installation path in the filesystem where the package is located" + }, + "files": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Files are the file paths owned by this package (tracked via SPDX relationships)" + } + }, + "type": "object", + "required": [ + "name", + "arch", + "distro", + "revision", + "version", + "path", + "files" + ], + "description": "BitnamiSBOMEntry represents all captured data from Bitnami packages described in Bitnami' SPDX files." + }, + "CConanFileEntry": { + "properties": { + "ref": { + "type": "string", + "description": "Ref is the package reference string in format name/version@user/channel" + } + }, + "type": "object", + "required": [ + "ref" + ], + "description": "ConanfileEntry represents a single \"Requires\" entry from a conanfile.txt." + }, + "CConanInfoEntry": { + "properties": { + "ref": { + "type": "string", + "description": "Ref is the package reference string in format name/version@user/channel" + }, + "package_id": { + "type": "string", + "description": "PackageID is a unique package variant identifier" + } + }, + "type": "object", + "required": [ + "ref" + ], + "description": "ConaninfoEntry represents a single \"full_requires\" entry from a conaninfo.txt." + }, + "CConanLockEntry": { + "properties": { + "ref": { + "type": "string", + "description": "Ref is the package reference string in format name/version@user/channel" + }, + "package_id": { + "type": "string", + "description": "PackageID is a unique package variant identifier computed from settings/options (static hash in Conan 1.x, can have collisions with complex dependency graphs)" + }, + "prev": { + "type": "string", + "description": "Prev is the previous lock entry reference for versioning" + }, + "requires": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Requires are the runtime package dependencies" + }, + "build_requires": { + "items": { + "type": "string" + }, + "type": "array", + "description": "BuildRequires are the build-time dependencies (e.g. cmake, compilers)" + }, + "py_requires": { + "items": { + "type": "string" + }, + "type": "array", + "description": "PythonRequires are the Python dependencies needed for Conan recipes" + }, + "options": { + "$ref": "#/$defs/KeyValues", + "description": "Options are package configuration options as key-value pairs (e.g. shared=True, fPIC=True)" + }, + "path": { + "type": "string", + "description": "Path is the filesystem path to the package in Conan cache" + }, + "context": { + "type": "string", + "description": "Context is the build context information" + } + }, + "type": "object", + "required": [ + "ref" + ], + "description": "ConanV1LockEntry represents a single \"node\" entry from a conan.lock V1 file." + }, + "CConanLockV2Entry": { + "properties": { + "ref": { + "type": "string", + "description": "Ref is the package reference string in format name/version@user/channel" + }, + "packageID": { + "type": "string", + "description": "PackageID is a unique package variant identifier (dynamic in Conan 2.0, more accurate than V1)" + }, + "username": { + "type": "string", + "description": "Username is the Conan user/organization name" + }, + "channel": { + "type": "string", + "description": "Channel is the Conan channel name indicating stability/purpose (e.g. stable, testing, experimental)" + }, + "recipeRevision": { + "type": "string", + "description": "RecipeRevision is a git-like revision hash (RREV) of the recipe" + }, + "packageRevision": { + "type": "string", + "description": "PackageRevision is a git-like revision hash of the built binary package" + }, + "timestamp": { + "type": "string", + "description": "TimeStamp is when this package was built/locked" + } + }, + "type": "object", + "required": [ + "ref" + ], + "description": "ConanV2LockEntry represents a single \"node\" entry from a conan.lock V2 file." + }, + "CPE": { + "properties": { + "cpe": { + "type": "string", + "description": "Value is the CPE string identifier." + }, + "source": { + "type": "string", + "description": "Source is the source where this CPE was obtained or generated from." + } + }, + "type": "object", + "required": [ + "cpe" + ], + "description": "CPE represents a Common Platform Enumeration identifier used for matching packages to known vulnerabilities in security databases." + }, + "ClassifierMatch": { + "properties": { + "classifier": { + "type": "string" + }, + "location": { + "$ref": "#/$defs/Location" + } + }, + "type": "object", + "required": [ + "classifier", + "location" + ], + "description": "ClassifierMatch represents a single matched value within a binary file and the \"class\" name the search pattern represents." + }, + "CocoaPodfileLockEntry": { + "properties": { + "checksum": { + "type": "string", + "description": "Checksum is the SHA-1 hash of the podspec file for integrity verification (generated via `pod ipc spec ... | openssl sha1`), ensuring all team members use the same pod specification version" + } + }, + "type": "object", + "required": [ + "checksum" + ], + "description": "CocoaPodfileLockEntry represents a single entry from the \"Pods\" section of a Podfile.lock file." + }, + "CondaLink": { + "properties": { + "source": { + "type": "string", + "description": "Source is the original path where the package was extracted from cache." + }, + "type": { + "type": "integer", + "description": "Type indicates the link type (1 for hard link, 2 for soft link, 3 for copy)." + } + }, + "type": "object", + "required": [ + "source", + "type" + ], + "description": "CondaLink represents link metadata from a Conda package's link.json file describing package installation source." + }, + "CondaMetadataEntry": { + "properties": { + "arch": { + "type": "string", + "description": "Arch is the target CPU architecture for the package (e.g., \"arm64\", \"x86_64\")." + }, + "name": { + "type": "string", + "description": "Name is the package name as found in the conda-meta JSON file." + }, + "version": { + "type": "string", + "description": "Version is the package version as found in the conda-meta JSON file." + }, + "build": { + "type": "string", + "description": "Build is the build string identifier (e.g., \"h90dfc92_1014\")." + }, + "build_number": { + "type": "integer", + "description": "BuildNumber is the sequential build number for this version." + }, + "channel": { + "type": "string", + "description": "Channel is the Conda channel URL where the package was retrieved from." + }, + "subdir": { + "type": "string", + "description": "Subdir is the subdirectory within the channel (e.g., \"osx-arm64\", \"linux-64\")." + }, + "noarch": { + "type": "string", + "description": "Noarch indicates if the package is platform-independent (e.g., \"python\", \"generic\")." + }, + "license": { + "type": "string", + "description": "License is the package license identifier." + }, + "license_family": { + "type": "string", + "description": "LicenseFamily is the general license category (e.g., \"MIT\", \"Apache\", \"GPL\")." + }, + "md5": { + "type": "string", + "description": "MD5 is the MD5 hash of the package archive." + }, + "sha256": { + "type": "string", + "description": "SHA256 is the SHA-256 hash of the package archive." + }, + "size": { + "type": "integer", + "description": "Size is the package archive size in bytes." + }, + "timestamp": { + "type": "integer", + "description": "Timestamp is the Unix timestamp when the package was built." + }, + "fn": { + "type": "string", + "description": "Filename is the original package archive filename (e.g., \"zlib-1.2.11-h90dfc92_1014.tar.bz2\")." + }, + "url": { + "type": "string", + "description": "URL is the full download URL for the package archive." + }, + "extracted_package_dir": { + "type": "string", + "description": "ExtractedPackageDir is the local cache directory where the package was extracted." + }, + "depends": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Depends is the list of runtime dependencies with version constraints." + }, + "files": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Files is the list of files installed by this package." + }, + "paths_data": { + "$ref": "#/$defs/CondaPathsData", + "description": "PathsData contains detailed file metadata from the paths.json file." + }, + "link": { + "$ref": "#/$defs/CondaLink", + "description": "Link contains installation source metadata from the link.json file." + } + }, + "type": "object", + "required": [ + "name", + "version", + "build", + "build_number" + ], + "description": "CondaMetaPackage represents metadata for a Conda package extracted from the conda-meta/*.json files." + }, + "CondaPathData": { + "properties": { + "_path": { + "type": "string", + "description": "Path is the file path relative to the Conda environment root." + }, + "path_type": { + "type": "string", + "description": "PathType indicates the link type for the file (e.g., \"hardlink\", \"softlink\", \"directory\")." + }, + "sha256": { + "type": "string", + "description": "SHA256 is the SHA-256 hash of the file contents." + }, + "sha256_in_prefix": { + "type": "string", + "description": "SHA256InPrefix is the SHA-256 hash of the file after prefix replacement during installation." + }, + "size_in_bytes": { + "type": "integer", + "description": "SizeInBytes is the file size in bytes." + } + }, + "type": "object", + "required": [ + "_path", + "path_type", + "sha256", + "sha256_in_prefix", + "size_in_bytes" + ], + "description": "CondaPathData represents metadata for a single file within a Conda package from the paths.json file." + }, + "CondaPathsData": { + "properties": { + "paths_version": { + "type": "integer", + "description": "PathsVersion is the schema version of the paths data format." + }, + "paths": { + "items": { + "$ref": "#/$defs/CondaPathData" + }, + "type": "array", + "description": "Paths is the list of file metadata entries for all files in the package." + } + }, + "type": "object", + "required": [ + "paths_version", + "paths" + ], + "description": "CondaPathsData represents the paths.json file structure from a Conda package containing file metadata." + }, + "Coordinates": { + "properties": { + "path": { + "type": "string", + "description": "RealPath is the canonical absolute form of the path accessed (all symbolic links have been followed and relative path components like '.' and '..' have been removed)." + }, + "layerID": { + "type": "string", + "description": "FileSystemID is an ID representing and entire filesystem. For container images, this is a layer digest. For directories or a root filesystem, this is blank." + } + }, + "type": "object", + "required": [ + "path" + ], + "description": "Coordinates contains the minimal information needed to describe how to find a file within any possible source object (e.g." + }, + "DartPubspec": { + "properties": { + "homepage": { + "type": "string", + "description": "Homepage is the package homepage URL" + }, + "repository": { + "type": "string", + "description": "Repository is the source code repository URL" + }, + "documentation": { + "type": "string", + "description": "Documentation is the documentation site URL" + }, + "publish_to": { + "type": "string", + "description": "PublishTo is the package repository to publish to, or \"none\" to prevent accidental publishing" + }, + "environment": { + "$ref": "#/$defs/DartPubspecEnvironment", + "description": "Environment is SDK version constraints for Dart and Flutter" + }, + "platforms": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Platforms are the supported platforms (Android, iOS, web, etc.)" + }, + "ignored_advisories": { + "items": { + "type": "string" + }, + "type": "array", + "description": "IgnoredAdvisories are the security advisories to explicitly ignore for this package" + } + }, + "type": "object", + "description": "DartPubspec is a struct that represents a package described in a pubspec.yaml file" + }, + "DartPubspecEnvironment": { + "properties": { + "sdk": { + "type": "string", + "description": "SDK is the Dart SDK version constraint (e.g. \"\u003e=2.12.0 \u003c3.0.0\")" + }, + "flutter": { + "type": "string", + "description": "Flutter is the Flutter SDK version constraint if this is a Flutter package" + } + }, + "type": "object", + "description": "DartPubspecEnvironment represents SDK version constraints from the environment section of pubspec.yaml." + }, + "DartPubspecLockEntry": { + "properties": { + "name": { + "type": "string", + "description": "Name is the package name as found in the pubspec.lock file" + }, + "version": { + "type": "string", + "description": "Version is the package version as found in the pubspec.lock file" + }, + "hosted_url": { + "type": "string", + "description": "HostedURL is the URL of the package repository for hosted packages (typically pub.dev, but can be custom repository identified by hosted-url). When PUB_HOSTED_URL environment variable changes, lockfile tracks the source." + }, + "vcs_url": { + "type": "string", + "description": "VcsURL is the URL of the VCS repository for git/path dependencies (for packages fetched from version control systems like Git)" + } + }, + "type": "object", + "required": [ + "name", + "version" + ], + "description": "DartPubspecLockEntry is a struct that represents a single entry found in the \"packages\" section in a Dart pubspec.lock file." + }, + "DenoLockEntry": { + "properties": { + "integrity": { + "type": "string", + "description": "Integrity is the crpto hash of the package content for verification" + }, + "dependencies": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Dependencies is the list of package specifiers that this package depends on" + } + }, + "type": "object", + "required": [ + "integrity", + "dependencies" + ], + "description": "DenoLockEntry is a struct that rep a single entry found in the \"packages\" section of a Deno deno.lock file" + }, + "DenoRemoteLockEntry": { + "properties": { + "url": { + "type": "string", + "description": "URL is the remote URL from which the module fetcef" + }, + "integrity": { + "type": "string", + "description": "Integrity is the crpto hash of the package content for verification" + } + }, + "type": "object", + "required": [ + "url", + "integrity" + ], + "description": "DenoRemoteLockEntry is a struct that rep a single entry found in the \"remote\" section of a Deno deno.lock file" + }, + "Descriptor": { + "properties": { + "name": { + "type": "string", + "description": "Name is the name of the tool that generated this SBOM (e.g., \"syft\")." + }, + "version": { + "type": "string", + "description": "Version is the version of the tool that generated this SBOM." + }, + "configuration": { + "description": "Configuration contains the tool configuration used during SBOM generation." + } + }, + "type": "object", + "required": [ + "name", + "version" + ], + "description": "Descriptor identifies the tool that generated this SBOM document, including its name, version, and configuration used during catalog generation." + }, + "Digest": { + "properties": { + "algorithm": { + "type": "string", + "description": "Algorithm specifies the hash algorithm used (e.g., \"sha256\", \"md5\")." + }, + "value": { + "type": "string", + "description": "Value is the hexadecimal string representation of the hash." + } + }, + "type": "object", + "required": [ + "algorithm", + "value" + ], + "description": "Digest represents a cryptographic hash of file contents." + }, + "Document": { + "properties": { + "artifacts": { + "items": { + "$ref": "#/$defs/Package" + }, + "type": "array", + "description": "Artifacts is the list of packages discovered and placed into the catalog" + }, + "artifactRelationships": { + "items": { + "$ref": "#/$defs/Relationship" + }, + "type": "array" + }, + "files": { + "items": { + "$ref": "#/$defs/File" + }, + "type": "array", + "description": "note: must have omitempty" + }, + "source": { + "$ref": "#/$defs/Source", + "description": "Source represents the original object that was cataloged" + }, + "distro": { + "$ref": "#/$defs/LinuxRelease", + "description": "Distro represents the Linux distribution that was detected from the source" + }, + "descriptor": { + "$ref": "#/$defs/Descriptor", + "description": "Descriptor is a block containing self-describing information about syft" + }, + "schema": { + "$ref": "#/$defs/Schema", + "description": "Schema is a block reserved for defining the version for the shape of this JSON document and where to find the schema document to validate the shape" + } + }, + "type": "object", + "required": [ + "artifacts", + "artifactRelationships", + "source", + "distro", + "descriptor", + "schema" + ], + "description": "Document represents the syft cataloging findings as a JSON document" + }, + "DotnetDepsEntry": { + "properties": { + "name": { + "type": "string", + "description": "Name is the package name as found in the deps.json file" + }, + "version": { + "type": "string", + "description": "Version is the package version as found in the deps.json file" + }, + "path": { + "type": "string", + "description": "Path is the relative path to the package within the deps structure (e.g. \"app.metrics/3.0.0\")" + }, + "sha512": { + "type": "string", + "description": "Sha512 is the SHA-512 hash of the NuGet package content WITHOUT the signed content for verification (won't match hash from NuGet API or manual calculation of .nupkg file)" + }, + "hashPath": { + "type": "string", + "description": "HashPath is the relative path to the .nupkg.sha512 hash file (e.g. \"app.metrics.3.0.0.nupkg.sha512\")" + }, + "type": { + "type": "string", + "description": "Type is type of entry could be package or project for internal refs" + }, + "executables": { + "additionalProperties": { + "$ref": "#/$defs/DotnetPortableExecutableEntry" + }, + "type": "object", + "description": "Executables are the map of .NET Portable Executable files within this package with their version resources" + } + }, + "type": "object", + "required": [ + "name", + "version", + "path", + "sha512", + "hashPath" + ], + "description": "DotnetDepsEntry is a struct that represents a single entry found in the \"libraries\" section in a .NET [*.]deps.json file." + }, + "DotnetPackagesLockEntry": { + "properties": { + "name": { + "type": "string", + "description": "Name is the package name as found in the packages.lock.json file" + }, + "version": { + "type": "string", + "description": "Version is the package version as found in the packages.lock.json file" + }, + "contentHash": { + "type": "string", + "description": "ContentHash is the hash of the package content for verification" + }, + "type": { + "type": "string", + "description": "Type is the dependency type indicating how this dependency was added (Direct=explicit in project file, Transitive=pulled in by another package, Project=project reference)" + } + }, + "type": "object", + "required": [ + "name", + "version", + "contentHash", + "type" + ], + "description": "DotnetPackagesLockEntry is a struct that represents a single entry found in the \"dependencies\" section in a .NET packages.lock.json file." + }, + "DotnetPortableExecutableEntry": { + "properties": { + "assemblyVersion": { + "type": "string", + "description": "AssemblyVersion is the .NET assembly version number (strong-named version)" + }, + "legalCopyright": { + "type": "string", + "description": "LegalCopyright is the copyright notice string" + }, + "comments": { + "type": "string", + "description": "Comments are additional comments or description embedded in PE resources" + }, + "internalName": { + "type": "string", + "description": "InternalName is the internal name of the file" + }, + "companyName": { + "type": "string", + "description": "CompanyName is the company that produced the file" + }, + "productName": { + "type": "string", + "description": "ProductName is the name of the product this file is part of" + }, + "productVersion": { + "type": "string", + "description": "ProductVersion is the version of the product (may differ from AssemblyVersion)" + } + }, + "type": "object", + "required": [ + "assemblyVersion", + "legalCopyright", + "companyName", + "productName", + "productVersion" + ], + "description": "DotnetPortableExecutableEntry is a struct that represents a single entry found within \"VersionResources\" section of a .NET Portable Executable binary file." + }, + "DpkgArchiveEntry": { + "properties": { + "package": { + "type": "string", + "description": "Package is the package name as found in the status file" + }, + "source": { + "type": "string", + "description": "Source is the source package name this binary was built from (one source can produce multiple binary packages)" + }, + "version": { + "type": "string", + "description": "Version is the binary package version as found in the status file" + }, + "sourceVersion": { + "type": "string", + "description": "SourceVersion is the source package version (may differ from binary version when binNMU rebuilds occur)" + }, + "architecture": { + "type": "string", + "description": "Architecture is the target architecture per Debian spec (specific arch like amd64/arm64, wildcard like any, architecture-independent \"all\", or \"source\" for source packages)" + }, + "maintainer": { + "type": "string", + "description": "Maintainer is the package maintainer's name and email in RFC822 format (name must come first, then email in angle brackets)" + }, + "installedSize": { + "type": "integer", + "description": "InstalledSize is the total size of installed files in kilobytes" + }, + "provides": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Provides are the virtual packages provided by this package (allows other packages to depend on capabilities. Can include versioned provides like \"libdigest-md5-perl (= 2.55.01)\")" + }, + "depends": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Depends are the packages required for this package to function (will not be installed unless these requirements are met, creates strict ordering constraint)" + }, + "preDepends": { + "items": { + "type": "string" + }, + "type": "array", + "description": "PreDepends are the packages that must be installed and configured BEFORE even starting installation of this package (stronger than Depends, discouraged unless absolutely necessary as it adds strict constraints for apt)" + }, + "files": { + "items": { + "$ref": "#/$defs/DpkgFileRecord" + }, + "type": "array", + "description": "Files are the files installed by this package" + } + }, + "type": "object", + "required": [ + "package", + "source", + "version", + "sourceVersion", + "architecture", + "maintainer", + "installedSize", + "files" + ], + "description": "DpkgArchiveEntry represents package metadata extracted from a .deb archive file." + }, + "DpkgDbEntry": { + "properties": { + "package": { + "type": "string", + "description": "Package is the package name as found in the status file" + }, + "source": { + "type": "string", + "description": "Source is the source package name this binary was built from (one source can produce multiple binary packages)" + }, + "version": { + "type": "string", + "description": "Version is the binary package version as found in the status file" + }, + "sourceVersion": { + "type": "string", + "description": "SourceVersion is the source package version (may differ from binary version when binNMU rebuilds occur)" + }, + "architecture": { + "type": "string", + "description": "Architecture is the target architecture per Debian spec (specific arch like amd64/arm64, wildcard like any, architecture-independent \"all\", or \"source\" for source packages)" + }, + "maintainer": { + "type": "string", + "description": "Maintainer is the package maintainer's name and email in RFC822 format (name must come first, then email in angle brackets)" + }, + "installedSize": { + "type": "integer", + "description": "InstalledSize is the total size of installed files in kilobytes" + }, + "provides": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Provides are the virtual packages provided by this package (allows other packages to depend on capabilities. Can include versioned provides like \"libdigest-md5-perl (= 2.55.01)\")" + }, + "depends": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Depends are the packages required for this package to function (will not be installed unless these requirements are met, creates strict ordering constraint)" + }, + "preDepends": { + "items": { + "type": "string" + }, + "type": "array", + "description": "PreDepends are the packages that must be installed and configured BEFORE even starting installation of this package (stronger than Depends, discouraged unless absolutely necessary as it adds strict constraints for apt)" + }, + "files": { + "items": { + "$ref": "#/$defs/DpkgFileRecord" + }, + "type": "array", + "description": "Files are the files installed by this package" + } + }, + "type": "object", + "required": [ + "package", + "source", + "version", + "sourceVersion", + "architecture", + "maintainer", + "installedSize", + "files" + ], + "description": "DpkgDBEntry represents all captured data for a Debian package DB entry; available fields are described at http://manpages.ubuntu.com/manpages/xenial/man1/dpkg-query.1.html in the --showformat section." + }, + "DpkgFileRecord": { + "properties": { + "path": { + "type": "string", + "description": "Path is the file path relative to the filesystem root" + }, + "digest": { + "$ref": "#/$defs/Digest", + "description": "Digest is the file content hash (typically MD5 for dpkg compatibility with legacy systems)" + }, + "isConfigFile": { + "type": "boolean", + "description": "IsConfigFile is whether this file is marked as a configuration file (dpkg will preserve user modifications during upgrades)" + } + }, + "type": "object", + "required": [ + "path", + "isConfigFile" + ], + "description": "DpkgFileRecord represents a single file attributed to a debian package." + }, + "ELFSecurityFeatures": { + "properties": { + "symbolTableStripped": { + "type": "boolean", + "description": "SymbolTableStripped indicates whether debugging symbols have been removed." + }, + "stackCanary": { + "type": "boolean", + "description": "StackCanary indicates whether stack smashing protection is enabled." + }, + "nx": { + "type": "boolean", + "description": "NoExecutable indicates whether NX (no-execute) protection is enabled for the stack." + }, + "relRO": { + "type": "string", + "description": "RelocationReadOnly indicates the RELRO protection level." + }, + "pie": { + "type": "boolean", + "description": "PositionIndependentExecutable indicates whether the binary is compiled as PIE." + }, + "dso": { + "type": "boolean", + "description": "DynamicSharedObject indicates whether the binary is a shared library." + }, + "safeStack": { + "type": "boolean", + "description": "LlvmSafeStack represents a compiler-based security mechanism that separates the stack into a safe stack for storing return addresses and other critical data, and an unsafe stack for everything else, to mitigate stack-based memory corruption errors\nsee https://clang.llvm.org/docs/SafeStack.html" + }, + "cfi": { + "type": "boolean", + "description": "ControlFlowIntegrity represents runtime checks to ensure a program's control flow adheres to the legal paths determined at compile time, thus protecting against various types of control-flow hijacking attacks\nsee https://clang.llvm.org/docs/ControlFlowIntegrity.html" + }, + "fortify": { + "type": "boolean", + "description": "ClangFortifySource is a broad suite of extensions to libc aimed at catching misuses of common library functions\nsee https://android.googlesource.com/platform//bionic/+/d192dbecf0b2a371eb127c0871f77a9caf81c4d2/docs/clang_fortify_anatomy.md" + } + }, + "type": "object", + "required": [ + "symbolTableStripped", + "nx", + "relRO", + "pie", + "dso" + ], + "description": "ELFSecurityFeatures captures security hardening and protection mechanisms in ELF binaries." + }, + "ElfBinaryPackageNoteJsonPayload": { + "properties": { + "type": { + "type": "string", + "description": "Type is the type of the package (e.g. \"rpm\", \"deb\", \"apk\", etc.)" + }, + "architecture": { + "type": "string", + "description": "Architecture of the binary package (e.g. \"amd64\", \"arm\", etc.)" + }, + "osCPE": { + "type": "string", + "description": "OSCPE is a CPE name for the OS, typically corresponding to CPE_NAME in os-release (e.g. cpe:/o:fedoraproject:fedora:33)\n\nDeprecated: in Syft 2.0 the struct tag will be corrected to `osCpe` to match the systemd spec casing." + }, + "appCpe": { + "type": "string", + "description": "AppCpe is a CPE name for the upstream Application, as found in NVD CPE search (e.g. cpe:2.3:a:gnu:coreutils:5.0)" + }, + "os": { + "type": "string", + "description": "OS is the OS name, typically corresponding to ID in os-release (e.g. \"fedora\")" + }, + "osVersion": { + "type": "string", + "description": "osVersion is the version of the OS, typically corresponding to VERSION_ID in os-release (e.g. \"33\")" + }, + "system": { + "type": "string", + "description": "System is a context-specific name for the system that the binary package is intended to run on or a part of" + }, + "vendor": { + "type": "string", + "description": "Vendor is the individual or organization that produced the source code for the binary" + }, + "sourceRepo": { + "type": "string", + "description": "SourceRepo is the URL to the source repository for which the binary was built from" + }, + "commit": { + "type": "string", + "description": "Commit is the commit hash of the source repository for which the binary was built from" + } + }, + "type": "object", + "description": "ELFBinaryPackageNoteJSONPayload Represents metadata captured from the .note.package section of an ELF-formatted binary" + }, + "ElixirMixLockEntry": { + "properties": { + "name": { + "type": "string", + "description": "Name is the package name as found in the mix.lock file" + }, + "version": { + "type": "string", + "description": "Version is the package version as found in the mix.lock file" + }, + "pkgHash": { + "type": "string", + "description": "PkgHash is the outer checksum (SHA-256) of the entire Hex package tarball for integrity verification (preferred method, replaces deprecated inner checksum)" + }, + "pkgHashExt": { + "type": "string", + "description": "PkgHashExt is the extended package hash format (inner checksum is deprecated - SHA-256 of concatenated file contents excluding CHECKSUM file, now replaced by outer checksum)" + }, + "dependencies": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Dependencies are the names of the packages this entry depends on, as\ndeclared in the entry's dependency list within mix.lock. Used to derive\ndependency-of relationships between locked packages." + } + }, + "type": "object", + "required": [ + "name", + "version", + "pkgHash", + "pkgHashExt" + ], + "description": "ElixirMixLockEntry is a struct that represents a single entry in a mix.lock file" + }, + "ErlangRebarLockEntry": { + "properties": { + "name": { + "type": "string", + "description": "Name is the package name as found in the rebar.lock file" + }, + "version": { + "type": "string", + "description": "Version is the package version as found in the rebar.lock file" + }, + "pkgHash": { + "type": "string", + "description": "PkgHash is the outer checksum (SHA-256) of the entire Hex package tarball for integrity verification (preferred method over deprecated inner checksum)" + }, + "pkgHashExt": { + "type": "string", + "description": "PkgHashExt is the extended package hash format (inner checksum deprecated - was SHA-256 of concatenated file contents)" + } + }, + "type": "object", + "required": [ + "name", + "version", + "pkgHash", + "pkgHashExt" + ], + "description": "ErlangRebarLockEntry represents a single package entry from the \"deps\" section within an Erlang rebar.lock file." + }, + "Executable": { + "properties": { + "format": { + "type": "string", + "description": "Format denotes either ELF, Mach-O, or PE" + }, + "hasExports": { + "type": "boolean", + "description": "HasExports indicates whether the binary exports symbols." + }, + "hasEntrypoint": { + "type": "boolean", + "description": "HasEntrypoint indicates whether the binary has an entry point function." + }, + "importedLibraries": { + "items": { + "type": "string" + }, + "type": "array", + "description": "ImportedLibraries lists the shared libraries required by this executable." + }, + "elfSecurityFeatures": { + "$ref": "#/$defs/ELFSecurityFeatures", + "description": "ELFSecurityFeatures contains ELF-specific security hardening information when Format is ELF." + }, + "toolchains": { + "items": { + "$ref": "#/$defs/Toolchain" + }, + "type": "array", + "description": "Toolchains captures information about the compiler, linker, runtime, or other toolchains used to build (or otherwise exist within) the executable." + } + }, + "type": "object", + "required": [ + "format", + "hasExports", + "hasEntrypoint", + "importedLibraries" + ], + "description": "Executable contains metadata about binary files and their security features." + }, + "File": { + "properties": { + "id": { + "type": "string", + "description": "ID is a unique identifier for this file within the SBOM." + }, + "location": { + "$ref": "#/$defs/Coordinates", + "description": "Location is the file path and layer information where this file was found." + }, + "metadata": { + "$ref": "#/$defs/FileMetadataEntry", + "description": "Metadata contains filesystem metadata such as permissions, ownership, and file type." + }, + "contents": { + "type": "string", + "description": "Contents is the file contents for small files." + }, + "digests": { + "items": { + "$ref": "#/$defs/Digest" + }, + "type": "array", + "description": "Digests contains cryptographic hashes of the file contents." + }, + "licenses": { + "items": { + "$ref": "#/$defs/FileLicense" + }, + "type": "array", + "description": "Licenses contains license information discovered within this file." + }, + "executable": { + "$ref": "#/$defs/Executable", + "description": "Executable contains executable metadata if this file is a binary." + }, + "unknowns": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Unknowns contains unknown fields for forward compatibility." + } + }, + "type": "object", + "required": [ + "id", + "location" + ], + "description": "File represents a file discovered during cataloging with its metadata, content digests, licenses, and relationships to packages." + }, + "FileLicense": { + "properties": { + "value": { + "type": "string", + "description": "Value is the raw license identifier or text as found in the file." + }, + "spdxExpression": { + "type": "string", + "description": "SPDXExpression is the parsed SPDX license expression." + }, + "type": { + "type": "string", + "description": "Type is the license type classification (e.g., declared, concluded, discovered)." + }, + "evidence": { + "$ref": "#/$defs/FileLicenseEvidence", + "description": "Evidence contains supporting evidence for this license detection." + } + }, + "type": "object", + "required": [ + "value", + "spdxExpression", + "type" + ], + "description": "FileLicense represents license information discovered within a file's contents or metadata, including the matched license text and SPDX expression." + }, + "FileLicenseEvidence": { + "properties": { + "confidence": { + "type": "integer", + "description": "Confidence is the confidence score for this license detection (0-100)." + }, + "offset": { + "type": "integer", + "description": "Offset is the byte offset where the license text starts in the file." + }, + "extent": { + "type": "integer", + "description": "Extent is the length of the license text in bytes." + } + }, + "type": "object", + "required": [ + "confidence", + "offset", + "extent" + ], + "description": "FileLicenseEvidence contains supporting evidence for a license detection in a file, including the byte offset, extent, and confidence level." + }, + "FileMetadataEntry": { + "properties": { + "mode": { + "type": "integer", + "description": "Mode is the Unix file permission mode in octal format." + }, + "type": { + "type": "string", + "description": "Type is the file type (e.g., \"RegularFile\", \"Directory\", \"SymbolicLink\")." + }, + "linkDestination": { + "type": "string", + "description": "LinkDestination is the target path for symbolic links." + }, + "userID": { + "type": "integer", + "description": "UserID is the file owner user ID." + }, + "groupID": { + "type": "integer", + "description": "GroupID is the file owner group ID." + }, + "mimeType": { + "type": "string", + "description": "MIMEType is the MIME type of the file contents." + }, + "size": { + "type": "integer", + "description": "Size is the file size in bytes." + } + }, + "type": "object", + "required": [ + "mode", + "type", + "userID", + "groupID", + "mimeType", + "size" + ], + "description": "FileMetadataEntry contains filesystem-level metadata attributes such as permissions, ownership, type, and size for a cataloged file." + }, + "GgufFileHeader": { + "properties": { + "ggufVersion": { + "type": "integer", + "description": "GGUFVersion is the GGUF format version (e.g., 3)" + }, + "fileSize": { + "type": "integer", + "description": "FileSize is the size of the GGUF file in bytes (best-effort if available from resolver)" + }, + "architecture": { + "type": "string", + "description": "Architecture is the model architecture (from general.architecture, e.g., \"qwen3moe\", \"llama\")" + }, + "quantization": { + "type": "string", + "description": "Quantization is the quantization type (e.g., \"IQ4_NL\", \"Q4_K_M\")" + }, + "parameters": { + "type": "integer", + "description": "Parameters is the number of model parameters (if present in header)" + }, + "tensorCount": { + "type": "integer", + "description": "TensorCount is the number of tensors in the model" + }, + "header": { + "type": "object", + "description": "RemainingKeyValues contains the remaining key-value pairs from the GGUF header that are not already\nrepresented as typed fields above. This preserves additional metadata fields for reference\n(namespaced with general.*, llama.*, etc.) while avoiding duplication." + }, + "metadataHash": { + "type": "string", + "description": "MetadataKeyValuesHash is a xx64 hash of all key-value pairs from the GGUF header metadata.\nThis hash is computed over the complete header metadata (including the fields extracted\ninto typed fields above) and provides a stable identifier for the model configuration\nacross different file locations or remotes. It allows matching identical models even\nwhen stored in different repositories or with different filenames." + }, + "parts": { + "items": { + "$ref": "#/$defs/GgufFileHeader" + }, + "type": "array", + "description": "Parts contains headers from additional GGUF files that were merged\ninto this package during post-processing (e.g., from OCI layers without model names)." + } + }, + "type": "object", + "required": [ + "ggufVersion", + "tensorCount" + ], + "description": "GGUFFileHeader represents metadata extracted from a GGUF (GPT-Generated Unified Format) model file." + }, + "GithubActionsUseStatement": { + "properties": { + "value": { + "type": "string", + "description": "Value is the action reference (e.g. \"actions/checkout@v3\")" + }, + "comment": { + "type": "string", + "description": "Comment is the inline comment associated with this uses statement" + } + }, + "type": "object", + "required": [ + "value" + ], + "description": "GitHubActionsUseStatement represents a single 'uses' statement in a GitHub Actions workflow file referencing an action or reusable workflow." + }, + "GoModuleBuildinfoEntry": { + "properties": { + "goBuildSettings": { + "$ref": "#/$defs/KeyValues", + "description": "BuildSettings contains the Go build settings and flags used to compile the binary (e.g., GOARCH, GOOS, CGO_ENABLED)." + }, + "goCompiledVersion": { + "type": "string", + "description": "GoCompiledVersion is the version of Go used to compile the binary." + }, + "architecture": { + "type": "string", + "description": "Architecture is the target CPU architecture for the binary (extracted from GOARCH build setting)." + }, + "h1Digest": { + "type": "string", + "description": "H1Digest is the Go module hash in h1: format for the main module from go.sum." + }, + "mainModule": { + "type": "string", + "description": "MainModule is the main module path for the binary (e.g., \"github.com/anchore/syft\")." + }, + "goCryptoSettings": { + "items": { + "type": "string" + }, + "type": "array", + "description": "GoCryptoSettings contains FIPS and cryptographic configuration settings if present." + }, + "goExperiments": { + "items": { + "type": "string" + }, + "type": "array", + "description": "GoExperiments lists experimental Go features enabled during compilation (e.g., \"arenas\", \"cgocheck2\")." + }, + "symbols": { + "additionalProperties": { + "items": { + "type": "string" + }, + "type": "array" + }, + "type": "object", + "description": "Symbols are the function symbols from this module that are compiled into the binary, extracted from\nthe binary symbol table (pclntab) and grouped by the import path of the package that owns them. Each\nvalue is the sorted, deduplicated list of symbol names local to that package, i.e. with the import\npath prefix stripped (e.g. import path \"github.com/foo/bar\" -\u003e \"(*Type).Method\"). The fully qualified\nname is the import path, a \".\", and the local name. One exception: the binary's main package appears\nunder the key \"main\" (the name the linker assigns), not its original source import path, which is not\nrecoverable from the binary. Populated only when the golang cataloger's capture-symbols scope covers\nthis package: the \"all\" scope populates every module package plus the synthetic stdlib package, the\n\"extended-stdlib\" scope populates the stdlib package plus every module under golang.org/x/, and the\n\"stdlib\" scope populates only the stdlib package. The capture-symbols-modules glob patterns populate\nany additional modules they match." + } + }, + "type": "object", + "required": [ + "goCompiledVersion", + "architecture" + ], + "description": "GolangBinaryBuildinfoEntry represents all captured data for a Golang binary" + }, + "GoModuleEntry": { + "properties": { + "h1Digest": { + "type": "string", + "description": "H1Digest is the Go module hash in h1: format from go.sum for verifying module contents." + } + }, + "type": "object", + "description": "GolangModuleEntry represents all captured data for a Golang source scan with go.mod/go.sum" + }, + "GoSourceEntry": { + "properties": { + "h1Digest": { + "type": "string", + "description": "H1Digest is the Go module hash in h1: format from go.sum for verifying module contents." + }, + "os": { + "type": "string", + "description": "OperatingSystem is the target OS for build constraints (e.g., \"linux\", \"darwin\", \"windows\")." + }, + "architecture": { + "type": "string", + "description": "Architecture is the target CPU architecture for build constraints (e.g., \"amd64\", \"arm64\")." + }, + "buildTags": { + "type": "string", + "description": "BuildTags are the build tags used to conditionally compile code (e.g., \"integration,debug\")." + }, + "cgoEnabled": { + "type": "boolean", + "description": "CgoEnabled indicates whether CGO was enabled for this package." + } + }, + "type": "object", + "required": [ + "cgoEnabled" + ], + "description": "GolangSourceEntry represents all captured data for a Golang package found through source analysis" + }, + "HaskellHackageStackEntry": { + "properties": { + "pkgHash": { + "type": "string", + "description": "PkgHash is the package content hash for verification" + } + }, + "type": "object", + "description": "HackageStackYamlEntry represents a single entry from the \"extra-deps\" section of a stack.yaml file." + }, + "HaskellHackageStackLockEntry": { + "properties": { + "pkgHash": { + "type": "string", + "description": "PkgHash is the package content hash for verification" + }, + "snapshotURL": { + "type": "string", + "description": "SnapshotURL is the URL to the Stack snapshot this package came from" + } + }, + "type": "object", + "description": "HackageStackYamlLockEntry represents a single entry from the \"packages\" section of a stack.yaml.lock file." + }, + "HomebrewFormula": { + "properties": { + "tap": { + "type": "string", + "description": "Tap is Homebrew tap this formula belongs to (e.g. \"homebrew/core\")" + }, + "homepage": { + "type": "string", + "description": "Homepage is the upstream project homepage URL" + }, + "description": { + "type": "string", + "description": "Description is a human-readable formula description" + } + }, + "type": "object", + "description": "HomebrewFormula represents metadata about a Homebrew formula package extracted from formula JSON files." + }, + "IDLikes": { + "items": { + "type": "string" + }, + "type": "array", + "description": "IDLikes represents a list of distribution IDs that this Linux distribution is similar to or derived from, as defined in os-release ID_LIKE field." + }, + "JavaArchive": { + "properties": { + "virtualPath": { + "type": "string", + "description": "VirtualPath is path within the archive hierarchy, where nested entries are delimited with ':' (for nested JARs)" + }, + "manifest": { + "$ref": "#/$defs/JavaManifest", + "description": "Manifest is parsed META-INF/MANIFEST.MF contents" + }, + "pomProperties": { + "$ref": "#/$defs/JavaPomProperties", + "description": "PomProperties is parsed pom.properties file contents" + }, + "pomProject": { + "$ref": "#/$defs/JavaPomProject", + "description": "PomProject is parsed pom.xml file contents" + }, + "digest": { + "items": { + "$ref": "#/$defs/Digest" + }, + "type": "array", + "description": "ArchiveDigests is cryptographic hashes of the archive file" + } + }, + "type": "object", + "required": [ + "virtualPath" + ], + "description": "JavaArchive encapsulates all Java ecosystem metadata for a package as well as an (optional) parent relationship." + }, + "JavaJvmInstallation": { + "properties": { + "release": { + "$ref": "#/$defs/JavaVMRelease", + "description": "Release is JVM release information and version details" + }, + "files": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Files are the list of files that are part of this JVM installation" + } + }, + "type": "object", + "required": [ + "release", + "files" + ], + "description": "JavaVMInstallation represents a Java Virtual Machine installation discovered on the system with its release information and file list." + }, + "JavaManifest": { + "properties": { + "main": { + "$ref": "#/$defs/KeyValues", + "description": "Main is main manifest attributes as key-value pairs" + }, + "sections": { + "items": { + "$ref": "#/$defs/KeyValues" + }, + "type": "array", + "description": "Sections are the named sections from the manifest (e.g. per-entry attributes)" + } + }, + "type": "object", + "description": "JavaManifest represents the fields of interest extracted from a Java archive's META-INF/MANIFEST.MF file." + }, + "JavaPomParent": { + "properties": { + "groupId": { + "type": "string", + "description": "GroupID is the parent Maven group identifier" + }, + "artifactId": { + "type": "string", + "description": "ArtifactID is the parent Maven artifact identifier" + }, + "version": { + "type": "string", + "description": "Version is the parent version (child inherits configuration from this specific version of parent POM)" + } + }, + "type": "object", + "required": [ + "groupId", + "artifactId", + "version" + ], + "description": "JavaPomParent contains the fields within the \u003cparent\u003e tag in a pom.xml file" + }, + "JavaPomProject": { + "properties": { + "path": { + "type": "string", + "description": "Path is path to the pom.xml file within the archive" + }, + "parent": { + "$ref": "#/$defs/JavaPomParent", + "description": "Parent is the parent POM reference for inheritance (child POMs inherit configuration from parent)" + }, + "groupId": { + "type": "string", + "description": "GroupID is Maven group identifier (reversed domain name like org.apache.maven)" + }, + "artifactId": { + "type": "string", + "description": "ArtifactID is Maven artifact identifier (project name)" + }, + "version": { + "type": "string", + "description": "Version is project version (together with groupId and artifactId forms Maven coordinates groupId:artifactId:version)" + }, + "name": { + "type": "string", + "description": "Name is a human-readable project name (displayed in Maven-generated documentation)" + }, + "description": { + "type": "string", + "description": "Description is detailed project description" + }, + "url": { + "type": "string", + "description": "URL is the project URL (typically project website or repository)" + } + }, + "type": "object", + "required": [ + "path", + "groupId", + "artifactId", + "version", + "name" + ], + "description": "JavaPomProject represents fields of interest extracted from a Java archive's pom.xml file." + }, + "JavaPomProperties": { + "properties": { + "path": { + "type": "string", + "description": "Path is path to the pom.properties file within the archive" + }, + "name": { + "type": "string", + "description": "Name is the project name" + }, + "groupId": { + "type": "string", + "description": "GroupID is Maven group identifier uniquely identifying the project across all projects (follows reversed domain name convention like com.company.project)" + }, + "artifactId": { + "type": "string", + "description": "ArtifactID is Maven artifact identifier, the name of the jar/artifact (unique within the groupId scope)" + }, + "version": { + "type": "string", + "description": "Version is artifact version" + }, + "scope": { + "type": "string", + "description": "Scope is dependency scope determining when dependency is available (compile=default all phases, test=test compilation/execution only, runtime=runtime and test not compile, provided=expected from JDK or container)" + }, + "extraFields": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Extra is additional custom properties not in standard Maven coordinates" + } + }, + "type": "object", + "required": [ + "path", + "name", + "groupId", + "artifactId", + "version" + ], + "description": "JavaPomProperties represents the fields of interest extracted from a Java archive's pom.properties file." + }, + "JavaVMRelease": { + "properties": { + "implementor": { + "type": "string", + "description": "Implementor is extracted with the `java.vendor` JVM property" + }, + "implementorVersion": { + "type": "string", + "description": "ImplementorVersion is extracted with the `java.vendor.version` JVM property" + }, + "javaRuntimeVersion": { + "type": "string", + "description": "JavaRuntimeVersion is extracted from the 'java.runtime.version' JVM property" + }, + "javaVersion": { + "type": "string", + "description": "JavaVersion matches that from `java -version` command output" + }, + "javaVersionDate": { + "type": "string", + "description": "JavaVersionDate is extracted from the 'java.version.date' JVM property" + }, + "libc": { + "type": "string", + "description": "Libc can either be 'glibc' or 'musl'" + }, + "modules": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Modules is a list of JVM modules that are packaged" + }, + "osArch": { + "type": "string", + "description": "OsArch is the target CPU architecture" + }, + "osName": { + "type": "string", + "description": "OsName is the name of the target runtime operating system environment" + }, + "osVersion": { + "type": "string", + "description": "OsVersion is the version of the target runtime operating system environment" + }, + "source": { + "type": "string", + "description": "Source refers to the origin repository of OpenJDK source" + }, + "buildSource": { + "type": "string", + "description": "BuildSource Git SHA of the build repository" + }, + "buildSourceRepo": { + "type": "string", + "description": "BuildSourceRepo refers to rhe repository URL for the build source" + }, + "sourceRepo": { + "type": "string", + "description": "SourceRepo refers to the OpenJDK repository URL" + }, + "fullVersion": { + "type": "string", + "description": "FullVersion is extracted from the 'java.runtime.version' JVM property" + }, + "semanticVersion": { + "type": "string", + "description": "SemanticVersion is derived from the OpenJDK version" + }, + "buildInfo": { + "type": "string", + "description": "BuildInfo contains additional build information" + }, + "jvmVariant": { + "type": "string", + "description": "JvmVariant specifies the JVM variant (e.g., Hotspot or OpenJ9)" + }, + "jvmVersion": { + "type": "string", + "description": "JvmVersion is extracted from the 'java.vm.version' JVM property" + }, + "imageType": { + "type": "string", + "description": "ImageType can be 'JDK' or 'JRE'" + }, + "buildType": { + "type": "string", + "description": "BuildType can be 'commercial' (used in some older oracle JDK distributions)" + } + }, + "type": "object", + "description": "JavaVMRelease represents JVM version and build information extracted from the release file in a Java installation." + }, + "JavascriptBunLockEntry": { + "properties": { + "integrity": { + "type": "string", + "description": "Integrity is Subresource Integrity hash for verification (SRI format)" + }, + "dependencies": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Dependencies is a map of runtime dependencies and their version specifiers" + }, + "optionalDependencies": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "OptionalDependencies is a map of optional dependencies and their version specifiers" + }, + "peerDependencies": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "PeerDependencies is a map of peer dependencies and their version specifiers" + }, + "bin": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Bin is a map of binary names to the paths they are installed to" + }, + "os": { + "type": "string", + "description": "OS is the operating system constraint for the package (e.g. \"darwin\")" + }, + "cpu": { + "type": "string", + "description": "CPU is the CPU architecture constraint for the package (e.g. \"arm64\")" + } + }, + "type": "object", + "required": [ + "integrity", + "dependencies", + "optionalDependencies", + "peerDependencies", + "bin", + "os", + "cpu" + ], + "description": "BunLockEntry represents a single entry in the \"packages\" section of a bun.lock file" + }, + "JavascriptNpmPackage": { + "properties": { + "name": { + "type": "string", + "description": "Name is the package name as found in package.json" + }, + "version": { + "type": "string", + "description": "Version is the package version as found in package.json" + }, + "author": { + "type": "string", + "description": "Author is package author name" + }, + "homepage": { + "type": "string", + "description": "Homepage is project homepage URL" + }, + "description": { + "type": "string", + "description": "Description is a human-readable package description" + }, + "url": { + "type": "string", + "description": "URL is repository or project URL" + }, + "private": { + "type": "boolean", + "description": "Private is whether this is a private package" + } + }, + "type": "object", + "required": [ + "name", + "version", + "author", + "homepage", + "description", + "url", + "private" + ], + "description": "NpmPackage represents the contents of a javascript package.json file." + }, + "JavascriptNpmPackageLockEntry": { + "properties": { + "resolved": { + "type": "string", + "description": "Resolved is URL where this package was downloaded from (registry source)" + }, + "integrity": { + "type": "string", + "description": "Integrity is Subresource Integrity hash for verification using standard SRI format (sha512-... or sha1-...). npm changed from SHA-1 to SHA-512 in newer versions. For registry sources this is the integrity from registry, for remote tarballs it's SHA-512 of the file. npm verifies tarball matches this hash before unpacking, throwing EINTEGRITY error if mismatch detected." + }, + "dependencies": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Dependencies is a map of dependencies and their version markers, i.e. \"lodash\": \"^1.0.0\"" + } + }, + "type": "object", + "required": [ + "resolved", + "integrity", + "dependencies" + ], + "description": "NpmPackageLockEntry represents a single entry within the \"packages\" section of a package-lock.json file." + }, + "JavascriptPnpmLockEntry": { + "properties": { + "resolution": { + "$ref": "#/$defs/PnpmLockResolution", + "description": "Resolution is the resolution information for the package" + }, + "dependencies": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Dependencies is a map of dependencies and their versions" + } + }, + "type": "object", + "required": [ + "resolution", + "dependencies" + ], + "description": "PnpmLockEntry represents a single entry in the \"packages\" section of a pnpm-lock.yaml file." + }, + "JavascriptYarnLockEntry": { + "properties": { + "resolved": { + "type": "string", + "description": "Resolved is URL where this package was downloaded from" + }, + "integrity": { + "type": "string", + "description": "Integrity is Subresource Integrity hash for verification (SRI format)" + }, + "dependencies": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Dependencies is a map of dependencies and their versions" + } + }, + "type": "object", + "required": [ + "resolved", + "integrity", + "dependencies" + ], + "description": "YarnLockEntry represents a single entry section of a yarn.lock file." + }, + "KeyValue": { + "properties": { + "key": { + "type": "string", + "description": "Key is the key name" + }, + "value": { + "type": "string", + "description": "Value is the value associated with the key" + } + }, + "type": "object", + "required": [ + "key", + "value" + ], + "description": "KeyValue represents a single key-value pair." + }, + "KeyValues": { + "items": { + "$ref": "#/$defs/KeyValue" + }, + "type": "array", + "description": "KeyValues represents an ordered collection of key-value pairs that preserves insertion order." + }, + "License": { + "properties": { + "value": { + "type": "string", + "description": "Value is the raw license identifier or expression as found." + }, + "spdxExpression": { + "type": "string", + "description": "SPDXExpression is the parsed SPDX license expression." + }, + "type": { + "type": "string", + "description": "Type is the license type classification (e.g., declared, concluded, discovered)." + }, + "urls": { + "items": { + "type": "string" + }, + "type": "array", + "description": "URLs are URLs where license text or information can be found." + }, + "locations": { + "items": { + "$ref": "#/$defs/Location" + }, + "type": "array", + "description": "Locations are file locations where this license was discovered." + }, + "contents": { + "type": "string", + "description": "Contents is the full license text content." + } + }, + "type": "object", + "required": [ + "value", + "spdxExpression", + "type", + "urls", + "locations" + ], + "description": "License represents software license information discovered for a package, including SPDX expressions and supporting evidence locations." + }, + "LinuxKernelArchive": { + "properties": { + "name": { + "type": "string", + "description": "Name is kernel name (typically \"Linux\")" + }, + "architecture": { + "type": "string", + "description": "Architecture is the target CPU architecture" + }, + "version": { + "type": "string", + "description": "Version is kernel version string" + }, + "extendedVersion": { + "type": "string", + "description": "ExtendedVersion is additional version information" + }, + "buildTime": { + "type": "string", + "description": "BuildTime is when the kernel was built" + }, + "author": { + "type": "string", + "description": "Author is who built the kernel" + }, + "format": { + "type": "string", + "description": "Format is kernel image format (e.g. bzImage, zImage)" + }, + "rwRootFS": { + "type": "boolean", + "description": "RWRootFS is whether root filesystem is mounted read-write" + }, + "swapDevice": { + "type": "integer", + "description": "SwapDevice is swap device number" + }, + "rootDevice": { + "type": "integer", + "description": "RootDevice is root device number" + }, + "videoMode": { + "type": "string", + "description": "VideoMode is default video mode setting" + } + }, + "type": "object", + "required": [ + "name", + "architecture", + "version" + ], + "description": "LinuxKernel represents all captured data for a Linux kernel" + }, + "LinuxKernelModule": { + "properties": { + "name": { + "type": "string", + "description": "Name is module name" + }, + "version": { + "type": "string", + "description": "Version is module version string" + }, + "sourceVersion": { + "type": "string", + "description": "SourceVersion is the source code version identifier" + }, + "path": { + "type": "string", + "description": "Path is the filesystem path to the .ko kernel object file (absolute path)" + }, + "description": { + "type": "string", + "description": "Description is a human-readable module description" + }, + "author": { + "type": "string", + "description": "Author is module author name and email" + }, + "license": { + "type": "string", + "description": "License is module license (e.g. GPL, BSD) which must be compatible with kernel" + }, + "kernelVersion": { + "type": "string", + "description": "KernelVersion is kernel version this module was built for" + }, + "versionMagic": { + "type": "string", + "description": "VersionMagic is version magic string for compatibility checking (includes kernel version, SMP status, module loading capabilities like \"3.17.4-302.fc21.x86_64 SMP mod_unload modversions\"). Module will NOT load if vermagic doesn't match running kernel." + }, + "parameters": { + "additionalProperties": { + "$ref": "#/$defs/LinuxKernelModuleParameter" + }, + "type": "object", + "description": "Parameters are the module parameters that can be configured at load time (user-settable values like module options)" + } + }, + "type": "object", + "description": "LinuxKernelModule represents a loadable kernel module (.ko file) with its metadata, parameters, and dependencies." + }, + "LinuxKernelModuleParameter": { + "properties": { + "type": { + "type": "string", + "description": "Type is parameter data type (e.g. int, string, bool, array types)" + }, + "description": { + "type": "string", + "description": "Description is a human-readable parameter description explaining what the parameter controls" + } + }, + "type": "object", + "description": "LinuxKernelModuleParameter represents a configurable parameter for a kernel module with its type and description." + }, + "LinuxRelease": { + "properties": { + "prettyName": { + "type": "string", + "description": "PrettyName is a human-readable operating system name with version." + }, + "name": { + "type": "string", + "description": "Name is the operating system name without version information." + }, + "id": { + "type": "string", + "description": "ID is the lower-case operating system identifier (e.g., \"ubuntu\", \"rhel\")." + }, + "idLike": { + "$ref": "#/$defs/IDLikes", + "description": "IDLike is a list of operating system IDs this distribution is similar to or derived from." + }, + "version": { + "type": "string", + "description": "Version is the operating system version including codename if available." + }, + "versionID": { + "type": "string", + "description": "VersionID is the operating system version number or identifier." + }, + "versionCodename": { + "type": "string", + "description": "VersionCodename is the operating system release codename (e.g., \"jammy\", \"bullseye\")." + }, + "buildID": { + "type": "string", + "description": "BuildID is a build identifier for the operating system." + }, + "imageID": { + "type": "string", + "description": "ImageID is an identifier for container or cloud images." + }, + "imageVersion": { + "type": "string", + "description": "ImageVersion is the version for container or cloud images." + }, + "variant": { + "type": "string", + "description": "Variant is the operating system variant name (e.g., \"Server\", \"Workstation\")." + }, + "variantID": { + "type": "string", + "description": "VariantID is the lower-case operating system variant identifier." + }, + "homeURL": { + "type": "string", + "description": "HomeURL is the homepage URL for the operating system." + }, + "supportURL": { + "type": "string", + "description": "SupportURL is the support or help URL for the operating system." + }, + "bugReportURL": { + "type": "string", + "description": "BugReportURL is the bug reporting URL for the operating system." + }, + "privacyPolicyURL": { + "type": "string", + "description": "PrivacyPolicyURL is the privacy policy URL for the operating system." + }, + "cpeName": { + "type": "string", + "description": "CPEName is the Common Platform Enumeration name for the operating system." + }, + "supportEnd": { + "type": "string", + "description": "SupportEnd is the end of support date or version identifier." + }, + "extendedSupport": { + "type": "boolean", + "description": "ExtendedSupport indicates whether extended security or support is available." + } + }, + "type": "object", + "description": "LinuxRelease contains Linux distribution identification and version information extracted from /etc/os-release or similar system files." + }, + "Location": { + "properties": { + "path": { + "type": "string", + "description": "RealPath is the canonical absolute form of the path accessed (all symbolic links have been followed and relative path components like '.' and '..' have been removed)." + }, + "layerID": { + "type": "string", + "description": "FileSystemID is an ID representing and entire filesystem. For container images, this is a layer digest. For directories or a root filesystem, this is blank." + }, + "accessPath": { + "type": "string", + "description": "AccessPath is the path used to retrieve file contents (which may or may not have hardlinks / symlinks in the path)" + }, + "annotations": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Arbitrary key-value pairs that can be used to annotate a location" + } + }, + "type": "object", + "required": [ + "path", + "accessPath" + ], + "description": "Location represents a path relative to a particular filesystem resolved to a specific file.Reference." + }, + "LuarocksPackage": { + "properties": { + "name": { + "type": "string", + "description": "Name is the package name as found in the .rockspec file" + }, + "version": { + "type": "string", + "description": "Version is the package version as found in the .rockspec file" + }, + "license": { + "type": "string", + "description": "License is license identifier" + }, + "homepage": { + "type": "string", + "description": "Homepage is project homepage URL" + }, + "description": { + "type": "string", + "description": "Description is a human-readable package description" + }, + "url": { + "type": "string", + "description": "URL is the source download URL" + }, + "dependencies": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Dependencies are the map of dependency names to version constraints" + } + }, + "type": "object", + "required": [ + "name", + "version", + "license", + "homepage", + "description", + "url", + "dependencies" + ], + "description": "LuaRocksPackage represents a Lua package managed by the LuaRocks package manager with metadata from .rockspec files." + }, + "MicrosoftKbPatch": { + "properties": { + "product_id": { + "type": "string", + "description": "ProductID is MSRC Product ID (e.g. \"Windows 10 Version 1703 for 32-bit Systems\")" + }, + "kb": { + "type": "string", + "description": "Kb is Knowledge Base article number (e.g. \"5001028\")" + } + }, + "type": "object", + "required": [ + "product_id", + "kb" + ], + "description": "MicrosoftKbPatch represents a Windows Knowledge Base patch identifier associated with a specific Microsoft product from the MSRC (Microsoft Security Response Center)." + }, + "NixDerivation": { + "properties": { + "path": { + "type": "string", + "description": "Path is path to the .drv file in Nix store" + }, + "system": { + "type": "string", + "description": "System is target system string indicating where derivation can be built (e.g. \"x86_64-linux\", \"aarch64-darwin\"). Must match current system for local builds." + }, + "inputDerivations": { + "items": { + "$ref": "#/$defs/NixDerivationReference" + }, + "type": "array", + "description": "InputDerivations are the list of other derivations that were inputs to this build (dependencies)" + }, + "inputSources": { + "items": { + "type": "string" + }, + "type": "array", + "description": "InputSources are the list of source file paths that were inputs to this build" + } + }, + "type": "object", + "description": "NixDerivation represents a Nix .drv file that describes how to build a package including inputs, outputs, and build instructions." + }, + "NixDerivationReference": { + "properties": { + "path": { + "type": "string", + "description": "Path is path to the referenced .drv file" + }, + "outputs": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Outputs are which outputs of the referenced derivation were used (e.g. [\"out\"], [\"bin\", \"dev\"])" + } + }, + "type": "object", + "description": "NixDerivationReference represents a reference to another derivation used as a build input or runtime dependency." + }, + "NixStoreEntry": { + "properties": { + "path": { + "type": "string", + "description": "Path is full store path for this output (e.g. /nix/store/abc123...-package-1.0)" + }, + "output": { + "type": "string", + "description": "Output is the specific output name for multi-output packages (empty string for default \"out\" output, can be \"bin\", \"dev\", \"doc\", etc.)" + }, + "outputHash": { + "type": "string", + "description": "OutputHash is hash prefix of the store path basename (first part before the dash)" + }, + "derivation": { + "$ref": "#/$defs/NixDerivation", + "description": "Derivation is information about the .drv file that describes how this package was built" + }, + "files": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Files are the list of files under the nix/store path for this package" + } + }, + "type": "object", + "required": [ + "outputHash" + ], + "description": "NixStoreEntry represents a package in the Nix store (/nix/store) with its derivation information and metadata." + }, + "OpamPackage": { + "properties": { + "name": { + "type": "string", + "description": "Name is the package name as found in the .opam file" + }, + "version": { + "type": "string", + "description": "Version is the package version as found in the .opam file" + }, + "licenses": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Licenses are the list of applicable licenses" + }, + "url": { + "type": "string", + "description": "URL is download URL for the package source" + }, + "checksum": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Checksums are the list of checksums for verification" + }, + "homepage": { + "type": "string", + "description": "Homepage is project homepage URL" + }, + "dependencies": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Dependencies are the list of required dependencies" + } + }, + "type": "object", + "required": [ + "name", + "version", + "licenses", + "url", + "checksum", + "homepage", + "dependencies" + ], + "description": "OpamPackage represents an OCaml package managed by the OPAM package manager with metadata from .opam files." + }, + "Package": { + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "version": { + "type": "string" + }, + "type": { + "type": "string" + }, + "foundBy": { + "type": "string" + }, + "locations": { + "items": { + "$ref": "#/$defs/Location" + }, + "type": "array" + }, + "licenses": { + "$ref": "#/$defs/licenses" + }, + "language": { + "type": "string" + }, + "cpes": { + "$ref": "#/$defs/cpes" + }, + "purl": { + "type": "string" + }, + "metadataType": { + "type": "string" + }, + "metadata": { + "anyOf": [ + { + "type": "null" + }, + { + "$ref": "#/$defs/AlpmDbEntry" + }, + { + "$ref": "#/$defs/ApkDbEntry" + }, + { + "$ref": "#/$defs/AppleAppBundleEntry" + }, + { + "$ref": "#/$defs/BinarySignature" + }, + { + "$ref": "#/$defs/BitnamiSbomEntry" + }, + { + "$ref": "#/$defs/CConanFileEntry" + }, + { + "$ref": "#/$defs/CConanInfoEntry" + }, + { + "$ref": "#/$defs/CConanLockEntry" + }, + { + "$ref": "#/$defs/CConanLockV2Entry" + }, + { + "$ref": "#/$defs/CocoaPodfileLockEntry" + }, + { + "$ref": "#/$defs/CondaMetadataEntry" + }, + { + "$ref": "#/$defs/DartPubspec" + }, + { + "$ref": "#/$defs/DartPubspecLockEntry" + }, + { + "$ref": "#/$defs/DenoLockEntry" + }, + { + "$ref": "#/$defs/DenoRemoteLockEntry" + }, + { + "$ref": "#/$defs/DotnetDepsEntry" + }, + { + "$ref": "#/$defs/DotnetPackagesLockEntry" + }, + { + "$ref": "#/$defs/DotnetPortableExecutableEntry" + }, + { + "$ref": "#/$defs/DpkgArchiveEntry" + }, + { + "$ref": "#/$defs/DpkgDbEntry" + }, + { + "$ref": "#/$defs/ElfBinaryPackageNoteJsonPayload" + }, + { + "$ref": "#/$defs/ElixirMixLockEntry" + }, + { + "$ref": "#/$defs/ErlangRebarLockEntry" + }, + { + "$ref": "#/$defs/GgufFileHeader" + }, + { + "$ref": "#/$defs/GithubActionsUseStatement" + }, + { + "$ref": "#/$defs/GoModuleBuildinfoEntry" + }, + { + "$ref": "#/$defs/GoModuleEntry" + }, + { + "$ref": "#/$defs/GoSourceEntry" + }, + { + "$ref": "#/$defs/HaskellHackageStackEntry" + }, + { + "$ref": "#/$defs/HaskellHackageStackLockEntry" + }, + { + "$ref": "#/$defs/HomebrewFormula" + }, + { + "$ref": "#/$defs/JavaArchive" + }, + { + "$ref": "#/$defs/JavaJvmInstallation" + }, + { + "$ref": "#/$defs/JavascriptBunLockEntry" + }, + { + "$ref": "#/$defs/JavascriptNpmPackage" + }, + { + "$ref": "#/$defs/JavascriptNpmPackageLockEntry" + }, + { + "$ref": "#/$defs/JavascriptPnpmLockEntry" + }, + { + "$ref": "#/$defs/JavascriptYarnLockEntry" + }, + { + "$ref": "#/$defs/LinuxKernelArchive" + }, + { + "$ref": "#/$defs/LinuxKernelModule" + }, + { + "$ref": "#/$defs/LuarocksPackage" + }, + { + "$ref": "#/$defs/MicrosoftKbPatch" + }, + { + "$ref": "#/$defs/NixStoreEntry" + }, + { + "$ref": "#/$defs/OpamPackage" + }, + { + "$ref": "#/$defs/PeBinary" + }, + { + "$ref": "#/$defs/PhpComposerInstalledEntry" + }, + { + "$ref": "#/$defs/PhpComposerLockEntry" + }, + { + "$ref": "#/$defs/PhpPearEntry" + }, + { + "$ref": "#/$defs/PhpPeclEntry" + }, + { + "$ref": "#/$defs/PortageDbEntry" + }, + { + "$ref": "#/$defs/PythonPackage" + }, + { + "$ref": "#/$defs/PythonPdmLockEntry" + }, + { + "$ref": "#/$defs/PythonPipRequirementsEntry" + }, + { + "$ref": "#/$defs/PythonPipfileLockEntry" + }, + { + "$ref": "#/$defs/PythonPoetryLockEntry" + }, + { + "$ref": "#/$defs/PythonUvLockEntry" + }, + { + "$ref": "#/$defs/RDescription" + }, + { + "$ref": "#/$defs/RpmArchive" + }, + { + "$ref": "#/$defs/RpmDbEntry" + }, + { + "$ref": "#/$defs/RubyGemspec" + }, + { + "$ref": "#/$defs/RustCargoAuditEntry" + }, + { + "$ref": "#/$defs/RustCargoLockEntry" + }, + { + "$ref": "#/$defs/SafetensorsModelInfo" + }, + { + "$ref": "#/$defs/SnapEntry" + }, + { + "$ref": "#/$defs/SwiftPackageManagerLockEntry" + }, + { + "$ref": "#/$defs/SwiplpackPackage" + }, + { + "$ref": "#/$defs/TerraformLockProviderEntry" + }, + { + "$ref": "#/$defs/VcpkgManifest" + }, + { + "$ref": "#/$defs/WordpressPluginEntry" + } + ] + } + }, + "type": "object", + "required": [ + "id", + "name", + "version", + "type", + "foundBy", + "locations", + "licenses", + "language", + "cpes", + "purl" + ], + "description": "Package represents a pkg.Package object specialized for JSON marshaling and unmarshalling." + }, + "PeBinary": { + "properties": { + "VersionResources": { + "$ref": "#/$defs/KeyValues", + "description": "VersionResources contains key-value pairs extracted from the PE file's version resource section (e.g., FileVersion, ProductName, CompanyName)." + } + }, + "type": "object", + "required": [ + "VersionResources" + ], + "description": "PEBinary represents metadata captured from a Portable Executable formatted binary (dll, exe, etc.)" + }, + "PhpComposerAuthors": { + "properties": { + "name": { + "type": "string", + "description": "Name is author's full name" + }, + "email": { + "type": "string", + "description": "Email is author's email address" + }, + "homepage": { + "type": "string", + "description": "Homepage is author's personal or company website" + } + }, + "type": "object", + "required": [ + "name" + ], + "description": "PhpComposerAuthors represents author information for a PHP Composer package from the authors field in composer.json." + }, + "PhpComposerExternalReference": { + "properties": { + "type": { + "type": "string", + "description": "Type is reference type (git for source VCS, zip/tar for dist archives)" + }, + "url": { + "type": "string", + "description": "URL is the URL to the resource (git repository URL or archive download URL)" + }, + "reference": { + "type": "string", + "description": "Reference is git commit hash or version tag for source, or archive version for dist" + }, + "shasum": { + "type": "string", + "description": "Shasum is SHA hash of the archive file for integrity verification (dist only)" + } + }, + "type": "object", + "required": [ + "type", + "url", + "reference" + ], + "description": "PhpComposerExternalReference represents source or distribution information for a PHP package, indicating where the package code is retrieved from." + }, + "PhpComposerInstalledEntry": { + "properties": { + "name": { + "type": "string", + "description": "Name is package name in vendor/package format (e.g. symfony/console)" + }, + "version": { + "type": "string", + "description": "Version is the package version" + }, + "source": { + "$ref": "#/$defs/PhpComposerExternalReference", + "description": "Source is the source repository information for development (typically git repo, used when passing --prefer-source). Originates from source code repository." + }, + "dist": { + "$ref": "#/$defs/PhpComposerExternalReference", + "description": "Dist is distribution archive information for production (typically zip/tar, default install method). Packaged version of released code." + }, + "require": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Require is runtime dependencies with version constraints (package will not install unless these requirements can be met)" + }, + "provide": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Provide is virtual packages/functionality provided by this package (allows other packages to depend on capabilities)" + }, + "require-dev": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "RequireDev is development-only dependencies (not installed in production, only when developing this package or running tests)" + }, + "suggest": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Suggest is optional but recommended dependencies (suggestions for packages that would extend functionality)" + }, + "license": { + "items": { + "type": "string" + }, + "type": "array", + "description": "License is the list of license identifiers (SPDX format)" + }, + "type": { + "type": "string", + "description": "Type is package type indicating purpose (library=reusable code, project=application, metapackage=aggregates dependencies, etc.)" + }, + "notification-url": { + "type": "string", + "description": "NotificationURL is the URL to notify when package is installed (for tracking/statistics)" + }, + "bin": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Bin is the list of binary/executable files that should be added to PATH" + }, + "authors": { + "items": { + "$ref": "#/$defs/PhpComposerAuthors" + }, + "type": "array", + "description": "Authors are the list of package authors with name/email/homepage" + }, + "description": { + "type": "string", + "description": "Description is a human-readable package description" + }, + "homepage": { + "type": "string", + "description": "Homepage is project homepage URL" + }, + "keywords": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Keywords are the list of keywords for package discovery/search" + }, + "time": { + "type": "string", + "description": "Time is timestamp when this package version was released" + } + }, + "type": "object", + "required": [ + "name", + "version", + "source", + "dist" + ], + "description": "PhpComposerInstalledEntry represents a single package entry from a composer v1/v2 \"installed.json\" files (very similar to composer.lock files)." + }, + "PhpComposerLockEntry": { + "properties": { + "name": { + "type": "string", + "description": "Name is package name in vendor/package format (e.g. symfony/console)" + }, + "version": { + "type": "string", + "description": "Version is the package version" + }, + "source": { + "$ref": "#/$defs/PhpComposerExternalReference", + "description": "Source is the source repository information for development (typically git repo, used when passing --prefer-source). Originates from source code repository." + }, + "dist": { + "$ref": "#/$defs/PhpComposerExternalReference", + "description": "Dist is distribution archive information for production (typically zip/tar, default install method). Packaged version of released code." + }, + "require": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Require is runtime dependencies with version constraints (package will not install unless these requirements can be met)" + }, + "provide": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Provide is virtual packages/functionality provided by this package (allows other packages to depend on capabilities)" + }, + "require-dev": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "RequireDev is development-only dependencies (not installed in production, only when developing this package or running tests)" + }, + "suggest": { + "additionalProperties": { + "type": "string" + }, + "type": "object", + "description": "Suggest is optional but recommended dependencies (suggestions for packages that would extend functionality)" + }, + "license": { + "items": { + "type": "string" + }, + "type": "array", + "description": "License is the list of license identifiers (SPDX format)" + }, + "type": { + "type": "string", + "description": "Type is package type indicating purpose (library=reusable code, project=application, metapackage=aggregates dependencies, etc.)" + }, + "notification-url": { + "type": "string", + "description": "NotificationURL is the URL to notify when package is installed (for tracking/statistics)" + }, + "bin": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Bin is the list of binary/executable files that should be added to PATH" + }, + "authors": { + "items": { + "$ref": "#/$defs/PhpComposerAuthors" + }, + "type": "array", + "description": "Authors are the list of package authors with name/email/homepage" + }, + "description": { + "type": "string", + "description": "Description is a human-readable package description" + }, + "homepage": { + "type": "string", + "description": "Homepage is project homepage URL" + }, + "keywords": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Keywords are the list of keywords for package discovery/search" + }, + "time": { + "type": "string", + "description": "Time is timestamp when this package version was released" + } + }, + "type": "object", + "required": [ + "name", + "version", + "source", + "dist" + ], + "description": "PhpComposerLockEntry represents a single package entry found from a composer.lock file." + }, + "PhpPearEntry": { + "properties": { + "name": { + "type": "string", + "description": "Name is the package name" + }, + "channel": { + "type": "string", + "description": "Channel is PEAR channel this package is from" + }, + "version": { + "type": "string", + "description": "Version is the package version" + }, + "license": { + "items": { + "type": "string" + }, + "type": "array", + "description": "License is the list of applicable licenses" + } + }, + "type": "object", + "required": [ + "name", + "version" + ], + "description": "PhpPearEntry represents a single package entry found within php pear metadata files." + }, + "PhpPeclEntry": { + "properties": { + "name": { + "type": "string", + "description": "Name is the package name" + }, + "channel": { + "type": "string", + "description": "Channel is PEAR channel this package is from" + }, + "version": { + "type": "string", + "description": "Version is the package version" + }, + "license": { + "items": { + "type": "string" + }, + "type": "array", + "description": "License is the list of applicable licenses" + } + }, + "type": "object", + "required": [ + "name", + "version" + ], + "description": "PhpPeclEntry represents a single package entry found within php pecl metadata files." + }, + "PnpmLockResolution": { + "properties": { + "integrity": { + "type": "string", + "description": "Integrity is Subresource Integrity hash for verification (SRI format)" + } + }, + "type": "object", + "required": [ + "integrity" + ], + "description": "PnpmLockResolution contains package resolution metadata from pnpm lockfiles, including the integrity hash used for verification." + }, + "PortageDbEntry": { + "properties": { + "installedSize": { + "type": "integer", + "description": "InstalledSize is total size of installed files in bytes" + }, + "licenses": { + "type": "string", + "description": "Licenses is license string which may be an expression (e.g. \"GPL-2 OR Apache-2.0\")" + }, + "files": { + "items": { + "$ref": "#/$defs/PortageFileRecord" + }, + "type": "array", + "description": "Files are the files installed by this package (tracked in CONTENTS file)" + } + }, + "type": "object", + "required": [ + "installedSize", + "files" + ], + "description": "PortageEntry represents a single package entry in the portage DB flat-file store." + }, + "PortageFileRecord": { + "properties": { + "path": { + "type": "string", + "description": "Path is the file path relative to the filesystem root" + }, + "digest": { + "$ref": "#/$defs/Digest", + "description": "Digest is file content hash (MD5 for regular files in CONTENTS format: \"obj filename md5hash mtime\")" + } + }, + "type": "object", + "required": [ + "path" + ], + "description": "PortageFileRecord represents a single file attributed to a portage package." + }, + "PythonDirectURLOriginInfo": { + "properties": { + "url": { + "type": "string", + "description": "URL is the source URL from which the package was installed." + }, + "commitId": { + "type": "string", + "description": "CommitID is the VCS commit hash if installed from version control." + }, + "vcs": { + "type": "string", + "description": "VCS is the version control system type (e.g., \"git\", \"hg\")." + } + }, + "type": "object", + "required": [ + "url" + ], + "description": "PythonDirectURLOriginInfo represents installation source metadata from direct_url.json for packages installed from VCS or direct URLs." + }, + "PythonFileDigest": { + "properties": { + "algorithm": { + "type": "string", + "description": "Algorithm is the hash algorithm used (e.g., \"sha256\")." + }, + "value": { + "type": "string", + "description": "Value is the hex-encoded hash digest value." + } + }, + "type": "object", + "required": [ + "algorithm", + "value" + ], + "description": "PythonFileDigest represents the file metadata for a single file attributed to a python package." + }, + "PythonFileRecord": { + "properties": { + "path": { + "type": "string", + "description": "Path is the installed file path from the RECORD file." + }, + "digest": { + "$ref": "#/$defs/PythonFileDigest", + "description": "Digest contains the hash algorithm and value for file integrity verification." + }, + "size": { + "type": "string", + "description": "Size is the file size in bytes as a string." + } + }, + "type": "object", + "required": [ + "path" + ], + "description": "PythonFileRecord represents a single entry within a RECORD file for a python wheel or egg package" + }, + "PythonPackage": { + "properties": { + "name": { + "type": "string", + "description": "Name is the package name from the Name field in PKG-INFO or METADATA." + }, + "version": { + "type": "string", + "description": "Version is the package version from the Version field in PKG-INFO or METADATA." + }, + "author": { + "type": "string", + "description": "Author is the package author name from the Author field." + }, + "authorEmail": { + "type": "string", + "description": "AuthorEmail is the package author's email address from the Author-Email field." + }, + "platform": { + "type": "string", + "description": "Platform indicates the target platform for the package (e.g., \"any\", \"linux\", \"win32\")." + }, + "files": { + "items": { + "$ref": "#/$defs/PythonFileRecord" + }, + "type": "array", + "description": "Files are the installed files listed in the RECORD file for wheels or installed-files.txt for eggs." + }, + "sitePackagesRootPath": { + "type": "string", + "description": "SitePackagesRootPath is the root directory path containing the package (e.g., \"/usr/lib/python3.9/site-packages\")." + }, + "topLevelPackages": { + "items": { + "type": "string" + }, + "type": "array", + "description": "TopLevelPackages are the top-level Python module names from top_level.txt file." + }, + "directUrlOrigin": { + "$ref": "#/$defs/PythonDirectURLOriginInfo", + "description": "DirectURLOrigin contains VCS or direct URL installation information from direct_url.json." + }, + "requiresPython": { + "type": "string", + "description": "RequiresPython specifies the Python version requirement (e.g., \"\u003e=3.6\")." + }, + "requiresDist": { + "items": { + "type": "string" + }, + "type": "array", + "description": "RequiresDist lists the package dependencies with version specifiers from Requires-Dist fields." + }, + "providesExtra": { + "items": { + "type": "string" + }, + "type": "array", + "description": "ProvidesExtra lists optional feature names that can be installed via extras (e.g., \"dev\", \"test\")." + } + }, + "type": "object", + "required": [ + "name", + "version", + "author", + "authorEmail", + "platform", + "sitePackagesRootPath" + ], + "description": "PythonPackage represents all captured data for a python egg or wheel package (specifically as outlined in the PyPA core metadata specification https://packaging.python.org/en/latest/specifications/core-metadata/)." + }, + "PythonPdmFileEntry": { + "properties": { + "url": { + "type": "string", + "description": "URL is the file download URL" + }, + "digest": { + "$ref": "#/$defs/PythonFileDigest", + "description": "Digest is the hash digest of the file hosted at the URL" + } + }, + "type": "object", + "required": [ + "url", + "digest" + ] + }, + "PythonPdmLockEntry": { + "properties": { + "summary": { + "type": "string", + "description": "Summary provides a description of the package" + }, + "files": { + "items": { + "$ref": "#/$defs/PythonPdmFileEntry" + }, + "type": "array", + "description": "Files are the package files with their paths and hash digests (for the base package without extras)" + }, + "marker": { + "type": "string", + "description": "Marker is the \"environment\" --conditional expressions that determine whether a package should be installed based on the runtime environment" + }, + "requiresPython": { + "type": "string", + "description": "RequiresPython specifies the Python version requirement (e.g., \"\u003e=3.6\")." + }, + "dependencies": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Dependencies are the dependency specifications for the base package (without extras)" + }, + "extras": { + "items": { + "$ref": "#/$defs/PythonPdmLockExtraVariant" + }, + "type": "array", + "description": "Extras contains variants for different extras combinations (PDM may have multiple entries per package)" + } + }, + "type": "object", + "required": [ + "summary", + "files" + ], + "description": "PythonPdmLockEntry represents a single package entry within a pdm.lock file." + }, + "PythonPdmLockExtraVariant": { + "properties": { + "extras": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Extras are the optional extras enabled for this variant (e.g., [\"toml\"], [\"dev\"], or [\"toml\", \"dev\"])" + }, + "dependencies": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Dependencies are the dependencies specific to this extras variant" + }, + "files": { + "items": { + "$ref": "#/$defs/PythonPdmFileEntry" + }, + "type": "array", + "description": "Files are the package files specific to this variant (only populated if different from base)" + }, + "marker": { + "type": "string", + "description": "Marker is the environment conditional expression for this variant (e.g., \"python_version \u003c \\\"3.11\\\"\")" + } + }, + "type": "object", + "required": [ + "extras" + ], + "description": "PythonPdmLockExtraVariant represents a specific extras combination variant within a PDM lock file." + }, + "PythonPipRequirementsEntry": { + "properties": { + "name": { + "type": "string", + "description": "Name is the package name from the requirements file." + }, + "extras": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Extras are the optional features to install from the package (e.g., package[dev,test])." + }, + "versionConstraint": { + "type": "string", + "description": "VersionConstraint specifies version requirements (e.g., \"\u003e=1.0,\u003c2.0\")." + }, + "url": { + "type": "string", + "description": "URL is the direct download URL or VCS URL if specified instead of a PyPI package." + }, + "markers": { + "type": "string", + "description": "Markers are environment marker expressions for conditional installation (e.g., \"python_version \u003e= '3.8'\")." + } + }, + "type": "object", + "required": [ + "name", + "versionConstraint" + ], + "description": "PythonRequirementsEntry represents a single entry within a [*-]requirements.txt file." + }, + "PythonPipfileLockEntry": { + "properties": { + "hashes": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Hashes are the package file hash values in the format \"algorithm:digest\" for integrity verification." + }, + "index": { + "type": "string", + "description": "Index is the PyPI index name where the package should be fetched from." + } + }, + "type": "object", + "required": [ + "hashes", + "index" + ], + "description": "PythonPipfileLockEntry represents a single package entry within a Pipfile.lock file." + }, + "PythonPoetryLockDependencyEntry": { + "properties": { + "name": { + "type": "string", + "description": "Name is the dependency package name." + }, + "version": { + "type": "string", + "description": "Version is the locked version or version constraint for the dependency." + }, + "optional": { + "type": "boolean", + "description": "Optional indicates whether this dependency is optional (only needed for certain extras)." + }, + "markers": { + "type": "string", + "description": "Markers are environment marker expressions that conditionally enable the dependency (e.g., \"python_version \u003e= '3.8'\")." + }, + "extras": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Extras are the optional feature names from the dependency that should be installed." + } + }, + "type": "object", + "required": [ + "name", + "version", + "optional" + ], + "description": "PythonPoetryLockDependencyEntry represents a single dependency entry within a Poetry lock file." + }, + "PythonPoetryLockEntry": { + "properties": { + "index": { + "type": "string", + "description": "Index is the package repository name where the package should be fetched from." + }, + "dependencies": { + "items": { + "$ref": "#/$defs/PythonPoetryLockDependencyEntry" + }, + "type": "array", + "description": "Dependencies are the package's runtime dependencies with version constraints." + }, + "extras": { + "items": { + "$ref": "#/$defs/PythonPoetryLockExtraEntry" + }, + "type": "array", + "description": "Extras are optional feature groups that include additional dependencies." + } + }, + "type": "object", + "required": [ + "index", + "dependencies" + ], + "description": "PythonPoetryLockEntry represents a single package entry within a Pipfile.lock file." + }, + "PythonPoetryLockExtraEntry": { + "properties": { + "name": { + "type": "string", + "description": "Name is the optional feature name (e.g., \"dev\", \"test\")." + }, + "dependencies": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Dependencies are the package names required when this extra is installed." + } + }, + "type": "object", + "required": [ + "name", + "dependencies" + ], + "description": "PythonPoetryLockExtraEntry represents an optional feature group in a Poetry lock file." + }, + "PythonUvLockDependencyEntry": { + "properties": { + "name": { + "type": "string", + "description": "Name is the dependency package name." + }, + "optional": { + "type": "boolean", + "description": "Optional indicates whether this dependency is optional (only needed for certain extras)." + }, + "markers": { + "type": "string", + "description": "Markers are environment marker expressions that conditionally enable the dependency (e.g., \"python_version \u003e= '3.8'\")." + }, + "extras": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Extras are the optional feature names from the dependency that should be installed." + } + }, + "type": "object", + "required": [ + "name", + "optional" + ], + "description": "PythonUvLockDependencyEntry represents a single dependency entry within a uv lock file." + }, + "PythonUvLockEntry": { + "properties": { + "index": { + "type": "string", + "description": "Index is the package repository name where the package should be fetched from." + }, + "dependencies": { + "items": { + "$ref": "#/$defs/PythonUvLockDependencyEntry" + }, + "type": "array", + "description": "Dependencies are the package's runtime dependencies with version constraints." + }, + "extras": { + "items": { + "$ref": "#/$defs/PythonUvLockExtraEntry" + }, + "type": "array", + "description": "Extras are optional feature groups that include additional dependencies." + } + }, + "type": "object", + "required": [ + "index", + "dependencies" + ], + "description": "PythonUvLockEntry represents a single package entry within a uv.lock file." + }, + "PythonUvLockExtraEntry": { + "properties": { + "name": { + "type": "string", + "description": "Name is the optional feature name (e.g., \"dev\", \"test\")." + }, + "dependencies": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Dependencies are the package names required when this extra is installed." + } + }, + "type": "object", + "required": [ + "name", + "dependencies" + ], + "description": "PythonUvLockExtraEntry represents an optional feature group in a uv lock file." + }, + "RDescription": { + "properties": { + "title": { + "type": "string", + "description": "Title is short one-line package title" + }, + "description": { + "type": "string", + "description": "Description is detailed package description" + }, + "author": { + "type": "string", + "description": "Author is package author(s)" + }, + "maintainer": { + "type": "string", + "description": "Maintainer is current package maintainer" + }, + "url": { + "items": { + "type": "string" + }, + "type": "array", + "description": "URL is the list of related URLs" + }, + "repository": { + "type": "string", + "description": "Repository is CRAN or other repository name" + }, + "built": { + "type": "string", + "description": "Built is R version and platform this was built with" + }, + "needsCompilation": { + "type": "boolean", + "description": "NeedsCompilation is whether this package requires compilation" + }, + "imports": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Imports are the packages imported in the NAMESPACE" + }, + "depends": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Depends are the packages this package depends on" + }, + "suggests": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Suggests are the optional packages that extend functionality" + } + }, + "type": "object", + "description": "RDescription represents metadata from an R package DESCRIPTION file containing package information, dependencies, and author details." + }, + "Relationship": { + "properties": { + "parent": { + "type": "string", + "description": "Parent is the ID of the parent artifact in this relationship." + }, + "child": { + "type": "string", + "description": "Child is the ID of the child artifact in this relationship." + }, + "type": { + "type": "string", + "description": "Type is the relationship type (e.g., \"contains\", \"dependency-of\", \"ancestor-of\")." + }, + "metadata": { + "description": "Metadata contains additional relationship-specific metadata." + } + }, + "type": "object", + "required": [ + "parent", + "child", + "type" + ], + "description": "Relationship represents a directed relationship between two artifacts in the SBOM, such as package-contains-file or package-depends-on-package." + }, + "RpmArchive": { + "properties": { + "name": { + "type": "string", + "description": "Name is the RPM package name as found in the RPM database." + }, + "version": { + "type": "string", + "description": "Version is the upstream version of the package." + }, + "epoch": { + "oneOf": [ + { + "type": "integer", + "description": "Epoch is the version epoch used to force upgrade ordering (null if not set)." + }, + { + "type": "null" + } + ] + }, + "architecture": { + "type": "string", + "description": "Arch is the target CPU architecture (e.g., \"x86_64\", \"aarch64\", \"noarch\")." + }, + "release": { + "type": "string", + "description": "Release is the package release number or distribution-specific version suffix." + }, + "sourceRpm": { + "type": "string", + "description": "SourceRpm is the source RPM filename that was used to build this package." + }, + "signatures": { + "items": { + "$ref": "#/$defs/RpmSignature" + }, + "type": "array", + "description": "Signatures contains GPG signature metadata for package verification." + }, + "size": { + "type": "integer", + "description": "Size is the total installed size of the package in bytes." + }, + "vendor": { + "type": "string", + "description": "Vendor is the organization that packaged the software." + }, + "modularityLabel": { + "type": "string", + "description": "ModularityLabel identifies the module stream for modular RPM packages (e.g., \"nodejs:12:20200101\")." + }, + "provides": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Provides lists the virtual packages and capabilities this package provides." + }, + "requires": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Requires lists the dependencies required by this package." + }, + "files": { + "items": { + "$ref": "#/$defs/RpmFileRecord" + }, + "type": "array", + "description": "Files are the file records for all files owned by this package." + } + }, + "type": "object", + "required": [ + "name", + "version", + "epoch", + "architecture", + "release", + "sourceRpm", + "size", + "vendor", + "files" + ], + "description": "RpmArchive represents package metadata extracted directly from a .rpm archive file, containing the same information as an RPM database entry." + }, + "RpmDbEntry": { + "properties": { + "name": { + "type": "string", + "description": "Name is the RPM package name as found in the RPM database." + }, + "version": { + "type": "string", + "description": "Version is the upstream version of the package." + }, + "epoch": { + "oneOf": [ + { + "type": "integer", + "description": "Epoch is the version epoch used to force upgrade ordering (null if not set)." + }, + { + "type": "null" + } + ] + }, + "architecture": { + "type": "string", + "description": "Arch is the target CPU architecture (e.g., \"x86_64\", \"aarch64\", \"noarch\")." + }, + "release": { + "type": "string", + "description": "Release is the package release number or distribution-specific version suffix." + }, + "sourceRpm": { + "type": "string", + "description": "SourceRpm is the source RPM filename that was used to build this package." + }, + "signatures": { + "items": { + "$ref": "#/$defs/RpmSignature" + }, + "type": "array", + "description": "Signatures contains GPG signature metadata for package verification." + }, + "size": { + "type": "integer", + "description": "Size is the total installed size of the package in bytes." + }, + "vendor": { + "type": "string", + "description": "Vendor is the organization that packaged the software." + }, + "modularityLabel": { + "type": "string", + "description": "ModularityLabel identifies the module stream for modular RPM packages (e.g., \"nodejs:12:20200101\")." + }, + "provides": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Provides lists the virtual packages and capabilities this package provides." + }, + "requires": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Requires lists the dependencies required by this package." + }, + "files": { + "items": { + "$ref": "#/$defs/RpmFileRecord" + }, + "type": "array", + "description": "Files are the file records for all files owned by this package." + } + }, + "type": "object", + "required": [ + "name", + "version", + "epoch", + "architecture", + "release", + "sourceRpm", + "size", + "vendor", + "files" + ], + "description": "RpmDBEntry represents all captured data from a RPM DB package entry." + }, + "RpmFileRecord": { + "properties": { + "path": { + "type": "string", + "description": "Path is the absolute file path where the file is installed." + }, + "mode": { + "type": "integer", + "description": "Mode is the file permission mode bits following Unix stat.h conventions." + }, + "size": { + "type": "integer", + "description": "Size is the file size in bytes." + }, + "digest": { + "$ref": "#/$defs/Digest", + "description": "Digest contains the hash algorithm and value for file integrity verification." + }, + "userName": { + "type": "string", + "description": "UserName is the owner username for the file." + }, + "groupName": { + "type": "string", + "description": "GroupName is the group name for the file." + }, + "flags": { + "type": "string", + "description": "Flags indicates the file type (e.g., \"%config\", \"%doc\", \"%ghost\")." + } + }, + "type": "object", + "required": [ + "path", + "mode", + "size", + "digest", + "userName", + "groupName", + "flags" + ], + "description": "RpmFileRecord represents the file metadata for a single file attributed to a RPM package." + }, + "RpmSignature": { + "properties": { + "algo": { + "type": "string", + "description": "PublicKeyAlgorithm is the public key algorithm used for signing (e.g., \"RSA\")." + }, + "hash": { + "type": "string", + "description": "HashAlgorithm is the hash algorithm used for the signature (e.g., \"SHA256\")." + }, + "created": { + "type": "string", + "description": "Created is the timestamp when the signature was created." + }, + "issuer": { + "type": "string", + "description": "IssuerKeyID is the GPG key ID that created the signature." + } + }, + "type": "object", + "required": [ + "algo", + "hash", + "created", + "issuer" + ], + "description": "RpmSignature represents a GPG signature for an RPM package used for authenticity verification." + }, + "RubyGemspec": { + "properties": { + "name": { + "type": "string", + "description": "Name is gem name as specified in the gemspec" + }, + "version": { + "type": "string", + "description": "Version is gem version as specified in the gemspec" + }, + "files": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Files is logical list of files in the gem (NOT directly usable as filesystem paths. Example: bundler gem lists \"lib/bundler/vendor/uri/lib/uri/ldap.rb\" but actual path is \"/usr/local/lib/ruby/3.2.0/bundler/vendor/uri/lib/uri/ldap.rb\". Would need gem installation path, ruby version, and env vars like GEM_HOME to resolve actual paths.)" + }, + "authors": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Authors are the list of gem authors (stored as array regardless of using `author` or `authors` method in gemspec)" + }, + "homepage": { + "type": "string", + "description": "Homepage is project homepage URL" + } + }, + "type": "object", + "required": [ + "name", + "version" + ], + "description": "RubyGemspec represents all metadata parsed from the *.gemspec file" + }, + "RustCargoAuditEntry": { + "properties": { + "name": { + "type": "string", + "description": "Name is crate name as specified in audit section of the build binary" + }, + "version": { + "type": "string", + "description": "Version is crate version as specified in audit section of the build binary" + }, + "source": { + "type": "string", + "description": "Source is the source registry or repository where this crate came from" + } + }, + "type": "object", + "required": [ + "name", + "version", + "source" + ], + "description": "RustBinaryAuditEntry represents Rust crate metadata extracted from a compiled binary using cargo-auditable format." + }, + "RustCargoLockEntry": { + "properties": { + "name": { + "type": "string", + "description": "Name is crate name as specified in Cargo.toml" + }, + "version": { + "type": "string", + "description": "Version is crate version as specified in Cargo.toml" + }, + "source": { + "type": "string", + "description": "Source is the source registry or repository URL in format \"registry+https://github.com/rust-lang/crates.io-index\" for registry packages" + }, + "checksum": { + "type": "string", + "description": "Checksum is content checksum for registry packages only (hexadecimal string). Cargo doesn't require or include checksums for git dependencies. Used to detect MITM attacks by verifying downloaded crate matches lockfile checksum." + }, + "dependencies": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Dependencies are the list of dependencies with version constraints" + } + }, + "type": "object", + "required": [ + "name", + "version", + "source", + "checksum", + "dependencies" + ], + "description": "RustCargoLockEntry represents a locked dependency from a Cargo.lock file with precise version and checksum information." + }, + "SafetensorsModelInfo": { + "properties": { + "format": { + "type": "string", + "description": "Format is the source format label (always \"safetensors\" for this metadata type).\nPresent because the Docker AI model config blob carries an explicit format field" + }, + "architecture": { + "type": "string", + "description": "Architecture is the model architecture (e.g., \"LlamaForCausalLM\",\n\"Qwen3MoeForConditionalGeneration\"). It is not present in the SafeTensors\nheader itself; it is enriched from the companion config.json\n\"architectures\" array when one is found alongside the model." + }, + "quantization": { + "type": "string", + "description": "Quantization describes tensor precision (e.g., \"BF16\", \"F16\", \"F32\", \"INT8\")." + }, + "parameters": { + "type": "integer", + "description": "Parameters is the total number of model parameters, computed from the tensor\nshapes in the SafeTensors header(s). For a sharded model it is the sum across\nevery shard." + }, + "tensorCount": { + "type": "integer", + "description": "TensorCount is the number of tensor entries in the file header." + }, + "totalSize": { + "type": "string", + "description": "TotalSize is the total byte size of tensor data across all shards when known\n(from the Docker AI model config \"size\" field)." + }, + "shardCount": { + "type": "integer", + "description": "ShardCount is the number of .safetensors shards for a sharded model (1 for a\nsingle-file model)." + }, + "userMetadata": { + "$ref": "#/$defs/KeyValues", + "description": "UserMetadata is the optional \"__metadata__\" map from a .safetensors file header\n(string-to-string key/values set by the producer)." + }, + "metadataHash": { + "type": "string", + "description": "MetadataHash is an xxhash over the on-disk SafeTensors header (sorted tensor\nentries + __metadata__). It is derived ONLY from the safetensors file bytes." + }, + "parts": { + "items": { + "$ref": "#/$defs/SafetensorsModelInfo" + }, + "type": "array", + "description": "Parts contains metadata from additional SafeTensors shards or OCI layers that\nwere merged into this package during post-processing." + } + }, + "type": "object", + "description": "SafeTensorsModelInfo holds the model details extracted from SafeTensors content." + }, + "Schema": { + "properties": { + "version": { + "type": "string", + "description": "Version is the JSON schema version for this document format." + }, + "url": { + "type": "string", + "description": "URL is the URL to the JSON schema definition document." + } + }, + "type": "object", + "required": [ + "version", + "url" + ], + "description": "Schema specifies the JSON schema version and URL reference that defines the structure and validation rules for this document format." + }, + "SnapEntry": { + "properties": { + "snapType": { + "type": "string", + "description": "SnapType indicates the snap type (base, kernel, app, gadget, or snapd)." + }, + "base": { + "type": "string", + "description": "Base is the base snap name that this snap depends on (e.g., \"core20\", \"core22\")." + }, + "snapName": { + "type": "string", + "description": "SnapName is the snap package name." + }, + "snapVersion": { + "type": "string", + "description": "SnapVersion is the snap package version." + }, + "architecture": { + "type": "string", + "description": "Architecture is the target CPU architecture (e.g., \"amd64\", \"arm64\")." + } + }, + "type": "object", + "required": [ + "snapType", + "base", + "snapName", + "snapVersion", + "architecture" + ], + "description": "SnapEntry represents metadata for a Snap package extracted from snap.yaml or snapcraft.yaml files." + }, + "Source": { + "properties": { + "id": { + "type": "string", + "description": "ID is a unique identifier for the analyzed source artifact." + }, + "name": { + "type": "string", + "description": "Name is the name of the analyzed artifact (e.g., image name, directory path)." + }, + "version": { + "type": "string", + "description": "Version is the version of the analyzed artifact (e.g., image tag)." + }, + "supplier": { + "type": "string", + "description": "Supplier is supplier information, which can be user-provided for NTIA minimum elements compliance." + }, + "type": { + "type": "string", + "description": "Type is the source type (e.g., \"image\", \"directory\", \"file\")." + }, + "metadata": { + "description": "Metadata contains additional source-specific metadata." + } + }, + "type": "object", + "required": [ + "id", + "name", + "version", + "type", + "metadata" + ], + "description": "Source represents the artifact that was analyzed to generate this SBOM, such as a container image, directory, or file archive." + }, + "SwiftPackageManagerLockEntry": { + "properties": { + "revision": { + "type": "string", + "description": "Revision is git commit hash of the resolved package" + } + }, + "type": "object", + "required": [ + "revision" + ], + "description": "SwiftPackageManagerResolvedEntry represents a resolved dependency from a Package.resolved file with its locked version and source location." + }, + "SwiplpackPackage": { + "properties": { + "name": { + "type": "string", + "description": "Name is the package name as found in the .toml file" + }, + "version": { + "type": "string", + "description": "Version is the package version as found in the .toml file" + }, + "author": { + "type": "string", + "description": "Author is author name" + }, + "authorEmail": { + "type": "string", + "description": "AuthorEmail is author email address" + }, + "packager": { + "type": "string", + "description": "Packager is packager name (if different from author)" + }, + "packagerEmail": { + "type": "string", + "description": "PackagerEmail is packager email address" + }, + "homepage": { + "type": "string", + "description": "Homepage is project homepage URL" + }, + "dependencies": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Dependencies are the list of required dependencies" + } + }, + "type": "object", + "required": [ + "name", + "version", + "author", + "authorEmail", + "packager", + "packagerEmail", + "homepage", + "dependencies" + ], + "description": "SwiplPackEntry represents a SWI-Prolog package from the pack system with metadata about the package and its dependencies." + }, + "TerraformLockProviderEntry": { + "properties": { + "url": { + "type": "string", + "description": "URL is the provider source address (e.g., \"registry.terraform.io/hashicorp/aws\")." + }, + "constraints": { + "type": "string", + "description": "Constraints specifies the version constraints for the provider (e.g., \"~\u003e 4.0\")." + }, + "version": { + "type": "string", + "description": "Version is the locked provider version selected during terraform init." + }, + "hashes": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Hashes are cryptographic checksums for the provider plugin archives across different platforms." + } + }, + "type": "object", + "required": [ + "url", + "constraints", + "version", + "hashes" + ], + "description": "TerraformLockProviderEntry represents a single provider entry in a Terraform dependency lock file (.terraform.lock.hcl)." + }, + "Toolchain": { + "properties": { + "name": { + "type": "string", + "description": "Name is the name of the toolchain (e.g., \"gcc\", \"clang\", \"rust\", \"lld\", \"GNU AS\", etc.)." + }, + "version": { + "type": "string", + "description": "Version is the version of the toolchain." + }, + "component": { + "type": "string", + "description": "Component indicates which part of the toolchain this represents (e.g., compiler, linker, assembler)." + } + }, + "type": "object", + "required": [ + "name", + "component" + ] + }, + "VcpkgManifest": { + "properties": { + "description": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Description is the human-readable description of the package (may be a single string or a list of paragraphs in the manifest)." + }, + "documentation": { + "type": "string", + "description": "Documentation is the URL to the package's documentation." + }, + "full-version": { + "type": "string", + "description": "FullVersion is the complete version string including the port-version suffix (e.g. \"1.2.3#2\")." + }, + "version": { + "type": "string", + "description": "Version is the upstream package version without the port-version suffix (e.g. \"1.2.3\")." + }, + "port-version": { + "type": "integer", + "description": "PortVersion is the vcpkg-specific packaging revision for a given upstream version." + }, + "maintainers": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Maintainers are the people responsible for maintaining the vcpkg port." + }, + "name": { + "type": "string", + "description": "Name is the package name as declared in the manifest." + }, + "supports": { + "type": "string", + "description": "Supports is the platform expression describing which triplets the package can be built for (e.g. \"!windows\")." + }, + "registry": { + "$ref": "#/$defs/VcpkgRegistryEntry", + "description": "Registry indicates where the package definition came from." + }, + "triplet": { + "type": "string", + "description": "Triplet is the build target discovered from the build folder (e.g. \"x64-linux\")." + } + }, + "type": "object", + "required": [ + "full-version", + "version", + "port-version", + "name" + ], + "description": "VcpkgManifest summarizes the data found in a vcpkg manifest (vcpkg.json) relevant to a single vcpkg package." + }, + "VcpkgRegistryEntry": { + "properties": { + "baseline": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "packages": { + "items": { + "type": "string" + }, + "type": "array" + }, + "path": { + "type": "string" + }, + "reference": { + "type": "string" + }, + "repository": { + "type": "string" + } + }, + "type": "object", + "required": [ + "kind" + ], + "description": "Matches definition of Vcpkg \"Registry\"." + }, + "WordpressPluginEntry": { + "properties": { + "pluginInstallDirectory": { + "type": "string", + "description": "PluginInstallDirectory is directory name where the plugin is installed" + }, + "author": { + "type": "string", + "description": "Author is plugin author name" + }, + "authorUri": { + "type": "string", + "description": "AuthorURI is author's website URL" + } + }, + "type": "object", + "required": [ + "pluginInstallDirectory" + ], + "description": "WordpressPluginEntry represents all metadata parsed from the wordpress plugin file" + }, + "cpes": { + "items": { + "$ref": "#/$defs/CPE" + }, + "type": "array" + }, + "licenses": { + "items": { + "$ref": "#/$defs/License" + }, + "type": "array" + } + } +} diff --git a/schema/json/schema-latest.json b/schema/json/schema-latest.json index 37a658238..e0262493d 100644 --- a/schema/json/schema-latest.json +++ b/schema/json/schema-latest.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "anchore.io/schema/syft/json/16.1.10/document", + "$id": "anchore.io/schema/syft/json/16.1.11/document", "$ref": "#/$defs/Document", "$defs": { "AlpmDbEntry": { @@ -1398,6 +1398,13 @@ "elfSecurityFeatures": { "$ref": "#/$defs/ELFSecurityFeatures", "description": "ELFSecurityFeatures contains ELF-specific security hardening information when Format is ELF." + }, + "toolchains": { + "items": { + "$ref": "#/$defs/Toolchain" + }, + "type": "array", + "description": "Toolchains captures information about the compiler, linker, runtime, or other toolchains used to build (or otherwise exist within) the executable." } }, "type": "object", @@ -4450,6 +4457,27 @@ ], "description": "TerraformLockProviderEntry represents a single provider entry in a Terraform dependency lock file (.terraform.lock.hcl)." }, + "Toolchain": { + "properties": { + "name": { + "type": "string", + "description": "Name is the name of the toolchain (e.g., \"gcc\", \"clang\", \"rust\", \"lld\", \"GNU AS\", etc.)." + }, + "version": { + "type": "string", + "description": "Version is the version of the toolchain." + }, + "component": { + "type": "string", + "description": "Component indicates which part of the toolchain this represents (e.g., compiler, linker, assembler)." + } + }, + "type": "object", + "required": [ + "name", + "component" + ] + }, "VcpkgManifest": { "properties": { "description": { diff --git a/syft/file/cataloger/executable/cataloger.go b/syft/file/cataloger/executable/cataloger.go index 552698f48..d0c4fe477 100644 --- a/syft/file/cataloger/executable/cataloger.go +++ b/syft/file/cataloger/executable/cataloger.go @@ -26,8 +26,11 @@ import ( ) type Config struct { + // MIMETypes are the MIME types that will be considered for executable cataloging. MIMETypes []string `json:"mime-types" yaml:"mime-types" mapstructure:"mime-types"` - Globs []string `json:"globs" yaml:"globs" mapstructure:"globs"` + + // Globs are the glob patterns that will be used to filter which files are cataloged. + Globs []string `json:"globs" yaml:"globs" mapstructure:"globs"` } type Cataloger struct { @@ -116,6 +119,51 @@ func processExecutableLocation(loc file.Location, resolver file.Resolver) (exec return processExecutable(loc, uReader) } +func processExecutable(loc file.Location, reader unionreader.UnionReader) (*file.Executable, error) { + data := file.Executable{} + + // determine the executable format + + format, err := findExecutableFormat(reader) + if err != nil { + log.Debugf("unable to determine executable kind for %v: %v", loc.RealPath, err) + return nil, fmt.Errorf("unable to determine executable kind: %w", err) + } + + if format == "" { + // this is not an "unknown", so just log -- this binary does not have parseable data in it + log.Debugf("unable to determine executable format for %q", loc.RealPath) + return nil, nil + } + + data.Format = format + + switch format { + case file.ELF: + if err = findELFFeatures(&data, reader); err != nil { + log.WithFields("error", err, "path", loc.RealPath).Trace("unable to determine ELF features") + err = fmt.Errorf("unable to determine ELF features: %w", err) + } + case file.PE: + if err = findPEFeatures(&data, reader); err != nil { + log.WithFields("error", err, "path", loc.RealPath).Trace("unable to determine PE features") + err = fmt.Errorf("unable to determine PE features: %w", err) + } + case file.MachO: + if err = findMachoFeatures(&data, reader); err != nil { + log.WithFields("error", err, "path", loc.RealPath).Trace("unable to determine Macho features") + err = fmt.Errorf("unable to determine Macho features: %w", err) + } + } + + // always allocate collections for presentation + if data.ImportedLibraries == nil { + data.ImportedLibraries = []string{} + } + + return &data, err +} + func catalogingProgress(locations int64) *monitor.TaskProgress { info := monitor.GenericTask{ Title: monitor.Title{ @@ -162,51 +210,6 @@ func locationMatchesGlob(loc file.Location, globs []string) (bool, error) { return false, nil } -func processExecutable(loc file.Location, reader unionreader.UnionReader) (*file.Executable, error) { - data := file.Executable{} - - // determine the executable format - - format, err := findExecutableFormat(reader) - if err != nil { - log.Debugf("unable to determine executable kind for %v: %v", loc.RealPath, err) - return nil, fmt.Errorf("unable to determine executable kind: %w", err) - } - - if format == "" { - // this is not an "unknown", so just log -- this binary does not have parseable data in it - log.Debugf("unable to determine executable format for %q", loc.RealPath) - return nil, nil - } - - data.Format = format - - switch format { - case file.ELF: - if err = findELFFeatures(&data, reader); err != nil { - log.WithFields("error", err, "path", loc.RealPath).Trace("unable to determine ELF features") - err = fmt.Errorf("unable to determine ELF features: %w", err) - } - case file.PE: - if err = findPEFeatures(&data, reader); err != nil { - log.WithFields("error", err, "path", loc.RealPath).Trace("unable to determine PE features") - err = fmt.Errorf("unable to determine PE features: %w", err) - } - case file.MachO: - if err = findMachoFeatures(&data, reader); err != nil { - log.WithFields("error", err, "path", loc.RealPath).Trace("unable to determine Macho features") - err = fmt.Errorf("unable to determine Macho features: %w", err) - } - } - - // always allocate collections for presentation - if data.ImportedLibraries == nil { - data.ImportedLibraries = []string{} - } - - return &data, err -} - func findExecutableFormat(reader unionreader.UnionReader) (file.ExecutableFormat, error) { // read the first sector of the file buf := make([]byte, 512) diff --git a/syft/file/cataloger/executable/elf.go b/syft/file/cataloger/executable/elf.go index b58b3eaa2..c84cee617 100644 --- a/syft/file/cataloger/executable/elf.go +++ b/syft/file/cataloger/executable/elf.go @@ -35,10 +35,33 @@ func findELFFeatures(data *file.Executable, reader unionreader.UnionReader) erro data.ELFSecurityFeatures = findELFSecurityFeatures(f) data.HasEntrypoint = elfHasEntrypoint(f) data.HasExports = elfHasExports(f) + data.Toolchains = elfToolchains(reader, f) return err } +func elfToolchains(reader unionreader.UnionReader, f *elf.File) []file.Toolchain { + // parse the .comment section and symbol tables once and share them across the detectors + comments := elfComments(f) + symbols := elfSymbolSet(f) + return includeNoneNil( + golangToolchainEvidence(reader), + cToolchainEvidence(comments, symbols), + rustToolchainEvidence(comments), + linkerToolchainEvidence(f, comments), + ) +} + +func includeNoneNil(evidence ...*file.Toolchain) []file.Toolchain { + var toolchains []file.Toolchain + for _, e := range evidence { + if e != nil { + toolchains = append(toolchains, *e) + } + } + return toolchains +} + func findELFSecurityFeatures(f *elf.File) *file.ELFSecurityFeatures { return &file.ELFSecurityFeatures{ SymbolTableStripped: isElfSymbolTableStripped(f), @@ -82,6 +105,28 @@ func boolRef(b bool) *bool { return &b } +// elfSymbolSet collects the names from the static and dynamic symbol tables into a single set, so +// detectors can test for runtime markers without re-reading and re-iterating the symbol tables each +// time. It covers both tables since some evidence (e.g. the Fortran MAIN__ entry) lives only in the +// static symbol table. +func elfSymbolSet(f *elf.File) *strset.Set { + set := strset.New() + + if syms, err := f.Symbols(); err == nil { + for _, sym := range syms { + set.Add(sym.Name) + } + } + + if dynSyms, err := f.DynamicSymbols(); err == nil { + for _, sym := range dynSyms { + set.Add(sym.Name) + } + } + + return set +} + func checkElfNXProtection(file *elf.File) bool { // find the program headers until you find the GNU_STACK segment for _, prog := range file.Progs { diff --git a/syft/file/cataloger/executable/elf_test.go b/syft/file/cataloger/executable/elf_test.go index 23b19eced..170fcad3a 100644 --- a/syft/file/cataloger/executable/elf_test.go +++ b/syft/file/cataloger/executable/elf_test.go @@ -9,6 +9,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -314,3 +315,73 @@ func elfWithDynamicSection(t *testing.T, class elf.Class, dynamic []byte) []byte buf.Write(dynamic) return buf.Bytes() } + +func Test_elfGoToolchainDetection(t *testing.T) { + readerForFixture := func(t *testing.T, fixture string) unionreader.UnionReader { + t.Helper() + f, err := os.Open(filepath.Join("testdata/golang", fixture)) + require.NoError(t, err) + return f + } + + tests := []struct { + name string + fixture string + wantPresent bool + }{ + { + name: "go binary has toolchain", + fixture: "bin/hello_linux", + wantPresent: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + reader := readerForFixture(t, tt.fixture) + f, err := elf.NewFile(reader) + require.NoError(t, err) + + toolchains := elfToolchains(reader, f) + assert.Equal(t, tt.wantPresent, hasGoToolchain(toolchains)) + + if tt.wantPresent { + require.NotEmpty(t, toolchains) + assert.Equal(t, "go", toolchains[0].Name) + assert.NotEmpty(t, toolchains[0].Version) + assert.Equal(t, file.ToolchainComponentCompiler, toolchains[0].Component) + } + }) + } +} + +func Test_elfCgoToolchainDetection(t *testing.T) { + readerForFixture := func(t *testing.T, fixture string) unionreader.UnionReader { + t.Helper() + f, err := os.Open(filepath.Join("testdata/golang", fixture)) + require.NoError(t, err) + return f + } + + t.Run("cgo binary has both go and c toolchains", func(t *testing.T) { + reader := readerForFixture(t, "bin/hello_linux_cgo") + f, err := elf.NewFile(reader) + require.NoError(t, err) + + toolchains := elfToolchains(reader, f) + + // versions are dynamic based on Docker image, so we ignore them in comparison + want := []file.Toolchain{ + {Name: "go", Component: file.ToolchainComponentCompiler}, + {Name: "gcc", Component: file.ToolchainComponentCompiler}, + } + + if d := cmp.Diff(want, toolchains, cmpopts.IgnoreFields(file.Toolchain{}, "Version")); d != "" { + t.Errorf("elfToolchains() mismatch (-want +got):\n%s", d) + } + + // verify versions are populated + for _, tc := range toolchains { + assert.NotEmpty(t, tc.Version, "expected version to be set for %s toolchain", tc.Name) + } + }) +} diff --git a/syft/file/cataloger/executable/macho.go b/syft/file/cataloger/executable/macho.go index 7cd80f7e5..960ec33f6 100644 --- a/syft/file/cataloger/executable/macho.go +++ b/syft/file/cataloger/executable/macho.go @@ -48,6 +48,8 @@ func findMachoFeatures(data *file.Executable, reader unionreader.UnionReader) er if !data.HasExports { data.HasExports = machoHasExports(f) } + + data.Toolchains = machoToolchains(reader) } // de-duplicate libraries @@ -56,6 +58,12 @@ func findMachoFeatures(data *file.Executable, reader unionreader.UnionReader) er return nil } +func machoToolchains(reader unionreader.UnionReader) []file.Toolchain { + return includeNoneNil( + golangToolchainEvidence(reader), + ) +} + func machoHasEntrypoint(f *macho.File) bool { // derived from struct entry_point_command found from which explicitly calls out LC_MAIN: // https://opensource.apple.com/source/xnu/xnu-2050.18.24/EXTERNAL_HEADERS/mach-o/loader.h diff --git a/syft/file/cataloger/executable/macho_test.go b/syft/file/cataloger/executable/macho_test.go index ed6fc5ff8..7a251e8d2 100644 --- a/syft/file/cataloger/executable/macho_test.go +++ b/syft/file/cataloger/executable/macho_test.go @@ -120,3 +120,39 @@ func Test_machoUniversal(t *testing.T) { }) } } + +func Test_machoGoToolchainDetection(t *testing.T) { + readerForFixture := func(t *testing.T, fixture string) unionreader.UnionReader { + t.Helper() + f, err := os.Open(filepath.Join("testdata/golang", fixture)) + require.NoError(t, err) + return f + } + + tests := []struct { + name string + fixture string + wantPresent bool + }{ + { + name: "go binary has toolchain", + fixture: "bin/hello_mac", + wantPresent: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + reader := readerForFixture(t, tt.fixture) + + toolchains := machoToolchains(reader) + assert.Equal(t, tt.wantPresent, hasGoToolchain(toolchains)) + + if tt.wantPresent { + require.NotEmpty(t, toolchains) + assert.Equal(t, "go", toolchains[0].Name) + assert.NotEmpty(t, toolchains[0].Version) + assert.Equal(t, file.ToolchainComponentCompiler, toolchains[0].Component) + } + }) + } +} diff --git a/syft/file/cataloger/executable/pe.go b/syft/file/cataloger/executable/pe.go index b070c3c84..476048fd9 100644 --- a/syft/file/cataloger/executable/pe.go +++ b/syft/file/cataloger/executable/pe.go @@ -25,6 +25,7 @@ func findPEFeatures(data *file.Executable, reader unionreader.UnionReader) error data.ImportedLibraries = libs data.HasEntrypoint = peHasEntrypoint(f) data.HasExports = peHasExports(f) + data.Toolchains = peToolchains(reader) return nil } @@ -82,3 +83,9 @@ func peHasExports(f *pe.File) bool { return false } + +func peToolchains(reader unionreader.UnionReader) []file.Toolchain { + return includeNoneNil( + golangToolchainEvidence(reader), + ) +} diff --git a/syft/file/cataloger/executable/pe_test.go b/syft/file/cataloger/executable/pe_test.go index 0c4b73584..bb34e5745 100644 --- a/syft/file/cataloger/executable/pe_test.go +++ b/syft/file/cataloger/executable/pe_test.go @@ -9,6 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/anchore/syft/syft/file" "github.com/anchore/syft/syft/internal/unionreader" ) @@ -78,3 +79,39 @@ func Test_peHasExports(t *testing.T) { }) } } + +func Test_peGoToolchainDetection(t *testing.T) { + readerForFixture := func(t *testing.T, fixture string) unionreader.UnionReader { + t.Helper() + f, err := os.Open(filepath.Join("testdata/golang", fixture)) + require.NoError(t, err) + return f + } + + tests := []struct { + name string + fixture string + wantPresent bool + }{ + { + name: "go binary has toolchain", + fixture: "bin/hello.exe", + wantPresent: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + reader := readerForFixture(t, tt.fixture) + + toolchains := peToolchains(reader) + assert.Equal(t, tt.wantPresent, hasGoToolchain(toolchains)) + + if tt.wantPresent { + require.NotEmpty(t, toolchains) + assert.Equal(t, "go", toolchains[0].Name) + assert.NotEmpty(t, toolchains[0].Version) + assert.Equal(t, file.ToolchainComponentCompiler, toolchains[0].Component) + } + }) + } +} diff --git a/syft/file/cataloger/executable/testdata/.gitignore b/syft/file/cataloger/executable/testdata/.gitignore index 89845afaa..602229c58 100644 --- a/syft/file/cataloger/executable/testdata/.gitignore +++ b/syft/file/cataloger/executable/testdata/.gitignore @@ -1,3 +1,4 @@ bin actual_verify -Dockerfile.sha256 \ No newline at end of file +Dockerfile.sha256 +*.fingerprint \ No newline at end of file diff --git a/syft/file/cataloger/executable/testdata/golang/Dockerfile b/syft/file/cataloger/executable/testdata/golang/Dockerfile new file mode 100644 index 000000000..557085672 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/golang/Dockerfile @@ -0,0 +1,18 @@ +FROM golang:1.24 + +WORKDIR /app + +COPY go.mod go.sum ./ +RUN go mod download + +COPY main.go cgo_main.go ./ + +# pure Go builds (no CGO) +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /hello_linux . + +RUN CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o /hello_mac . + +RUN CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o /hello.exe . + +# CGO-enabled build (Linux only, uses gcc) +RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o /hello_linux_cgo ./cgo_main.go diff --git a/syft/file/cataloger/executable/testdata/golang/Makefile b/syft/file/cataloger/executable/testdata/golang/Makefile new file mode 100644 index 000000000..8cc87fe2f --- /dev/null +++ b/syft/file/cataloger/executable/testdata/golang/Makefile @@ -0,0 +1,42 @@ +BIN=./bin +TOOL_IMAGE=localhost/syft-golang-build-tools:latest +FINGERPRINT_FILE=$(BIN).fingerprint + +ifndef BIN + $(error BIN is not set) +endif + +.DEFAULT_GOAL := fixtures + +# requirement 1: 'fixtures' goal to generate any and all test fixtures +fixtures: build + +# requirement 2: 'fingerprint' goal to determine if the fixture input that indicates any existing cache should be busted +fingerprint: $(FINGERPRINT_FILE) + +tools-check: + @sha256sum -c Dockerfile.sha256 || (echo "Tools Dockerfile has changed" && exit 1) + +tools: + @(docker inspect $(TOOL_IMAGE) > /dev/null && make tools-check) || \ + (docker build --platform=linux/amd64 -t $(TOOL_IMAGE) . && sha256sum Dockerfile > Dockerfile.sha256) + +build: tools + @mkdir -p $(BIN) + docker run -i -v $(shell pwd)/$(BIN):/out $(TOOL_IMAGE) sh -c \ + "cp /hello_linux /hello_mac /hello.exe /hello_linux_cgo /out/" + +debug: + docker run -it --rm -v $(shell pwd):/mount -w /mount $(TOOL_IMAGE) sh + +# requirement 3: we always need to recalculate the fingerprint based on source regardless of any existing fingerprint +.PHONY: $(FINGERPRINT_FILE) +$(FINGERPRINT_FILE): + @find . -maxdepth 1 -type f \( -name "*.go" -o -name "go.*" -o -name "Dockerfile" -o -name "Makefile" \) \ + -exec sha256sum {} \; | sort -k2 > $(FINGERPRINT_FILE) + +# requirement 4: 'clean' goal to remove all generated test fixtures +clean: + rm -rf $(BIN) Dockerfile.sha256 $(FINGERPRINT_FILE) + +.PHONY: tools tools-check build debug clean fixtures fingerprint diff --git a/syft/file/cataloger/executable/testdata/golang/cgo_main.go b/syft/file/cataloger/executable/testdata/golang/cgo_main.go new file mode 100644 index 000000000..26a51030d --- /dev/null +++ b/syft/file/cataloger/executable/testdata/golang/cgo_main.go @@ -0,0 +1,18 @@ +package main + +/* +#include +#include + +int get_length(const char* s) { + return strlen(s); +} +*/ +import "C" +import "fmt" + +func main() { + msg := C.CString("Hello from CGO!") + length := C.get_length(msg) + fmt.Printf("String length: %d\n", int(length)) +} diff --git a/syft/file/cataloger/executable/testdata/golang/go.mod b/syft/file/cataloger/executable/testdata/golang/go.mod new file mode 100644 index 000000000..4c7e7c0ba --- /dev/null +++ b/syft/file/cataloger/executable/testdata/golang/go.mod @@ -0,0 +1,8 @@ +module x + +go 1.24.4 + +require ( + github.com/davecgh/go-spew v1.1.1 + golang.org/x/text v0.21.0 +) diff --git a/syft/file/cataloger/executable/testdata/golang/go.sum b/syft/file/cataloger/executable/testdata/golang/go.sum new file mode 100644 index 000000000..04d2f50ec --- /dev/null +++ b/syft/file/cataloger/executable/testdata/golang/go.sum @@ -0,0 +1,4 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= diff --git a/syft/file/cataloger/executable/testdata/golang/main.go b/syft/file/cataloger/executable/testdata/golang/main.go new file mode 100644 index 000000000..d660a122c --- /dev/null +++ b/syft/file/cataloger/executable/testdata/golang/main.go @@ -0,0 +1,28 @@ +package main + +import ( + "encoding/json" + "fmt" + "os" + "strings" + + "github.com/davecgh/go-spew/spew" + "golang.org/x/text/language" +) + +func main() { + // use stdlib packages + fmt.Println("Hello from Go!") + fmt.Println(strings.ToUpper("test")) + + // use golang.org/x package + tag := language.English + fmt.Println(tag.String()) + + // use third-party package + spew.Dump(os.Args) + + // use encoding/json + data, _ := json.Marshal(map[string]string{"hello": "world"}) + fmt.Println(string(data)) +} diff --git a/syft/file/cataloger/executable/testdata/toolchains/.gitignore b/syft/file/cataloger/executable/testdata/toolchains/.gitignore new file mode 100644 index 000000000..f63d726bc --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/.gitignore @@ -0,0 +1,3 @@ +bin/ +Dockerfile.sha256 +*.fingerprint diff --git a/syft/file/cataloger/executable/testdata/toolchains/Makefile b/syft/file/cataloger/executable/testdata/toolchains/Makefile new file mode 100644 index 000000000..51cc7e8a3 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/Makefile @@ -0,0 +1,39 @@ +# invoke all make files in subdirectories +.PHONY: all gcc clang lld mold gold rust fortran gdc gccgo gnat + +all: gcc clang lld mold gold rust fortran gdc gccgo gnat + +gcc: + $(MAKE) -C gcc + +clang: + $(MAKE) -C clang + +lld: + $(MAKE) -C lld + +mold: + $(MAKE) -C mold + +gold: + $(MAKE) -C gold + +rust: + $(MAKE) -C rust + +fortran: + $(MAKE) -C fortran + +gdc: + $(MAKE) -C gdc + +gccgo: + $(MAKE) -C gccgo + +gnat: + $(MAKE) -C gnat + +%: + @for dir in gcc clang lld mold gold rust fortran gdc gccgo gnat; do \ + $(MAKE) -C $$dir $@; \ + done diff --git a/syft/file/cataloger/executable/testdata/toolchains/clang/Dockerfile b/syft/file/cataloger/executable/testdata/toolchains/clang/Dockerfile new file mode 100644 index 000000000..4f74c377a --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/clang/Dockerfile @@ -0,0 +1,6 @@ +FROM alpine:3.21.7@sha256:48b0309ca019d89d40f670aa1bc06e426dc0931948452e8491e3d65087abc07d + +RUN apk add --no-cache clang18 musl-dev make + +# create symlink so 'clang' command works (Alpine installs as clang-18) +RUN ln -s /usr/bin/clang-18 /usr/bin/clang diff --git a/syft/file/cataloger/executable/testdata/toolchains/clang/Makefile b/syft/file/cataloger/executable/testdata/toolchains/clang/Makefile new file mode 100644 index 000000000..e727f5951 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/clang/Makefile @@ -0,0 +1,39 @@ +BIN=./bin +TOOL_IMAGE=localhost/syft-toolchain-clang-build-tools:latest +FINGERPRINT_FILE=$(BIN).fingerprint + +ifndef BIN + $(error BIN is not set) +endif + +.DEFAULT_GOAL := fixtures + +# requirement 1: 'fixtures' goal to generate any and all test fixtures +fixtures: build + +# requirement 2: 'fingerprint' goal to determine if the fixture input that indicates any existing cache should be busted +fingerprint: $(FINGERPRINT_FILE) + +tools-check: + @sha256sum -c Dockerfile.sha256 || (echo "Tools Dockerfile has changed" && exit 1) + +tools: + @(docker inspect $(TOOL_IMAGE) > /dev/null && make tools-check) || (docker build --platform linux/amd64 -t $(TOOL_IMAGE) . && sha256sum Dockerfile > Dockerfile.sha256) + +build: tools + @mkdir -p $(BIN) + docker run --platform linux/amd64 -i -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) make + +debug: + docker run --platform linux/amd64 -i --rm -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) bash + +# requirement 3: we always need to recalculate the fingerprint based on source regardless of any existing fingerprint +.PHONY: $(FINGERPRINT_FILE) +$(FINGERPRINT_FILE): + @find project Dockerfile Makefile -type f -exec sha256sum {} \; | sort -k2 > $(FINGERPRINT_FILE) + +# requirement 4: 'clean' goal to remove all generated test fixtures +clean: + rm -rf $(BIN) Dockerfile.sha256 $(FINGERPRINT_FILE) + +.PHONY: tools tools-check build debug clean diff --git a/syft/file/cataloger/executable/testdata/toolchains/clang/project/Makefile b/syft/file/cataloger/executable/testdata/toolchains/clang/project/Makefile new file mode 100644 index 000000000..3c2392076 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/clang/project/Makefile @@ -0,0 +1,9 @@ +BIN=../bin + +all: $(BIN)/hello_clang + +$(BIN)/hello_clang: hello.c + clang hello.c -o $(BIN)/hello_clang + +clean: + rm -f $(BIN)/hello_clang diff --git a/syft/file/cataloger/executable/testdata/toolchains/clang/project/hello.c b/syft/file/cataloger/executable/testdata/toolchains/clang/project/hello.c new file mode 100644 index 000000000..f26b97c98 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/clang/project/hello.c @@ -0,0 +1,6 @@ +#include + +int main() { + printf("Hello, World!\n"); + return 0; +} diff --git a/syft/file/cataloger/executable/testdata/toolchains/fortran/Dockerfile b/syft/file/cataloger/executable/testdata/toolchains/fortran/Dockerfile new file mode 100644 index 000000000..659d9e5f0 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/fortran/Dockerfile @@ -0,0 +1 @@ +FROM gcc:13.4.0@sha256:d49302cbe2faf1a2dece312e258325e0d39e32874ea4dec122b4ac86f45d5b50 diff --git a/syft/file/cataloger/executable/testdata/toolchains/fortran/Makefile b/syft/file/cataloger/executable/testdata/toolchains/fortran/Makefile new file mode 100644 index 000000000..a801ffd96 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/fortran/Makefile @@ -0,0 +1,39 @@ +BIN=./bin +TOOL_IMAGE=localhost/syft-toolchain-fortran-build-tools:latest +FINGERPRINT_FILE=$(BIN).fingerprint + +ifndef BIN + $(error BIN is not set) +endif + +.DEFAULT_GOAL := fixtures + +# requirement 1: 'fixtures' goal to generate any and all test fixtures +fixtures: build + +# requirement 2: 'fingerprint' goal to determine if the fixture input that indicates any existing cache should be busted +fingerprint: $(FINGERPRINT_FILE) + +tools-check: + @sha256sum -c Dockerfile.sha256 || (echo "Tools Dockerfile has changed" && exit 1) + +tools: + @(docker inspect $(TOOL_IMAGE) > /dev/null && make tools-check) || (docker build --platform linux/amd64 -t $(TOOL_IMAGE) . && sha256sum Dockerfile > Dockerfile.sha256) + +build: tools + @mkdir -p $(BIN) + docker run --platform linux/amd64 -i -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) make + +debug: + docker run --platform linux/amd64 -i --rm -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) bash + +# requirement 3: we always need to recalculate the fingerprint based on source regardless of any existing fingerprint +.PHONY: $(FINGERPRINT_FILE) +$(FINGERPRINT_FILE): + @find project Dockerfile Makefile -type f -exec sha256sum {} \; | sort -k2 > $(FINGERPRINT_FILE) + +# requirement 4: 'clean' goal to remove all generated test fixtures +clean: + rm -rf $(BIN) Dockerfile.sha256 $(FINGERPRINT_FILE) + +.PHONY: tools tools-check build debug clean diff --git a/syft/file/cataloger/executable/testdata/toolchains/fortran/project/Makefile b/syft/file/cataloger/executable/testdata/toolchains/fortran/project/Makefile new file mode 100644 index 000000000..f8c142525 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/fortran/project/Makefile @@ -0,0 +1,9 @@ +BIN=../bin + +all: $(BIN)/hello_fortran + +$(BIN)/hello_fortran: hello.f90 + gfortran hello.f90 -o $(BIN)/hello_fortran + +clean: + rm -f $(BIN)/hello_fortran diff --git a/syft/file/cataloger/executable/testdata/toolchains/fortran/project/hello.f90 b/syft/file/cataloger/executable/testdata/toolchains/fortran/project/hello.f90 new file mode 100644 index 000000000..8b899591e --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/fortran/project/hello.f90 @@ -0,0 +1,3 @@ +program hello + print *, "Hello, World!" +end program hello diff --git a/syft/file/cataloger/executable/testdata/toolchains/gcc/Dockerfile b/syft/file/cataloger/executable/testdata/toolchains/gcc/Dockerfile new file mode 100644 index 000000000..659d9e5f0 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/gcc/Dockerfile @@ -0,0 +1 @@ +FROM gcc:13.4.0@sha256:d49302cbe2faf1a2dece312e258325e0d39e32874ea4dec122b4ac86f45d5b50 diff --git a/syft/file/cataloger/executable/testdata/toolchains/gcc/Makefile b/syft/file/cataloger/executable/testdata/toolchains/gcc/Makefile new file mode 100644 index 000000000..944b78bd5 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/gcc/Makefile @@ -0,0 +1,39 @@ +BIN=./bin +TOOL_IMAGE=localhost/syft-toolchain-gcc-build-tools:latest +FINGERPRINT_FILE=$(BIN).fingerprint + +ifndef BIN + $(error BIN is not set) +endif + +.DEFAULT_GOAL := fixtures + +# requirement 1: 'fixtures' goal to generate any and all test fixtures +fixtures: build + +# requirement 2: 'fingerprint' goal to determine if the fixture input that indicates any existing cache should be busted +fingerprint: $(FINGERPRINT_FILE) + +tools-check: + @sha256sum -c Dockerfile.sha256 || (echo "Tools Dockerfile has changed" && exit 1) + +tools: + @(docker inspect $(TOOL_IMAGE) > /dev/null && make tools-check) || (docker build --platform linux/amd64 -t $(TOOL_IMAGE) . && sha256sum Dockerfile > Dockerfile.sha256) + +build: tools + @mkdir -p $(BIN) + docker run --platform linux/amd64 -i -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) make + +debug: + docker run --platform linux/amd64 -i --rm -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) bash + +# requirement 3: we always need to recalculate the fingerprint based on source regardless of any existing fingerprint +.PHONY: $(FINGERPRINT_FILE) +$(FINGERPRINT_FILE): + @find project Dockerfile Makefile -type f -exec sha256sum {} \; | sort -k2 > $(FINGERPRINT_FILE) + +# requirement 4: 'clean' goal to remove all generated test fixtures +clean: + rm -rf $(BIN) Dockerfile.sha256 $(FINGERPRINT_FILE) + +.PHONY: tools tools-check build debug clean diff --git a/syft/file/cataloger/executable/testdata/toolchains/gcc/project/Makefile b/syft/file/cataloger/executable/testdata/toolchains/gcc/project/Makefile new file mode 100644 index 000000000..124b9d9ac --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/gcc/project/Makefile @@ -0,0 +1,9 @@ +BIN=../bin + +all: $(BIN)/hello_gcc + +$(BIN)/hello_gcc: hello.c + gcc hello.c -o $(BIN)/hello_gcc + +clean: + rm -f $(BIN)/hello_gcc diff --git a/syft/file/cataloger/executable/testdata/toolchains/gcc/project/hello.c b/syft/file/cataloger/executable/testdata/toolchains/gcc/project/hello.c new file mode 100644 index 000000000..f26b97c98 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/gcc/project/hello.c @@ -0,0 +1,6 @@ +#include + +int main() { + printf("Hello, World!\n"); + return 0; +} diff --git a/syft/file/cataloger/executable/testdata/toolchains/gccgo/Dockerfile b/syft/file/cataloger/executable/testdata/toolchains/gccgo/Dockerfile new file mode 100644 index 000000000..1dd575642 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/gccgo/Dockerfile @@ -0,0 +1,3 @@ +FROM debian:12.14@sha256:49ba348354a28e39c70beffd6cf43bdb8d55d81ce4b746b0428717d054b8bbc4 + +RUN apt-get update && apt-get install -y --no-install-recommends gccgo make && rm -rf /var/lib/apt/lists/* diff --git a/syft/file/cataloger/executable/testdata/toolchains/gccgo/Makefile b/syft/file/cataloger/executable/testdata/toolchains/gccgo/Makefile new file mode 100644 index 000000000..a420b8bbc --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/gccgo/Makefile @@ -0,0 +1,39 @@ +BIN=./bin +TOOL_IMAGE=localhost/syft-toolchain-gccgo-build-tools:latest +FINGERPRINT_FILE=$(BIN).fingerprint + +ifndef BIN + $(error BIN is not set) +endif + +.DEFAULT_GOAL := fixtures + +# requirement 1: 'fixtures' goal to generate any and all test fixtures +fixtures: build + +# requirement 2: 'fingerprint' goal to determine if the fixture input that indicates any existing cache should be busted +fingerprint: $(FINGERPRINT_FILE) + +tools-check: + @sha256sum -c Dockerfile.sha256 || (echo "Tools Dockerfile has changed" && exit 1) + +tools: + @(docker inspect $(TOOL_IMAGE) > /dev/null && make tools-check) || (docker build --platform linux/amd64 -t $(TOOL_IMAGE) . && sha256sum Dockerfile > Dockerfile.sha256) + +build: tools + @mkdir -p $(BIN) + docker run --platform linux/amd64 -i -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) make + +debug: + docker run --platform linux/amd64 -i --rm -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) bash + +# requirement 3: we always need to recalculate the fingerprint based on source regardless of any existing fingerprint +.PHONY: $(FINGERPRINT_FILE) +$(FINGERPRINT_FILE): + @find project Dockerfile Makefile -type f -exec sha256sum {} \; | sort -k2 > $(FINGERPRINT_FILE) + +# requirement 4: 'clean' goal to remove all generated test fixtures +clean: + rm -rf $(BIN) Dockerfile.sha256 $(FINGERPRINT_FILE) + +.PHONY: tools tools-check build debug clean diff --git a/syft/file/cataloger/executable/testdata/toolchains/gccgo/project/Makefile b/syft/file/cataloger/executable/testdata/toolchains/gccgo/project/Makefile new file mode 100644 index 000000000..915df7f9c --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/gccgo/project/Makefile @@ -0,0 +1,9 @@ +BIN=../bin + +all: $(BIN)/hello_gccgo + +$(BIN)/hello_gccgo: hello.go + gccgo hello.go -o $(BIN)/hello_gccgo + +clean: + rm -f $(BIN)/hello_gccgo diff --git a/syft/file/cataloger/executable/testdata/toolchains/gccgo/project/hello.go b/syft/file/cataloger/executable/testdata/toolchains/gccgo/project/hello.go new file mode 100644 index 000000000..16e2b22ac --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/gccgo/project/hello.go @@ -0,0 +1,5 @@ +package main + +func main() { + println("Hello, World!") +} diff --git a/syft/file/cataloger/executable/testdata/toolchains/gdc/Dockerfile b/syft/file/cataloger/executable/testdata/toolchains/gdc/Dockerfile new file mode 100644 index 000000000..e8cfcba2e --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/gdc/Dockerfile @@ -0,0 +1,3 @@ +FROM debian:12.14@sha256:49ba348354a28e39c70beffd6cf43bdb8d55d81ce4b746b0428717d054b8bbc4 + +RUN apt-get update && apt-get install -y --no-install-recommends gdc make && rm -rf /var/lib/apt/lists/* diff --git a/syft/file/cataloger/executable/testdata/toolchains/gdc/Makefile b/syft/file/cataloger/executable/testdata/toolchains/gdc/Makefile new file mode 100644 index 000000000..6dec86fb3 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/gdc/Makefile @@ -0,0 +1,39 @@ +BIN=./bin +TOOL_IMAGE=localhost/syft-toolchain-gdc-build-tools:latest +FINGERPRINT_FILE=$(BIN).fingerprint + +ifndef BIN + $(error BIN is not set) +endif + +.DEFAULT_GOAL := fixtures + +# requirement 1: 'fixtures' goal to generate any and all test fixtures +fixtures: build + +# requirement 2: 'fingerprint' goal to determine if the fixture input that indicates any existing cache should be busted +fingerprint: $(FINGERPRINT_FILE) + +tools-check: + @sha256sum -c Dockerfile.sha256 || (echo "Tools Dockerfile has changed" && exit 1) + +tools: + @(docker inspect $(TOOL_IMAGE) > /dev/null && make tools-check) || (docker build --platform linux/amd64 -t $(TOOL_IMAGE) . && sha256sum Dockerfile > Dockerfile.sha256) + +build: tools + @mkdir -p $(BIN) + docker run --platform linux/amd64 -i -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) make + +debug: + docker run --platform linux/amd64 -i --rm -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) bash + +# requirement 3: we always need to recalculate the fingerprint based on source regardless of any existing fingerprint +.PHONY: $(FINGERPRINT_FILE) +$(FINGERPRINT_FILE): + @find project Dockerfile Makefile -type f -exec sha256sum {} \; | sort -k2 > $(FINGERPRINT_FILE) + +# requirement 4: 'clean' goal to remove all generated test fixtures +clean: + rm -rf $(BIN) Dockerfile.sha256 $(FINGERPRINT_FILE) + +.PHONY: tools tools-check build debug clean diff --git a/syft/file/cataloger/executable/testdata/toolchains/gdc/project/Makefile b/syft/file/cataloger/executable/testdata/toolchains/gdc/project/Makefile new file mode 100644 index 000000000..43a773a6f --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/gdc/project/Makefile @@ -0,0 +1,9 @@ +BIN=../bin + +all: $(BIN)/hello_gdc + +$(BIN)/hello_gdc: hello.d + gdc hello.d -o $(BIN)/hello_gdc + +clean: + rm -f $(BIN)/hello_gdc diff --git a/syft/file/cataloger/executable/testdata/toolchains/gdc/project/hello.d b/syft/file/cataloger/executable/testdata/toolchains/gdc/project/hello.d new file mode 100644 index 000000000..925e37243 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/gdc/project/hello.d @@ -0,0 +1,5 @@ +import std.stdio; + +void main() { + writeln("Hello, World!"); +} diff --git a/syft/file/cataloger/executable/testdata/toolchains/gnat/Dockerfile b/syft/file/cataloger/executable/testdata/toolchains/gnat/Dockerfile new file mode 100644 index 000000000..a332329c6 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/gnat/Dockerfile @@ -0,0 +1,3 @@ +FROM debian:12.14@sha256:49ba348354a28e39c70beffd6cf43bdb8d55d81ce4b746b0428717d054b8bbc4 + +RUN apt-get update && apt-get install -y --no-install-recommends gnat make && rm -rf /var/lib/apt/lists/* diff --git a/syft/file/cataloger/executable/testdata/toolchains/gnat/Makefile b/syft/file/cataloger/executable/testdata/toolchains/gnat/Makefile new file mode 100644 index 000000000..d1d3e645e --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/gnat/Makefile @@ -0,0 +1,39 @@ +BIN=./bin +TOOL_IMAGE=localhost/syft-toolchain-gnat-build-tools:latest +FINGERPRINT_FILE=$(BIN).fingerprint + +ifndef BIN + $(error BIN is not set) +endif + +.DEFAULT_GOAL := fixtures + +# requirement 1: 'fixtures' goal to generate any and all test fixtures +fixtures: build + +# requirement 2: 'fingerprint' goal to determine if the fixture input that indicates any existing cache should be busted +fingerprint: $(FINGERPRINT_FILE) + +tools-check: + @sha256sum -c Dockerfile.sha256 || (echo "Tools Dockerfile has changed" && exit 1) + +tools: + @(docker inspect $(TOOL_IMAGE) > /dev/null && make tools-check) || (docker build --platform linux/amd64 -t $(TOOL_IMAGE) . && sha256sum Dockerfile > Dockerfile.sha256) + +build: tools + @mkdir -p $(BIN) + docker run --platform linux/amd64 -i -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) make + +debug: + docker run --platform linux/amd64 -i --rm -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) bash + +# requirement 3: we always need to recalculate the fingerprint based on source regardless of any existing fingerprint +.PHONY: $(FINGERPRINT_FILE) +$(FINGERPRINT_FILE): + @find project Dockerfile Makefile -type f -exec sha256sum {} \; | sort -k2 > $(FINGERPRINT_FILE) + +# requirement 4: 'clean' goal to remove all generated test fixtures +clean: + rm -rf $(BIN) Dockerfile.sha256 $(FINGERPRINT_FILE) + +.PHONY: tools tools-check build debug clean diff --git a/syft/file/cataloger/executable/testdata/toolchains/gnat/project/Makefile b/syft/file/cataloger/executable/testdata/toolchains/gnat/project/Makefile new file mode 100644 index 000000000..410473a6c --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/gnat/project/Makefile @@ -0,0 +1,9 @@ +BIN=../bin + +all: $(BIN)/hello_gnat + +$(BIN)/hello_gnat: hello.adb + gnatmake hello.adb -o $(BIN)/hello_gnat + +clean: + rm -f $(BIN)/hello_gnat *.o *.ali diff --git a/syft/file/cataloger/executable/testdata/toolchains/gnat/project/hello.adb b/syft/file/cataloger/executable/testdata/toolchains/gnat/project/hello.adb new file mode 100644 index 000000000..2278012bb --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/gnat/project/hello.adb @@ -0,0 +1,6 @@ +with Ada.Text_IO; + +procedure Hello is +begin + Ada.Text_IO.Put_Line ("Hello, World!"); +end Hello; diff --git a/syft/file/cataloger/executable/testdata/toolchains/gnat/project/hello.ali b/syft/file/cataloger/executable/testdata/toolchains/gnat/project/hello.ali new file mode 100644 index 000000000..5ff5b9767 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/gnat/project/hello.ali @@ -0,0 +1,51 @@ +V "GNAT Lib v12" +M P W=b +P ZX + +RN +RV NO_IO + +U hello%b hello.adb b6dbb388 NE OO SU +W ada%s ada.ads ada.ali +Z ada.strings.text_buffers%s a-sttebu.adb a-sttebu.ali +W ada.text_io%s a-textio.adb a-textio.ali + +D ada.ads 20220819080952 76789da1 ada%s +D a-except.ads 20220819080952 2a7d8d70 ada.exceptions%s +D a-ioexce.ads 20220819080952 40018c65 ada.io_exceptions%s +D a-stream.ads 20220819080952 119b8fb3 ada.streams%s +D a-string.ads 20220819080952 90ac6797 ada.strings%s +D a-sttebu.ads 20220819080952 18209c64 ada.strings.text_buffers%s +D a-stuten.ads 20220819080952 33c54060 ada.strings.utf_encoding%s +D a-tags.ads 20220819080952 9eaa38c6 ada.tags%s +D a-textio.ads 20220819080952 deada98a ada.text_io%s +D a-unccon.ads 20220819080952 0e9b276f ada.unchecked_conversion%s +D hello.adb 20260618132941 68761a02 hello%b +D interfac.ads 20220819080952 edec285f interfaces%s +D i-cstrea.ads 20220819080952 e53d8b8e interfaces.c_streams%s +D system.ads 20220819080952 a2da961d system%s +D s-crtl.ads 20220819080952 8a0692f8 system.crtl%s +D s-exctab.ads 20220819080952 91bef6ef system.exception_table%s +D s-ficobl.ads 20220819080952 dc5161d4 system.file_control_block%s +D s-parame.ads 20220819080952 d494a4a6 system.parameters%s +D s-putima.ads 20220819080952 4e095881 system.put_images%s +D s-secsta.ads 20220819080952 62cd9202 system.secondary_stack%s +D s-soflin.ads 20220819080952 df77073e system.soft_links%s +D s-stache.ads 20220819080952 0b81c1fe system.stack_checking%s +D s-stalib.ads 20220819080952 1c9580f6 system.standard_library%s +D s-stoele.ads 20220819080952 6d8e1ff4 system.storage_elements%s +D s-stoele.adb 20220819080952 8f5a9db6 system.storage_elements%b +D s-traent.ads 20220819080952 c81cbf8c system.traceback_entries%s +D s-unstyp.ads 20220819080952 fa2a7f59 system.unsigned_types%s +D s-wchcon.ads 20220819080952 d9032363 system.wch_con%s +D unchconv.ads 20220819080952 ca2f9e18 unchecked_conversion%s +G a e +G c Z b b [hello standard 3 11 none] +X 1 ada.ads +16K9*Ada 20e8 11|1r6 5r4 +X 9 a-textio.ads +58K13*Text_IO 727e16 11|1w10 5r8 +507U14*Put_Line 11|5s16 +X 11 hello.adb +3U11*Hello 3b11 6l5 6t10 + diff --git a/syft/file/cataloger/executable/testdata/toolchains/gnat/project/hello.o b/syft/file/cataloger/executable/testdata/toolchains/gnat/project/hello.o new file mode 100644 index 0000000000000000000000000000000000000000..7606bd21a38e52979295e46c3a18f51f3523ac23 GIT binary patch literal 1464 zcmbtT&ubG=5S~qHt=dSeKM?9+y=bNF(p@~L2Z_eocMuPi(vvK2yH66_WXom?(ThSs zSfr3Y#iLgd1WyY74T1*`dh0=`GrMoh%OhTN;O)$OZ@!s%Gs%nf2ls1^11t{QhOx&e zz_2#9Tcz282F$~jD84=t``_op!7+lx!TC}Z??mxM6rV-$NfaNx5jGO9A0K{vPbS8x zBuQ7??KDf`%ji?h23>5l+qc}Mdn)S6zUv2G;H|Ct*Oy}z`N5ulO+#>wVo{vuo8Sza z&f@&>xe+G0gcu!?fIfFlH(%A-joJ16dIw_&nkH0#27Vq*yQ@!~2tXamCr?mLp|@bf zmpveM0Z(%xQac?QgeT(&LK(}jbb+ieSHnE)reV0dmxoEWufj0EiC04FsN?x{RLNNj z=eVmHpFvICa=fc?%44h+z#Ba4#088 z_0wE=8xOZu2f5sNiUCAZo$yH}drFu6Z{=bJ+S#m?sil3MJ6}({5y3?~G?Nw{Q{GTg z6j3QSiJBn(;at@C6^+vlOvy~guyxu$$O>AN^I!Qsaw(_%t|4M1+-K#D`)B_q8pK~? zKY@4BPO~ /dev/null && make tools-check) || (docker build --platform linux/amd64 -t $(TOOL_IMAGE) . && sha256sum Dockerfile > Dockerfile.sha256) + +build: tools + @mkdir -p $(BIN) + docker run --platform linux/amd64 -i -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) make + +debug: + docker run --platform linux/amd64 -i --rm -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) bash + +# requirement 3: we always need to recalculate the fingerprint based on source regardless of any existing fingerprint +.PHONY: $(FINGERPRINT_FILE) +$(FINGERPRINT_FILE): + @find project Dockerfile Makefile -type f -exec sha256sum {} \; | sort -k2 > $(FINGERPRINT_FILE) + +# requirement 4: 'clean' goal to remove all generated test fixtures +clean: + rm -rf $(BIN) Dockerfile.sha256 $(FINGERPRINT_FILE) + +.PHONY: tools tools-check build debug clean diff --git a/syft/file/cataloger/executable/testdata/toolchains/gold/project/Makefile b/syft/file/cataloger/executable/testdata/toolchains/gold/project/Makefile new file mode 100644 index 000000000..2c5c2ebb2 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/gold/project/Makefile @@ -0,0 +1,9 @@ +BIN=../bin + +all: $(BIN)/hello_gold + +$(BIN)/hello_gold: hello.c + gcc hello.c -fuse-ld=gold -o $(BIN)/hello_gold + +clean: + rm -f $(BIN)/hello_gold diff --git a/syft/file/cataloger/executable/testdata/toolchains/gold/project/hello.c b/syft/file/cataloger/executable/testdata/toolchains/gold/project/hello.c new file mode 100644 index 000000000..f26b97c98 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/gold/project/hello.c @@ -0,0 +1,6 @@ +#include + +int main() { + printf("Hello, World!\n"); + return 0; +} diff --git a/syft/file/cataloger/executable/testdata/toolchains/lld/Dockerfile b/syft/file/cataloger/executable/testdata/toolchains/lld/Dockerfile new file mode 100644 index 000000000..74ec989bc --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/lld/Dockerfile @@ -0,0 +1,6 @@ +FROM alpine:3.21.7@sha256:48b0309ca019d89d40f670aa1bc06e426dc0931948452e8491e3d65087abc07d + +RUN apk add --no-cache clang18 lld musl-dev make + +# create symlink so 'clang' command works (Alpine installs as clang-18) +RUN ln -s /usr/bin/clang-18 /usr/bin/clang diff --git a/syft/file/cataloger/executable/testdata/toolchains/lld/Makefile b/syft/file/cataloger/executable/testdata/toolchains/lld/Makefile new file mode 100644 index 000000000..a1a4a4296 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/lld/Makefile @@ -0,0 +1,39 @@ +BIN=./bin +TOOL_IMAGE=localhost/syft-toolchain-lld-build-tools:latest +FINGERPRINT_FILE=$(BIN).fingerprint + +ifndef BIN + $(error BIN is not set) +endif + +.DEFAULT_GOAL := fixtures + +# requirement 1: 'fixtures' goal to generate any and all test fixtures +fixtures: build + +# requirement 2: 'fingerprint' goal to determine if the fixture input that indicates any existing cache should be busted +fingerprint: $(FINGERPRINT_FILE) + +tools-check: + @sha256sum -c Dockerfile.sha256 || (echo "Tools Dockerfile has changed" && exit 1) + +tools: + @(docker inspect $(TOOL_IMAGE) > /dev/null && make tools-check) || (docker build --platform linux/amd64 -t $(TOOL_IMAGE) . && sha256sum Dockerfile > Dockerfile.sha256) + +build: tools + @mkdir -p $(BIN) + docker run --platform linux/amd64 -i -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) make + +debug: + docker run --platform linux/amd64 -i --rm -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) bash + +# requirement 3: we always need to recalculate the fingerprint based on source regardless of any existing fingerprint +.PHONY: $(FINGERPRINT_FILE) +$(FINGERPRINT_FILE): + @find project Dockerfile Makefile -type f -exec sha256sum {} \; | sort -k2 > $(FINGERPRINT_FILE) + +# requirement 4: 'clean' goal to remove all generated test fixtures +clean: + rm -rf $(BIN) Dockerfile.sha256 $(FINGERPRINT_FILE) + +.PHONY: tools tools-check build debug clean diff --git a/syft/file/cataloger/executable/testdata/toolchains/lld/project/Makefile b/syft/file/cataloger/executable/testdata/toolchains/lld/project/Makefile new file mode 100644 index 000000000..462861343 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/lld/project/Makefile @@ -0,0 +1,9 @@ +BIN=../bin + +all: $(BIN)/hello_lld + +$(BIN)/hello_lld: hello.c + clang hello.c -fuse-ld=lld -o $(BIN)/hello_lld + +clean: + rm -f $(BIN)/hello_lld diff --git a/syft/file/cataloger/executable/testdata/toolchains/lld/project/hello.c b/syft/file/cataloger/executable/testdata/toolchains/lld/project/hello.c new file mode 100644 index 000000000..f26b97c98 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/lld/project/hello.c @@ -0,0 +1,6 @@ +#include + +int main() { + printf("Hello, World!\n"); + return 0; +} diff --git a/syft/file/cataloger/executable/testdata/toolchains/mold/Dockerfile b/syft/file/cataloger/executable/testdata/toolchains/mold/Dockerfile new file mode 100644 index 000000000..4b3892107 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/mold/Dockerfile @@ -0,0 +1,3 @@ +FROM alpine:3.21.7@sha256:48b0309ca019d89d40f670aa1bc06e426dc0931948452e8491e3d65087abc07d + +RUN apk add --no-cache gcc mold musl-dev make diff --git a/syft/file/cataloger/executable/testdata/toolchains/mold/Makefile b/syft/file/cataloger/executable/testdata/toolchains/mold/Makefile new file mode 100644 index 000000000..8b5197ada --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/mold/Makefile @@ -0,0 +1,39 @@ +BIN=./bin +TOOL_IMAGE=localhost/syft-toolchain-mold-build-tools:latest +FINGERPRINT_FILE=$(BIN).fingerprint + +ifndef BIN + $(error BIN is not set) +endif + +.DEFAULT_GOAL := fixtures + +# requirement 1: 'fixtures' goal to generate any and all test fixtures +fixtures: build + +# requirement 2: 'fingerprint' goal to determine if the fixture input that indicates any existing cache should be busted +fingerprint: $(FINGERPRINT_FILE) + +tools-check: + @sha256sum -c Dockerfile.sha256 || (echo "Tools Dockerfile has changed" && exit 1) + +tools: + @(docker inspect $(TOOL_IMAGE) > /dev/null && make tools-check) || (docker build --platform linux/amd64 -t $(TOOL_IMAGE) . && sha256sum Dockerfile > Dockerfile.sha256) + +build: tools + @mkdir -p $(BIN) + docker run --platform linux/amd64 -i -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) make + +debug: + docker run --platform linux/amd64 -i --rm -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) bash + +# requirement 3: we always need to recalculate the fingerprint based on source regardless of any existing fingerprint +.PHONY: $(FINGERPRINT_FILE) +$(FINGERPRINT_FILE): + @find project Dockerfile Makefile -type f -exec sha256sum {} \; | sort -k2 > $(FINGERPRINT_FILE) + +# requirement 4: 'clean' goal to remove all generated test fixtures +clean: + rm -rf $(BIN) Dockerfile.sha256 $(FINGERPRINT_FILE) + +.PHONY: tools tools-check build debug clean diff --git a/syft/file/cataloger/executable/testdata/toolchains/mold/project/Makefile b/syft/file/cataloger/executable/testdata/toolchains/mold/project/Makefile new file mode 100644 index 000000000..5522df530 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/mold/project/Makefile @@ -0,0 +1,9 @@ +BIN=../bin + +all: $(BIN)/hello_mold + +$(BIN)/hello_mold: hello.c + gcc hello.c -fuse-ld=mold -o $(BIN)/hello_mold + +clean: + rm -f $(BIN)/hello_mold diff --git a/syft/file/cataloger/executable/testdata/toolchains/mold/project/hello.c b/syft/file/cataloger/executable/testdata/toolchains/mold/project/hello.c new file mode 100644 index 000000000..f26b97c98 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/mold/project/hello.c @@ -0,0 +1,6 @@ +#include + +int main() { + printf("Hello, World!\n"); + return 0; +} diff --git a/syft/file/cataloger/executable/testdata/toolchains/rust/Dockerfile b/syft/file/cataloger/executable/testdata/toolchains/rust/Dockerfile new file mode 100644 index 000000000..7b4ce593b --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/rust/Dockerfile @@ -0,0 +1 @@ +FROM rust:1.83.0@sha256:a45bf1f5d9af0a23b26703b3500d70af1abff7f984a7abef5a104b42c02a292b diff --git a/syft/file/cataloger/executable/testdata/toolchains/rust/Makefile b/syft/file/cataloger/executable/testdata/toolchains/rust/Makefile new file mode 100644 index 000000000..533ab3463 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/rust/Makefile @@ -0,0 +1,39 @@ +BIN=./bin +TOOL_IMAGE=localhost/syft-toolchain-rust-build-tools:latest +FINGERPRINT_FILE=$(BIN).fingerprint + +ifndef BIN + $(error BIN is not set) +endif + +.DEFAULT_GOAL := fixtures + +# requirement 1: 'fixtures' goal to generate any and all test fixtures +fixtures: build + +# requirement 2: 'fingerprint' goal to determine if the fixture input that indicates any existing cache should be busted +fingerprint: $(FINGERPRINT_FILE) + +tools-check: + @sha256sum -c Dockerfile.sha256 || (echo "Tools Dockerfile has changed" && exit 1) + +tools: + @(docker inspect $(TOOL_IMAGE) > /dev/null && make tools-check) || (docker build --platform linux/amd64 -t $(TOOL_IMAGE) . && sha256sum Dockerfile > Dockerfile.sha256) + +build: tools + @mkdir -p $(BIN) + docker run --platform linux/amd64 -i -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) make + +debug: + docker run --platform linux/amd64 -i --rm -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) bash + +# requirement 3: we always need to recalculate the fingerprint based on source regardless of any existing fingerprint +.PHONY: $(FINGERPRINT_FILE) +$(FINGERPRINT_FILE): + @find project Dockerfile Makefile -type f -exec sha256sum {} \; | sort -k2 > $(FINGERPRINT_FILE) + +# requirement 4: 'clean' goal to remove all generated test fixtures +clean: + rm -rf $(BIN) Dockerfile.sha256 $(FINGERPRINT_FILE) + +.PHONY: tools tools-check build debug clean diff --git a/syft/file/cataloger/executable/testdata/toolchains/rust/project/Makefile b/syft/file/cataloger/executable/testdata/toolchains/rust/project/Makefile new file mode 100644 index 000000000..c75c0a885 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/rust/project/Makefile @@ -0,0 +1,9 @@ +BIN=../bin + +all: $(BIN)/hello_rust + +$(BIN)/hello_rust: hello.rs + rustc hello.rs -o $(BIN)/hello_rust + +clean: + rm -f $(BIN)/hello_rust diff --git a/syft/file/cataloger/executable/testdata/toolchains/rust/project/hello.rs b/syft/file/cataloger/executable/testdata/toolchains/rust/project/hello.rs new file mode 100644 index 000000000..0672e5106 --- /dev/null +++ b/syft/file/cataloger/executable/testdata/toolchains/rust/project/hello.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, World!"); +} diff --git a/syft/file/cataloger/executable/toolchains.go b/syft/file/cataloger/executable/toolchains.go new file mode 100644 index 000000000..79b8df6c6 --- /dev/null +++ b/syft/file/cataloger/executable/toolchains.go @@ -0,0 +1,248 @@ +package executable + +import ( + "debug/buildinfo" + "debug/elf" + "io" + "regexp" + "strings" + + "github.com/scylladb/go-set/strset" + + "github.com/anchore/syft/syft/file" +) + +// TODO: additional toolchain detectors we'd like to add. Each entry notes the signal location and the +// component it yields. +// +// ELF (.comment / notes / symbols — same mechanism as the detectors below): +// 1. rustc commit hash: scan rodata for "/rustc/<40-hex>/library/" panic paths; resolves rust provenance +// for stripped or pre-1.73 binaries (where the .comment producer string is absent). needs a +// commit->version lookup table to turn the hash into a semver. component: compiler. +// 2. more clang forks: AMD AOCC and Arm Compiler. their producer strings are vendor-prefixed clang +// versions (e.g. "AMD clang version 14.0.6 ...") that clangVersionPattern already matches, so today +// they are mislabeled as plain "clang"; each needs a vendor pattern matched before clangVersionPattern +// (the same ordering used for icx). not yet added because neither ships a freely buildable linux/amd64 +// image to anchor a real fixture (AOCC is proprietary; Arm Compiler is AArch64-only). component: compiler. +// 3. Swift (Linux): presence of "swift5_*" sections marks Swift; version only when a "swiftlang-" +// producer string is present (debug builds). component: compiler. +// 4. Haskell GHC: RTS symbols (hs_init, stg_*) for identity; derive an approximate version from the +// embedded "base_" package symbol. component: compiler. +// 5. identity-only (no reliable version) via runtime symbol prefixes: OCaml (caml_*), Nim (NimMain), +// Crystal (__crystal_main), FreePascal (FPC_*), and the LLVM-based D compilers ldc/dmd (_Dmain). the +// GCC D frontend (gdc) is already handled via the shared GCC .comment path. component: compiler. +// 6. GNU assembler (GNU AS): only present in DWARF .debug_info producer strings, NOT .comment, so it +// requires DWARF parsing and is absent in stripped builds. component: assembler. +// 7. GNU ld (BFD): leaves no self-identifying marker; can only be inferred by elimination (ELF with a +// compiler .comment but no lld/mold/gold evidence) at low confidence and with no version. +// +// not feasible via this mechanism (recorded so they aren't re-investigated): +// - TinyCC (tcc): emits no .comment section, no producer string, and no identifying symbols (stripped +// by default), so a tcc-built ELF carries no usable signal here. +// - Intel classic icc/ifort, IBM XL, NVIDIA/PGI: distinct producer strings exist but the toolchains are +// proprietary/deprecated and not freely dockerizable on linux/amd64 to anchor a real fixture. +// +// PE (Windows — needs debug/pe, not covered by this ELF-only file): +// 8. MSVC link.exe + cl.exe: parse the Rich Header (the "DanS".."Rich" block, XOR-decoded into +// ProdID/build pairs); map build numbers to Visual Studio/linker versions. components: linker + compiler. +// 9. .NET / CLR: COR20 header (optional-header DataDirectory[14]) marks a managed assembly; read the +// "TargetFrameworkAttribute" string (e.g. ".NETCoreApp,Version=v8.0") for the runtime version. +// component: runtime. (NativeAOT .NET is a native binary with runtime symbols only and no clean version.) +// +// Mach-O (macOS — needs debug/macho): +// 10. Swift: presence of "__swift5_*" sections; version via the "swiftlang-" producer when present. +// component: compiler. + +var ( + clangVersionPattern = regexp.MustCompile(`clang version (\d+\.\d+\.\d+)`) + gccVersionPattern = regexp.MustCompile(`GCC: \([^)]+\) (\d+\.\d+\.\d+)`) + // the Intel oneAPI DPC++/C++ compiler (icx/icpx) is an LLVM/clang fork that writes its own producer + // string into .comment, e.g. "Intel(R) oneAPI DPC++/C++ Compiler 2024.0.2 (2024.0.2.20231223)" (see + // https://briancallahan.net/blog/20240306.html for a real `readelf .comment` dump). since it is a clang + // fork it may also emit a plain "clang version" entry, so it is matched before clangVersionPattern to + // avoid mislabeling as upstream clang. evidence for the producer string and version scheme: + // - https://briancallahan.net/blog/20240306.html + // - https://www.intel.com/content/www/us/en/developer/articles/release-notes/oneapi-dpcpp-cpp-compiler-release-notes.html + intelVersionPattern = regexp.MustCompile(`Intel\(R\) oneAPI[^0-9]*(\d+\.\d+\.\d+)`) + // rustc embeds its own producer string in .comment for binaries built with rust >= 1.73 (e.g. + // "rustc version 1.83.0 (90b35a623 2024-11-26)"). The shipped libstd objects instead carry the + // "clang LLVM (rustc version ...)" form, so accept both. + rustcVersionPattern = regexp.MustCompile(`rustc version (\d+\.\d+\.\d+)`) + // LLVM lld writes "Linker: LLD " into .comment (see https://lld.llvm.org/). distros often + // inject a vendor prefix (e.g. Debian/Ubuntu emit "Linker: Ubuntu LLD 18.1.3"), so allow one. + lldVersionPattern = regexp.MustCompile(`Linker: (?:.*? )?LLD (\d+\.\d+\.\d+)`) + // mold writes "mold (...; compatible with GNU ld)" into .comment. + moldVersionPattern = regexp.MustCompile(`mold (\d+\.\d+\.\d+)`) + // GNU gold writes a "gold " descriptor into the .note.gnu.gold-version note section. + goldVersionPattern = regexp.MustCompile(`gold (\d+\.\d+)`) +) + +// golangToolchainEvidence attempts to extract Go toolchain information from the binary build info. +func golangToolchainEvidence(reader io.ReaderAt) *file.Toolchain { + bi, err := buildinfo.Read(reader) + if err != nil || bi == nil { + // not a golang binary + return nil + } + return &file.Toolchain{ + Name: "go", + Version: bi.GoVersion, + Component: file.ToolchainComponentCompiler, + } +} + +// cToolchainEvidence attempts to extract compiler information from the ELF .comment section for the +// GCC and Clang families. This covers upstream GCC/Clang, GCC frontends that share the GCC producer +// string but pull in distinct runtime symbols (gfortran, gdc, gccgo, gnat), and the Intel oneAPI +// (icx/icpx) clang fork. +func cToolchainEvidence(comments []string, symbols *strset.Set) *file.Toolchain { + for _, comment := range comments { + // Intel oneAPI (icx) is a clang fork whose binaries carry both an "Intel(R) oneAPI ..." producer + // string and a plain "clang version" entry, so it must be checked before the generic clang match. + if match := intelVersionPattern.FindStringSubmatch(comment); match != nil { + return &file.Toolchain{ + Name: "icx", + Version: match[1], + Component: file.ToolchainComponentCompiler, + } + } + } + + for _, comment := range comments { + // check for clang first since clang binaries often have both GCC and clang entries + // (clang includes GCC compatibility info) + if match := clangVersionPattern.FindStringSubmatch(comment); match != nil { + return &file.Toolchain{ + Name: "clang", + Version: match[1], + Component: file.ToolchainComponentCompiler, + } + } + } + + for _, comment := range comments { + if match := gccVersionPattern.FindStringSubmatch(comment); match != nil { + return &file.Toolchain{ + Name: gccFrontendName(symbols), + Version: match[1], + Component: file.ToolchainComponentCompiler, + } + } + } + + return nil +} + +// gccFrontendName disambiguates which GCC frontend produced a binary. gfortran, gdc, gccgo, and gnat +// all share the same "GCC: (...) " string in .comment, so the only way to tell them apart from +// a plain C/C++ build is by the language-specific runtime symbols they pull in. defaults to "gcc". +func gccFrontendName(symbols *strset.Set) string { + switch { + case hasFortranEvidence(symbols): + return "gfortran" + case hasDEvidence(symbols): + return "gdc" + case hasGccgoEvidence(symbols): + return "gccgo" + case hasAdaEvidence(symbols): + return "gnat" + default: + return "gcc" + } +} + +// rustToolchainEvidence attempts to extract Rust compiler information from the ELF .comment section. +func rustToolchainEvidence(comments []string) *file.Toolchain { + for _, comment := range comments { + if match := rustcVersionPattern.FindStringSubmatch(comment); match != nil { + return &file.Toolchain{ + Name: "rust", + Version: match[1], + Component: file.ToolchainComponentCompiler, + } + } + } + return nil +} + +// linkerToolchainEvidence attempts to extract linker information from the binary. lld and mold leave a +// version string in the ELF .comment section, while gold writes a dedicated .note.gnu.gold-version note. +// GNU ld (BFD) leaves no self-identifying marker, so it cannot be detected here. +func linkerToolchainEvidence(f *elf.File, comments []string) *file.Toolchain { + for _, comment := range comments { + if match := lldVersionPattern.FindStringSubmatch(comment); match != nil { + return &file.Toolchain{ + Name: "lld", + Version: match[1], + Component: file.ToolchainComponentLinker, + } + } + if match := moldVersionPattern.FindStringSubmatch(comment); match != nil { + return &file.Toolchain{ + Name: "mold", + Version: match[1], + Component: file.ToolchainComponentLinker, + } + } + } + + if section := f.Section(".note.gnu.gold-version"); section != nil { + data, err := section.Data() + if err == nil { + if match := goldVersionPattern.FindStringSubmatch(string(data)); match != nil { + return &file.Toolchain{ + Name: "gold", + Version: match[1], + Component: file.ToolchainComponentLinker, + } + } + } + } + + return nil +} + +// elfComments returns the null-delimited strings within the ELF .comment section, which may contain +// multiple producer entries (compiler, assembler, linker, etc.). +func elfComments(f *elf.File) []string { + section := f.Section(".comment") + if section == nil { + return nil + } + + data, err := section.Data() + if err != nil { + return nil + } + + // the .comment section contains null-terminated strings + return strings.Split(string(data), "\x00") +} + +// hasFortranEvidence reports whether the binary references the libgfortran runtime, which indicates a +// gfortran build (MAIN__ is the real Fortran program entry, and _gfortran_* are runtime calls). +func hasFortranEvidence(symbols *strset.Set) bool { + return symbols.HasAny("MAIN__", "_gfortran_set_args", "_gfortran_set_options", "_gfortran_st_write") +} + +// hasDEvidence reports whether the binary references the gdc (GNU D) runtime. _Dmain is the D program +// entry the compiler emits, and __gdc_personality_v0 is gdc's exception-handling personality routine. +// see the gdc frontend in gcc: https://github.com/gcc-mirror/gcc/tree/master/gcc/d +func hasDEvidence(symbols *strset.Set) bool { + return symbols.HasAny("_Dmain", "__gdc_personality_v0") +} + +// hasGccgoEvidence reports whether the binary was built by gccgo. the libgo runtime exports __go_* +// helpers (e.g. __go_go to start a goroutine) that the gc toolchain does not emit, so these +// distinguish gccgo both from a plain gcc C build and from a cgo-enabled gc binary (which also carries +// a gcc .comment). see libgo: https://github.com/gcc-mirror/gcc/tree/master/libgo/runtime +func hasGccgoEvidence(symbols *strset.Set) bool { + return symbols.HasAny("__go_go", "__go_init_main", "__go_register_gc_roots") +} + +// hasAdaEvidence reports whether the binary references the GNAT Ada runtime. adainit/adafinal are the +// elaboration entry points and __gnat_* are runtime support calls. +// see the GNAT runtime (libgnat): https://github.com/gcc-mirror/gcc/tree/master/gcc/ada +func hasAdaEvidence(symbols *strset.Set) bool { + return symbols.HasAny("__gnat_initialize", "__gnat_runtime_initialize", "adainit", "adafinal") +} diff --git a/syft/file/cataloger/executable/toolchains_test.go b/syft/file/cataloger/executable/toolchains_test.go new file mode 100644 index 000000000..96da59bbd --- /dev/null +++ b/syft/file/cataloger/executable/toolchains_test.go @@ -0,0 +1,223 @@ +package executable + +import ( + "debug/elf" + "os" + "path/filepath" + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/scylladb/go-set/strset" + "github.com/stretchr/testify/require" + + "github.com/anchore/syft/syft/file" + "github.com/anchore/syft/syft/internal/unionreader" +) + +// hasGoToolchain is a test helper to check whether the go toolchain was detected. +func hasGoToolchain(toolchains []file.Toolchain) bool { + for _, tc := range toolchains { + if tc.Name == "go" { + return true + } + } + return false +} + +func Test_elfToolchains(t *testing.T) { + readerForFixture := func(t *testing.T, fixture string) unionreader.UnionReader { + t.Helper() + f, err := os.Open(filepath.Join("testdata/toolchains", fixture)) + require.NoError(t, err) + return f + } + + compiler := file.ToolchainComponentCompiler + linker := file.ToolchainComponentLinker + + tests := []struct { + name string + fixture string + want []file.Toolchain + }{ + { + name: "gcc: compiler only", + fixture: "gcc/bin/hello_gcc", + want: []file.Toolchain{ + {Name: "gcc", Version: "13.4.0", Component: compiler}, + }, + }, + { + name: "clang: compiler only", + fixture: "clang/bin/hello_clang", + want: []file.Toolchain{ + {Name: "clang", Version: "18.1.8", Component: compiler}, + }, + }, + { + name: "lld: clang compiler + lld linker", + fixture: "lld/bin/hello_lld", + want: []file.Toolchain{ + {Name: "clang", Version: "18.1.8", Component: compiler}, + {Name: "lld", Version: "19.1.4", Component: linker}, + }, + }, + { + name: "mold: gcc compiler + mold linker", + fixture: "mold/bin/hello_mold", + want: []file.Toolchain{ + {Name: "gcc", Version: "14.2.0", Component: compiler}, + {Name: "mold", Version: "2.34.1", Component: linker}, + }, + }, + { + name: "gold: gcc compiler + gold linker", + fixture: "gold/bin/hello_gold", + want: []file.Toolchain{ + {Name: "gcc", Version: "14.2.0", Component: compiler}, + {Name: "gold", Version: "1.16", Component: linker}, + }, + }, + { + // rust binaries also carry a GCC producer string from the gcc-compiled C runtime glue that is + // linked in, so both compilers are reported (akin to how cgo binaries report go and gcc). + name: "rust: gcc glue + rustc", + fixture: "rust/bin/hello_rust", + want: []file.Toolchain{ + {Name: "gcc", Version: "12.2.0", Component: compiler}, + {Name: "rust", Version: "1.83.0", Component: compiler}, + }, + }, + { + // gfortran shares the GCC version string in .comment, so it is only distinguishable from a + // C build by the presence of libgfortran runtime symbols (gcc gets relabeled to gfortran). + name: "fortran: gfortran compiler only", + fixture: "fortran/bin/hello_fortran", + want: []file.Toolchain{ + {Name: "gfortran", Version: "13.4.0", Component: compiler}, + }, + }, + { + // gdc is a GCC frontend that shares the GCC version string, so it is distinguished from a C + // build only by the D runtime symbols (_Dmain, __gdc_personality_v0). + name: "gdc: GNU D compiler only", + fixture: "gdc/bin/hello_gdc", + want: []file.Toolchain{ + {Name: "gdc", Version: "12.2.0", Component: compiler}, + }, + }, + { + // gccgo is a GCC frontend (not the gc toolchain, so it has no Go build info); it shares the + // GCC version string and is distinguished only by the libgo __go_* runtime symbols. + name: "gccgo: GNU Go compiler only", + fixture: "gccgo/bin/hello_gccgo", + want: []file.Toolchain{ + {Name: "gccgo", Version: "12.2.0", Component: compiler}, + }, + }, + { + // gnat is the GCC Ada frontend; it shares the GCC version string and is distinguished only by + // the GNAT runtime symbols (adainit, __gnat_*). + name: "gnat: GNU Ada compiler only", + fixture: "gnat/bin/hello_gnat", + want: []file.Toolchain{ + {Name: "gnat", Version: "12.2.0", Component: compiler}, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + reader := readerForFixture(t, tt.fixture) + f, err := elf.NewFile(reader) + require.NoError(t, err) + + got := elfToolchains(reader, f) + + if d := cmp.Diff(tt.want, got); d != "" { + t.Errorf("elfToolchains() mismatch (-want +got):\n%s", d) + } + }) + } +} + +func Test_cToolchainEvidence(t *testing.T) { + compiler := file.ToolchainComponentCompiler + + tests := []struct { + name string + comments []string + symbols []string + want *file.Toolchain + }{ + { + // icx (Intel oneAPI DPC++/C++) is an LLVM/clang fork. there is no freely buildable linux/amd64 + // image to anchor a real fixture, so the literal .comment producer string is asserted here. the + // exact form is confirmed by a real `readelf -x .comment` dump (which yielded + // "Intel(R) oneAPI DPC++/C++ Compiler 2024.0.2 (2024.0.2.20231223)"): + // - https://briancallahan.net/blog/20240306.html + // - https://www.intel.com/content/www/us/en/developer/articles/release-notes/oneapi-dpcpp/2025.html + // because it is a clang fork, the Intel string must be matched before the generic clang pattern; + // the second "clang version" entry below guards that ordering (a generic clang match must not win). + name: "intel oneAPI icx is matched before clang", + comments: []string{ + "Intel(R) oneAPI DPC++/C++ Compiler 2024.0.2 (2024.0.2.20231223)", + "clang version 18.1.0", + }, + want: &file.Toolchain{Name: "icx", Version: "2024.0.2", Component: compiler}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := cToolchainEvidence(tt.comments, strset.New(tt.symbols...)) + if d := cmp.Diff(tt.want, got); d != "" { + t.Errorf("cToolchainEvidence() mismatch (-want +got):\n%s", d) + } + }) + } +} + +func Test_linkerToolchainEvidence(t *testing.T) { + linker := file.ToolchainComponentLinker + + tests := []struct { + name string + comments []string + want *file.Toolchain + }{ + { + // lld writes "Linker: " + getLLDVersion() into .comment. docs and source: + // - https://lld.llvm.org/ ("If the string \"Linker: LLD\" is included ... you are using LLD") + // - https://github.com/llvm/llvm-project/blob/main/lld/ELF/SyntheticSections.cpp (Twine("Linker: ") + getLLDVersion()) + name: "vanilla lld", + comments: []string{"Linker: LLD 19.1.4"}, + want: &file.Toolchain{Name: "lld", Version: "19.1.4", Component: linker}, + }, + { + // debian/ubuntu prepend a vendor to getLLDVersion() (the same packaging mechanism behind clang's + // "Ubuntu clang version ..."), so .comment reads "Linker: Ubuntu LLD ". reproduced on + // ubuntu:24.04: `readelf -p .comment ` => "Linker: Ubuntu LLD 18.1.3". + name: "vendor-prefixed lld", + comments: []string{"Linker: Ubuntu LLD 18.1.3"}, + want: &file.Toolchain{Name: "lld", Version: "18.1.3", Component: linker}, + }, + { + // mold writes "mold (; compatible with GNU ld)" into .comment. this format is + // documented by mold and is also exercised end-to-end by the real fixture in Test_elfToolchains: + // - https://github.com/rui314/mold (README: "mold leaves its identification string in .comment") + name: "mold", + comments: []string{"mold 2.34.1 (compatible with GNU ld)"}, + want: &file.Toolchain{Name: "mold", Version: "2.34.1", Component: linker}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + // f is only consulted for the gold note, which these comment-based cases match before reaching. + got := linkerToolchainEvidence(nil, tt.comments) + if d := cmp.Diff(tt.want, got); d != "" { + t.Errorf("linkerToolchainEvidence() mismatch (-want +got):\n%s", d) + } + }) + } +} diff --git a/syft/file/executable.go b/syft/file/executable.go index 454b1bf9f..56ed235c7 100644 --- a/syft/file/executable.go +++ b/syft/file/executable.go @@ -6,9 +6,16 @@ type ( // RelocationReadOnly indicates the RELRO security protection level applied to an ELF binary. RelocationReadOnly string + + // ToolchainComponent represents which part of the toolchain an entry describes (e.g. compiler, linker). + // This can be expanded in the future to include assemblers, runtimes, and other toolchain components. + ToolchainComponent string ) const ( + ToolchainComponentCompiler ToolchainComponent = "compiler" + ToolchainComponentLinker ToolchainComponent = "linker" + ELF ExecutableFormat = "elf" // Executable and Linkable Format used on Unix-like systems MachO ExecutableFormat = "macho" // Mach object file format used on macOS and iOS PE ExecutableFormat = "pe" // Portable Executable format used on Windows @@ -34,6 +41,20 @@ type Executable struct { // ELFSecurityFeatures contains ELF-specific security hardening information when Format is ELF. ELFSecurityFeatures *ELFSecurityFeatures `json:"elfSecurityFeatures,omitempty" yaml:"elfSecurityFeatures" mapstructure:"elfSecurityFeatures"` + + // Toolchains captures information about the compiler, linker, runtime, or other toolchains used to build (or otherwise exist within) the executable. + Toolchains []Toolchain `json:"toolchains,omitempty" yaml:"toolchains" mapstructure:"toolchains"` +} + +type Toolchain struct { + // Name is the name of the toolchain (e.g., "gcc", "clang", "rust", "lld", "GNU AS", etc.). + Name string `json:"name" yaml:"name" mapstructure:"name"` + + // Version is the version of the toolchain. + Version string `json:"version,omitempty" yaml:"version,omitempty" mapstructure:"version"` + + // Component indicates which part of the toolchain this represents (e.g., compiler, linker, assembler). + Component ToolchainComponent `json:"component" yaml:"component" mapstructure:"component"` } // ELFSecurityFeatures captures security hardening and protection mechanisms in ELF binaries.