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

fix: ensure that package exists in affected property #1055

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/generators/GenerateMavenVersions.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static Map<String, List<String>> fetchPackageVersions() throws IOExceptio
osvs.forEach(osv -> osv.getJSONArray("affected").forEach(aff -> {
JSONObject affected = (JSONObject) aff;

if(affected.getJSONObject("package").getString("ecosystem").equals("Maven")) {
if(!affected.has("package") || affected.getJSONObject("package").getString("ecosystem").equals("Maven")) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/generators/generate-cran-versions.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extract_packages_with_versions <- function(osvs) {

for (osv in osvs) {
for (affected in osv$affected) {
if (affected$package$ecosystem != "CRAN") {
if (is.null(affected["package"]) || affected$package$ecosystem != "CRAN") {
next
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/generators/generate-debian-versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def extract_packages_with_versions(osvs):

for osv in osvs:
for affected in osv['affected']:
if not affected['package']['ecosystem'].startswith('Debian'):
if 'package' not in affected or not affected['package']['ecosystem'].startswith('Debian'):
continue

package = affected['package']['name']
Expand Down
2 changes: 1 addition & 1 deletion scripts/generators/generate-packagist-versions.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function fetchPackageVersions(): array

foreach ($osvs as $osv) {
foreach ($osv['affected'] as $affected) {
if ($affected['package']['ecosystem'] !== 'Packagist') {
if (!isset($affected['package']) || $affected['package']['ecosystem'] !== 'Packagist') {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/generators/generate-pypi-versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def extract_packages_with_versions(osvs):

for osv in osvs:
for affected in osv['affected']:
if affected['package']['ecosystem'] != 'PyPI':
if 'package' not in affected or affected['package']['ecosystem'] != 'PyPI':
continue

package = affected['package']['name']
Expand Down
2 changes: 1 addition & 1 deletion scripts/generators/generate-rubygems-versions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def extract_packages_with_versions(osvs)

osvs.each do |osv|
osv["affected"].each do |affected|
next unless affected["package"]["ecosystem"] == "RubyGems"
next unless affected.dig("package", "ecosystem") == "RubyGems"

package = affected["package"]["name"]

Expand Down
Loading