Skip to content

Commit

Permalink
Remove use of blank method in filtering (#540)
Browse files Browse the repository at this point in the history
  • Loading branch information
mburumaxwell authored Feb 27, 2023
1 parent 21b8824 commit acf9176
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions updater/bin/update-script.rb
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,14 @@ def security_advisories_for(dep)
safe_versions = (adv["patched-versions"] || []) +
(adv["unaffected-versions"] || [])

# Filter out nil (blank objects) and empty strings which is necessary for situations
# Filter out nil (using .compact), white spaces and empty strings which is necessary for situations
# where the API response contains null that is converted to nil, or it is an empty
# string. For example, npm package named faker does not have patched version as of 2023-01-16
# See: https://github.com/advisories/GHSA-5w9c-rv96-fr7g for npm package
# This ideally fixes
# https://github.com/tinglesoftware/dependabot-azure-devops/issues/453#issuecomment-1383587644
vulnerable_versions = vulnerable_versions.reject(&:blank?).reject(&:empty?)
safe_versions = safe_versions.reject(&:blank?).reject(&:empty?)
vulnerable_versions = vulnerable_versions.compact.reject { |v| v.strip.empty? }
safe_versions = safe_versions.compact.reject { |v| v.strip.empty? }
next if vulnerable_versions.empty? && safe_versions.empty?

Dependabot::SecurityAdvisory.new(
Expand Down

0 comments on commit acf9176

Please sign in to comment.