syft/schema/json
Alexandr Hacicheant 96ee2db875
feat: Add Wordpress cataloger (#2218)
* Closes #1911 Wordpress cataloger

Signed-off-by: disc <a.hacicheant@gmail.com>

* Fixed a few unit tests and static analizer notices

Signed-off-by: disc <a.hacicheant@gmail.com>

* Updated `README.md`

Signed-off-by: disc <a.hacicheant@gmail.com>

* Fixed `golangci-lint` notices
Added integration test for `wordpress-plugin`

Signed-off-by: disc <a.hacicheant@gmail.com>

* Fixed `gosimports` notices

Signed-off-by: disc <a.hacicheant@gmail.com>

* Updated `json schema` version

Signed-off-by: disc <a.hacicheant@gmail.com>

* Fixed CLI tests, increased expected package count

Signed-off-by: disc <a.hacicheant@gmail.com>

* Read first 4Kb of a plugins file's content

Signed-off-by: disc <a.hacicheant@gmail.com>

* replace JSON schema version

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* change wording on source info for wordpress packages

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* Minor changes after a huge refactoring

Signed-off-by: disc <a.hacicheant@gmail.com>

* Removed unused files

Signed-off-by: disc <a.hacicheant@gmail.com>

* Updated schema

Signed-off-by: disc <a.hacicheant@gmail.com>

* Fixed integration tests

Signed-off-by: disc <a.hacicheant@gmail.com>

* fix integration tests

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* Renamed `metadata.Name` to `metadata.PluginInstallDirectory`

Signed-off-by: disc <a.hacicheant@gmail.com>

* rename fields to be compliant with json conventions

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

---------

Signed-off-by: disc <a.hacicheant@gmail.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
2024-02-14 16:03:25 +00:00
..
README.md Remove the power-user command and related catalogers (#2306) 2023-11-20 15:44:28 +00:00
schema-1.0.0.json Add enterprise upload capability (#285) 2020-12-09 22:20:53 -05:00
schema-1.0.1.json Split dpk source into name and version (#297) 2020-12-18 14:08:19 -05:00
schema-1.0.2.json Mark package relations by file ownership (#329) 2021-02-25 13:47:13 -05:00
schema-1.0.3.json update json schema with optional poweruser data shape 2021-03-22 10:56:16 -04:00
schema-1.0.4.json allow file metadata digests to be optional + add link destination 2021-03-29 12:07:42 -04:00
schema-1.0.5.json Add secrets search capability (#367) 2021-04-01 21:34:15 +00:00
schema-1.1.0.json use the standard file.Digest for apk checksums 2021-04-19 16:42:17 -04:00
schema-2.0.0.json Migrate SPDX-JSON relationships to SBOM model (#634) 2021-11-23 14:54:17 -05:00
schema-2.0.1.json Add cataloging of macho multi-architecture binaries (#657) 2021-12-08 16:25:24 -05:00
schema-2.0.2.json Bump syft JSON schema and add v2.0.2 (#716) 2021-12-22 13:55:34 -05:00
schema-3.0.0.json Replace distro type (#742) 2022-01-12 12:13:42 -05:00
schema-3.0.1.json Add additional PHP metadata (#753) 2022-01-19 11:42:16 -05:00
schema-3.1.0.json RPM Epoch should be optional in the json schema (#880) 2022-03-09 14:51:43 -05:00
schema-3.1.1.json Use go 1.18 buildinfo to catalog binaries (#827) 2022-03-16 17:07:02 -07:00
schema-3.2.1.json Omit H1Digest when empty (#902) 2022-03-21 11:59:10 -07:00
schema-3.2.2.json Add dart support (#919) 2022-03-31 15:44:55 -04:00
schema-3.2.3.json feat: add initial dotnet-support (#951) 2022-05-05 15:32:02 -04:00
schema-3.2.4.json add main module field to go bin metadata (#1026) 2022-06-03 23:12:09 +00:00
schema-3.3.0.json Add pacman (alpm) parser support (#943) 2022-06-13 18:51:37 +00:00
schema-3.3.1.json Add portage support for Gentoo Linux (#1076) 2022-07-06 16:18:54 -04:00
schema-3.3.2.json Add modularitylabel metadata to RPM type records generated by syft (#1148) 2022-08-08 11:52:32 +00:00
schema-4.0.0.json Add Conan (C/C++) conan.lock file support (#1230) 2022-09-29 18:45:59 +00:00
schema-4.1.0.json feat: add RelationshipsBySourceOwnership to syft json output (#1248) 2022-10-11 15:11:03 -04:00
schema-5.0.0.json Add support for dependency relationships for alpine (apk) (#1063) 2022-11-09 15:43:37 +00:00
schema-5.0.1.json Update swift cataloger to generic cataloger (#1324) 2022-11-04 13:51:59 -04:00
schema-5.1.0.json Update java generic cataloger (#1329) 2022-11-09 14:55:54 +00:00
schema-6.0.0.json Add support for dependency relationships for alpine (apk) (#1063) 2022-11-09 15:43:37 +00:00
schema-6.1.0.json feat: Add the origin field to the output format of syftjson (#1327) 2023-01-12 15:03:05 -05:00
schema-6.2.0.json chore: revert GolangBinMetadata name and make analogous GolangModMetadata (#1458) 2023-01-13 16:46:12 -05:00
schema-7.0.0.json fix: merging of binary packages (#1583) 2023-02-22 12:03:15 -05:00
schema-7.0.1.json feat: add support for SUPPORT_END in /etc/os-release (#1612) 2023-02-27 13:43:19 -05:00
schema-7.1.0.json Capture file ownership relationships from portage ecosystem (#1702) 2023-04-03 09:46:18 -04:00
schema-7.1.1.json Add Nix cataloger (#1696) 2023-04-04 10:53:56 -04:00
schema-7.1.2.json Add annotations for evidence on package locations (#1723) 2023-04-13 17:02:29 -04:00
schema-7.1.3.json Add Linux Kernel cataloger (#1694) 2023-04-14 14:33:36 -04:00
schema-7.1.4.json Add package-to-file location evidence relationships (#1698) 2023-04-14 15:08:46 -04:00
schema-7.1.5.json Create python requirements metadata (#1759) 2023-04-27 09:04:30 -04:00
schema-7.1.6.json feat: Add R cataloger (#1790) 2023-05-10 12:30:11 -04:00
schema-8.0.0.json fix: update field plurality of 8.0.0 schema before release (#1820) 2023-05-16 13:05:48 -04:00
schema-8.0.1.json feat: add scope to pom properties (#1779) 2023-06-01 12:22:29 +00:00
schema-9.0.0.json Refactor source API (#1846) 2023-06-30 14:19:16 +00:00
schema-9.0.1.json Add support for parsing .NET assemblies (#1943) 2023-07-19 15:34:07 -04:00
schema-9.0.2.json Add cataloger for Swift Package Manager. (#1919) 2023-07-25 14:35:21 -04:00
schema-10.0.0.json Guess unpinned versions in python requirements.txt (#1966) 2023-07-27 14:26:59 -04:00
schema-10.0.1.json Detect golang boring crypto and fipsonly modules (#2021) 2023-08-24 09:49:59 -04:00
schema-10.0.2.json fix: encode and decode FileLicenses and FileContents in Syft JSON (#2083) 2023-09-13 16:14:20 -04:00
schema-11.0.0.json feat: add dependency information to conan lockfile parser (#2131) 2023-09-15 14:31:08 -04:00
schema-11.0.1.json Add relationships for dpkg packages (#2212) 2023-10-11 08:56:26 -04:00
schema-11.0.2.json feat: Add Wordpress cataloger (#2218) 2024-02-14 16:03:25 +00:00
schema-12.0.0.json Remove MetadataType from core package object and normalize JSON metadataType values (#1983) 2023-10-30 12:12:04 -04:00
schema-12.0.1.json Add accessPath on Location objects to syft-json output (#2287) 2023-11-08 17:05:30 -06:00
schema-13.0.0.json Remove the power-user command and related catalogers (#2306) 2023-11-20 15:44:28 +00:00
schema-14.0.0.json allow for RPM modularity to be optional (#2540) 2024-01-24 13:21:59 -05:00
schema-15.0.0.json translate maps to sequences in pkg metadata (#2553) 2024-02-01 11:58:10 -05:00
schema-16.0.0.json feat: Record where CPEs come from (#2552) 2024-02-02 16:17:52 +00:00
schema-16.0.1.json Detect ELF security features (#2443) 2024-02-02 16:51:18 +00:00
schema-16.0.2.json feat: Add Wordpress cataloger (#2218) 2024-02-14 16:03:25 +00:00
schema-16.0.3.json Finalize Conan v2 support (#2587) 2024-02-07 08:24:02 -05:00
schema-16.0.4.json feat: Add Wordpress cataloger (#2218) 2024-02-14 16:03:25 +00:00
schema-latest.json feat: Add Wordpress cataloger (#2218) 2024-02-14 16:03:25 +00:00
vnd.syft+json document current draft for iana submission (#618) 2021-11-10 11:28:47 -05:00

JSON Schema

This is the JSON schema for output from the JSON presenters (syft packages <img> -o json). The required inputs for defining the JSON schema are as follows:

  • the value of internal.JSONSchemaVersion that governs the schema filename
  • the Document struct definition within github.com/anchore/syft/syft/formats/syftjson/model/document.go that governs the overall document shape
  • generated AllTypes() helper function within the syft/internal/sourcemetadata and syft/internal/packagemetadata packages

With regard to testing the JSON schema, integration test cases provided by the developer are used as examples to validate that JSON output from Syft is always valid relative to the schema/json/schema-$VERSION.json file.

Versioning

Versioning the JSON schema must be done manually by changing the JSONSchemaVersion constant within internal/constants.go.

This schema is being versioned based off of the "SchemaVer" guidelines, which slightly diverges from Semantic Versioning to tailor for the purposes of data models.

Given a version number format MODEL.REVISION.ADDITION:

  • MODEL: increment when you make a breaking schema change which will prevent interaction with any historical data
  • REVISION: increment when you make a schema change which may prevent interaction with some historical data
  • ADDITION: increment when you make a schema change that is compatible with all historical data

Adding a New pkg.*Metadata Type

When adding a new pkg.*Metadata that is assigned to the pkg.Package.Metadata struct field you must add a test case to test/integration/catalog_packages_cases_test.go that exercises the new package type with the new metadata.

Additionally it is important to generate a new JSON schema since the pkg.Package.Metadata field is covered by the schema.

Generating a New Schema

Create the new schema by running make generate-json-schema from the root of the repo:

  • If there is not an existing schema for the given version, then the new schema file will be written to schema/json/schema-$VERSION.json
  • If there is an existing schema for the given version and the new schema matches the existing schema, no action is taken
  • If there is an existing schema for the given version and the new schema does not match the existing schema, an error is shown indicating to increment the version appropriately (see the "Versioning" section)

Note: never delete a JSON schema and never change an existing JSON schema once it has been published in a release! Only add new schemas with a newly incremented version. All previous schema files must be stored in the schema/json/ directory.