-
Notifications
You must be signed in to change notification settings - Fork 69
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
feat: add rpm package verification #632
feat: add rpm package verification #632
Conversation
Signed-off-by: Miaha <miahacybersec@gmail.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #632 +/- ##
==========================================
+ Coverage 32.51% 34.20% +1.69%
==========================================
Files 17 18 +1
Lines 1621 1523 -98
==========================================
- Hits 527 521 -6
+ Misses 1062 969 -93
- Partials 32 33 +1 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Miaha <miahacybersec@gmail.com>
pkg/pkgmgr/rpm.go
Outdated
return err == nil | ||
} | ||
|
||
func isValidPackage(ver string) error { |
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.
could we add a unit test to rpm_test file for this function?
Signed-off-by: Miaha <miahacybersec@gmail.com>
Signed-off-by: Miaha <miahacybersec@gmail.com>
// TODO: Verify if there are format correctness check that need to be added given lack of support in rpmVer lib | ||
return true | ||
err := isValidPackage(v) | ||
return err == nil |
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.
instead of isValidPackage maybe we could leave it in this function since we are just checking version?
for _, s := range ver { | ||
if !unicode.IsDigit(s) && !unicode.IsLetter(s) && !strings.ContainsRune(allowedSymbols, s) { | ||
return errors.New("upstream_version includes invalid character") | ||
} |
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.
maybe we can log the upstream_version in the error message. Otherwise the checks look good to me based on the docs!
Signed-off-by: Miaha <miahacybersec@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.
LGTM, thanks!
Closes #601