Skip to content

Commit

Permalink
refactor: deduplicate filtering pmd results from security.txt
Browse files Browse the repository at this point in the history
already done in `loadFromSecurity`
  • Loading branch information
mgoetzegb committed Jul 1, 2024
1 parent ea8fd0b commit a88f326
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions csaf/providermetaloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,20 +178,7 @@ func (pmdl *ProviderMetadataLoader) Load(domain string) *LoadedProviderMetadata
}

// Next load the PMDs from security.txt
secResults := pmdl.loadFromSecurity(domain)

// Filter out the results which are valid.
var secGoods []*LoadedProviderMetadata

for _, result := range secResults {
if len(result.Messages) > 0 {
// If there where validation issues append them
// to the overall report
pmdl.messages.AppendUnique(pmdl.messages)
} else {
secGoods = append(secGoods, result)
}
}
secGoods := pmdl.loadFromSecurity(domain)

// Mention extra CSAF entries in security.txt.
ignoreExtras := func() {
Expand Down Expand Up @@ -246,7 +233,7 @@ func (pmdl *ProviderMetadataLoader) Load(domain string) *LoadedProviderMetadata
return dnsURLResult
}

// loadFromSecurity loads the PMDs mentioned in the security.txt.
// loadFromSecurity loads the PMDs mentioned in the security.txt. Only valid PMDs are returned.
func (pmdl *ProviderMetadataLoader) loadFromSecurity(domain string) []*LoadedProviderMetadata {

// If .well-known fails try legacy location.
Expand Down

0 comments on commit a88f326

Please sign in to comment.