-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
refactor(sbom): add intermediate representation for BOM #6240
Conversation
Signed-off-by: knqyf263 <knqyf263@gmail.com>
Signed-off-by: knqyf263 <knqyf263@gmail.com>
Signed-off-by: knqyf263 <knqyf263@gmail.com>
Signed-off-by: knqyf263 <knqyf263@gmail.com>
Signed-off-by: knqyf263 <knqyf263@gmail.com>
Signed-off-by: knqyf263 <knqyf263@gmail.com>
Signed-off-by: knqyf263 <knqyf263@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@knqyf263 lgtm , I have added some nit
comments
@@ -379,3 +381,7 @@ func (t *Package) UnmarshalJSONWithMetadata(node jfather.Node) error { | |||
t.EndLine = node.Range().End.Line | |||
return nil | |||
} | |||
|
|||
func packageID(name, version string) string { | |||
return dependency.ID(ftypes.Npm, name, version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
keep function call consist, in some cases dependency.ID
called directly in some cases it has a wrapper packageID
in another case there is a wrapper ID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is called once, I'd call dependency.ID
directly. If it is called several times. I defined packageID
. As you said, ID
and packageID
should be aligned. Fixed in 0e025f9. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you help me understand why we can't just always use dependency.ID
?
If it is called once, I'd call dependency.ID directly. If it is called several times. I defined packageID
Add packageID
:
- pkg/dependency/parser/java/pom/parse.go
Use dependency.ID
:
- pkg/dependency/parser/swift/swift/parse.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@knqyf263 take a look comment above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Left 2 comments.
Co-authored-by: DmitriyLewen <91113035+DmitriyLewen@users.noreply.github.com>
Signed-off-by: knqyf263 <knqyf263@gmail.com>
Signed-off-by: knqyf263 <knqyf263@gmail.com>
Signed-off-by: knqyf263 <knqyf263@gmail.com>
@knqyf263 what do you use to draw that diagram? looks neat. |
@codefromthecrypt This one https://excalidraw.com/ |
Signed-off-by: knqyf263 <knqyf263@gmail.com>
@DmitriyLewen @chen-keinan I've resolved all comments. Can you please take another look? |
Signed-off-by: knqyf263 <knqyf263@gmail.com>
Signed-off-by: knqyf263 <knqyf263@gmail.com>
Overview
This PR introduces refactoring of the SBOM implementation, which is complicated now. The primary focus is to abstract the intermediate representation of BOMs, transition from a CycloneDX-specific model to a more generic structure, and pave the way for supporting additional formats like SPDX with increased efficiency and reduced code duplication.
Key Changes
core.BOM
: To address the limitations of the tightly coupled implementation with CycloneDX, we've introduced a new intermediate representation,core.BOM
. This abstraction not only facilitates a cleaner and more generic implementation but also simplifies future extensions to support other standards.types.SBOM
led to redundant code and disparities in feature support between the two formats. By converting tocore.BOM
first, we streamline the decoding process, ensuring that improvements and fixes benefit both formats equally.Next Steps
This PR focuses on introducing a more loosely coupled intermediate representation and incorporating reverse conversion capabilities. The conversion to SPDX, alongside additional enhancements and optimizations, will be covered in upcoming pull requests.
Design
Current
Goal
Checklist