Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Condense binary cataloger config in JSON output #2499

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

wagoodman
Copy link
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
10 checks passed
@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