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

Parlay error related to supplier with enriching SPDX JSON #92

Closed
goneall opened this issue Dec 8, 2024 · 5 comments · Fixed by #93
Closed

Parlay error related to supplier with enriching SPDX JSON #92

goneall opened this issue Dec 8, 2024 · 5 comments · Fixed by #93

Comments

@goneall
Copy link
Contributor

goneall commented Dec 8, 2024

When enriching the attached file, the following error is generated:

2:36AM FTL Failed to encode new SBOM error="json: error calling MarshalJSON for type *common.Supplier: failed to marshal invalid Supplier: {Supplier: SupplierType:Organization}"

Here's the JSON file being enriched:
o-ran-int-trivy-spdx.json.txt

Parlay version 0.6.0 was used.

Note related: lfscanning/scaffold#131

@goneall
Copy link
Contributor Author

goneall commented Dec 8, 2024

I'll do some debugging and attach a debug output later today.

@goneall
Copy link
Contributor Author

goneall commented Dec 9, 2024

Narrowed the issue down.

It has to do with blank supplier names not being valid.

To fix this, we just need to add a check for empty strings in the conditional at:

if ownerRecord, ok := meta["owner_record"].(map[string]interface{}); ok {

@goneall
Copy link
Contributor Author

goneall commented Dec 9, 2024

I tested the following replacement for line 78 and it resolved the issue:

if name, ok := ownerRecord["name"].(string); ok && len(name) > 0 {

@mcombuechen
Copy link
Collaborator

Thanks @goneall for reporting, this should be a quick fix. 🙂

@goneall
Copy link
Contributor Author

goneall commented Dec 12, 2024

Thanks @mcombuechen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants