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

Relationships not evaluated #486

Closed
tschmidtb51 opened this issue Oct 30, 2023 · 5 comments · Fixed by #497
Closed

Relationships not evaluated #486

tschmidtb51 opened this issue Oct 30, 2023 · 5 comments · Fixed by #497
Labels
bug Something isn't working csaf_searcher

Comments

@tschmidtb51
Copy link
Collaborator

The current version (might be v3.0.0-beta-39-g0905824) does not evaluate purls given in a relationship item.

@tschmidtb51 tschmidtb51 added bug Something isn't working csaf_searcher labels Oct 30, 2023
@s-l-teichmann
Copy link
Contributor

@tschmidtb51 Can you describe briefly what the expected behavior should be?

@tschmidtb51
Copy link
Collaborator Author

All purls in the following example should be found:

{
  "document": {
    "title": "CSAF_searcher purl test",
    "csaf_version": "2.0",
    "category": "csaf_base",
    "publisher": {
      "category": "vendor",
      "name": "Example Company",
      "namespace": "https://www.example.com",
      "contact_details": "[email protected]"
    },
    "tracking": {
      "revision_history": [
        {
          "number": "1",
          "date": "2023-11-02T00:00:00Z",
          "summary": "Initial version"
        }
      ],
      "initial_release_date": "2023-10-30T00:00:00Z",
      "current_release_date": "2023-10-30T00:00:00Z",
      "version": "1",
      "id": "ESA-2023-1003",
      "status": "draft"
    }
  },
  "product_tree": {
    "branches": [
      {
        "category": "vendor",
        "name": "Example Company",
        "branches": [
          {
            "category": "product_name",
            "name": "Product A",
            "branches": [
              {
                "category": "product_version",
                "name": "1.0",
                "product": {
                  "name": "Product A 1.0",
                  "product_id": "1",
                  "product_identification_helper": {
                    "purl": "pkg:example/a:1.0"
                  }
                }
              }
            ]
          }
        ]
      }
    ],
    "full_product_names": [
      {
        "name": "Any",
        "product_id": "CSAFPID-0002",
        "product_identification_helper": {
          "purl": "pkg:no-valid-type/any"
        }
      },
      {
        "name": "Other",
        "product_id": "CSAFPID-0003",
        "product_identification_helper": {
          "purl": "pkg:no-valid-type/other"
        }
      }
    ],
    "relationships": [
      {
        "category": "installed_with",
        "product_reference": "CSAFPID-0002",
        "relates_to_product_reference": "CSAFPID-0003",
        "full_product_name": {
          "name": "Any installed with Other",
          "product_id": "CSAFPID-0004",
          "product_identification_helper": {
            "purl": "pkg:no-valid-type/any-other"
          }
        }
      }
    ]
  }
}

Currently, pkg:no-valid-type/any-other is missing.

@s-l-teichmann
Copy link
Contributor

Side note:

Loading the document above fails.

./purls_searcher -p CSAFPID-0004 x.json                                   main?
2023/11/02 17:49:41 error: loading "x.json" failed: pkg:no-valid-type/any does not match ^pkg:[A-Za-z\\.\\-\\+][A-Za-z0-9\\.\\-\\+]*/.+

https://github.com/csaf-poc/csaf_distribution/blob/effd4a01af4b5e14fc25200540eb664617a857b3/csaf/advisory.go#L109 does not use the right quoting. I'll fix this on the way. Same for https://github.com/csaf-poc/csaf_distribution/blob/effd4a01af4b5e14fc25200540eb664617a857b3/csaf/advisory.go#L226

@tschmidtb51
Copy link
Collaborator Author

@s-l-teichmann Thanks for looking into that - I didn't realized this since I looked at the code when finding the issue (and didn't check the example against the running program).

@s-l-teichmann
Copy link
Contributor

PR #497 now gives:

./purls_searcher -p CSAFPID-0004 x.json
Found URLs for CSAFPID-0004:
1. pkg:no-valid-type/any-other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working csaf_searcher
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants