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

Fixes duplicate & incorrect version in requirements.txt & empty Upgrade To Version Suggestion #401

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Sahilb315
Copy link
Contributor

Fixes #343 #344

Copy link

vet Summary Report

This report is generated by vet

Policy Checks

  • ✅ Vulnerability
  • ✅ Malware
  • ✅ License
  • ✅ Popularity
  • ✅ Maintenance
  • ✅ Security Posture
  • ✅ Threats

Malicious Package Analysis

Malicious package analysis is performed using SafeDep Cloud API.

Malicious Package Analysis Report
Ecosystem Package Version Status Report
  • ℹ️ 0 packages have been actively analyzed for malicious behaviour.
  • ✅ No malicious packages found.

@Sahilb315 Sahilb315 requested a review from abhisek March 18, 2025 16:17
@@ -47,6 +48,16 @@ func (p *lockfileReader) EnumManifests(handler func(*models.PackageManifest,
if err != nil {
return err
}
var updatedPkgs []*models.Package
for _, pkg := range manifest.Packages {
if pkg.PackageDetails.Version != "0.0.0" && pkg.PackageDetails.Version != "" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a hack. Whats the rationale behind this check? It seems to me we are working around a problem with a different root cause, probably related to parser. I think it makes sense to do some analysis and identify the root cause on why version will be empty or 0.0.0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the parser & the issue exists in the osv-scanner lib we are using for parsing the file
https://github.com/google/osv-scanner/blob/v1/pkg/lockfile/parse-requirements-txt.go#L182

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It parses the pkg with default version as 0.0.0 whenever there is no version given for a pkg

@@ -474,8 +474,10 @@ func (r *markdownSummaryReporter) getCheckIconForThreats(internalModel *vetResul
func (r *markdownSummaryReporter) getAdviceSummary(adv *jsonreportspec.RemediationAdvice) (string, error) {
switch adv.Type {
case jsonreportspec.RemediationAdviceType_UpgradePackage:
return fmt.Sprintf("Upgrade to %s@%s", adv.GetTargetPackageName(),
adv.GetTargetPackageVersion()), nil
if adv.GetTargetPackageVersion() != "" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should do some analysis on why GetTargetPackageVersion() return empty version. May be we will discover a much more fundamental problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its probably a issue in the backend right?

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 this pull request may close these issues.

Duplicate & incorrect version resolution when optional dependencies are specified in requirements.txt
2 participants