-
Notifications
You must be signed in to change notification settings - Fork 574
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: make failed CPE validation correctly return error (#2762)
* Test CPE attributes correctly returns error Previously, this method incorrectly return an empty Attributes object and a nil error, leading to callers attempting to use the empty attributes object. Signed-off-by: Will Murphy <[email protected]> * chore: merge with main and refactor call that relied on old nil behavior Signed-off-by: Christopher Phillips <[email protected]> * test: add test to cover new OSCPE err pattern Signed-off-by: Christopher Phillips <[email protected]> --------- Signed-off-by: Will Murphy <[email protected]> Signed-off-by: Christopher Phillips <[email protected]> Co-authored-by: Christopher Phillips <[email protected]>
- Loading branch information
1 parent
32c0d1e
commit 770fdc5
Showing
5 changed files
with
33 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,6 +113,18 @@ func Test_packageURL(t *testing.T) { | |
}, | ||
want: "pkg:generic/system/[email protected]", | ||
}, | ||
{ | ||
name: "bad or missing OSCPE data cannot be parsed allows for correct string", | ||
metadata: elfBinaryPackageNotes{ | ||
Name: "test", | ||
Version: "1.0", | ||
ELFBinaryPackageNoteJSONPayload: pkg.ELFBinaryPackageNoteJSONPayload{ | ||
System: "system", | ||
OSCPE: "%$#*(#*@&$(", | ||
}, | ||
}, | ||
want: "pkg:generic/system/[email protected]", | ||
}, | ||
} | ||
|
||
for _, test := range tests { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters