Skip to content

Condense binary cataloger config in JSON output#2499

Merged
wagoodman merged 1 commit intomainfrom
condense-binary-cataloger-config
Jan 16, 2024
Merged

Condense binary cataloger config in JSON output#2499
wagoodman merged 1 commit intomainfrom
condense-binary-cataloger-config

Conversation

@wagoodman
Copy link
Copy Markdown
Contributor

The last rebase of #1383 resulted in bringing in changes from #2469 , which makes the configuration in the JSON output prohibitively large:

syft <anything> -o json | jq '.descriptor.configuration.packages'
    "packages": {
      "binary": {
        "classifiers": [
          {
            "class": "python-binary",
            "cpes": [
              {
                "Edition": "",
                "Language": "",
                "Other": "",
                "Part": "a",
                "Product": "python",
                "SWEdition": "",
                "TargetHW": "",
                "TargetSW": "",
                "Update": "",
                "Vendor": "python_software_foundation",
                "Version": ""
              },
              {
                "Edition": "",
                "Language": "",
                "Other": "",
                "Part": "a",
                "Product": "python",
                "SWEdition": "",
                "TargetHW": "",
                "TargetSW": "",
                "Update": "",
                "Vendor": "python",
                "Version": ""
              }
            ],
            "fileGlob": "**/python*",
            "package": "python",
            "purl": {
              "Name": "python",
              "Namespace": "",
              "Qualifiers": [],
              "Subpath": "",
              "Type": "generic",
              "Version": "version"
            }
          },

...

Note that the binary classifiers are now shown, however, every field in CPEs is shown (as well as others on the config).

This PR makes a few changes:

  • Marshalling the binary Classifier struct will serialize CPEs to a string
  • Marshalling the binary CatalogerConfig struct will only show the class names configured. Since the behavior is not reproducible from a description alone (the evidence parameter, the most important one, is a function) it is not really worth showing the additional fields.

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
@wagoodman wagoodman added the bug Something isn't working label Jan 16, 2024
@wagoodman wagoodman requested a review from a team January 16, 2024 01:44
@wagoodman wagoodman self-assigned this Jan 16, 2024
@wagoodman wagoodman merged commit fb2b54a into main Jan 16, 2024
@wagoodman wagoodman deleted the condense-binary-cataloger-config branch January 16, 2024 14:18
GijsCalis pushed a commit to GijsCalis/syft that referenced this pull request Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants