Skip to content

Commit eefb4e8

Browse files
committed
code review 2
1 parent 71faa0e commit eefb4e8

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

cmd/devguard/api/api.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,7 @@ func BuildRouter(db core.DB) *echo.Echo {
683683
licenseRiskRouter.POST("/:licenseRiskID/", licenseRiskController.CreateEvent, neededScope([]string{"manage"}), projectScopedRBAC(core.ObjectAsset, core.ActionUpdate))
684684
licenseRiskRouter.POST("/:licenseRiskID/mitigate", licenseRiskController.Mitigate, neededScope([]string{"manage"}), projectScopedRBAC(core.ObjectAsset, core.ActionUpdate))
685685
licenseRiskRouter.POST("/:licenseRiskID/finalLicenseDecision", licenseRiskController.MakeFinalLicenseDecision, neededScope([]string{"manage"}), projectScopedRBAC(core.ObjectAsset, core.ActionUpdate))
686+
686687
routes := server.Routes()
687688
sort.Slice(routes, func(i, j int) bool {
688689
return routes[i].Path < routes[j].Path

internal/database/models/license_risk_model.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func (licenseRisk LicenseRisk) GetType() VulnType {
2222
}
2323

2424
func (licenseRisk *LicenseRisk) CalculateHash() string {
25-
// we should only use static information for the hash thats why the final license decision is not included
25+
// we should only use static and unique information for the hash ( maybe we need to add scanner IDs, see pull request)
2626
hash := utils.HashString(fmt.Sprintf("%s/%s/%s", licenseRisk.ComponentPurl, licenseRisk.AssetVersionName, licenseRisk.AssetID))
2727
return hash
2828
}

internal/database/repositories/license_risk_repository.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (repository *LicenseRiskRepository) GetAllLicenseRisksForAssetVersionPaged(
3939
q = q.Where(f.SQL(), f.Value())
4040
}
4141
if search != "" && len(search) > 2 {
42-
q = q.Where("license_risks.license_id ILIKE ? OR license_risks.component_purl ILIKE ? OR license_risks.scanner_ids ILIKE ?", "%"+search+"%", "%"+search+"%", "%"+search+"%")
42+
q = q.Where("license_risks.final_license_decision ILIKE ? OR license_risks.component_purl ILIKE ? OR license_risks.scanner_ids ILIKE ?", "%"+search+"%", "%"+search+"%", "%"+search+"%")
4343
}
4444

4545
err := q.Count(&count).Error

0 commit comments

Comments
 (0)