Skip to content

Commit 946ff73

Browse files
authored
Merge pull request #184 from sbs2001/fix_schema_validator_alpine
Update the schema validator in alpine linux importer
2 parents 29f3351 + 9202ba0 commit 946ff73

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

vulnerabilities/importers/alpine_linux.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,14 @@ def validate_schema(advisory_dict):
5353
Regex(r"XSA-\d{3}"),
5454
Regex(r"ZBX-\d{4}"),
5555
Regex(r"wnpa-sec-\d{4}-\d{2}"),
56+
57+
5658
)
5759
],
5860
"",
61+
# FIXME: Remove the None when below issue gets fixed
62+
# https://gitlab.alpinelinux.org/alpine/infra/alpine-secdb/-/issues/1
63+
None
5964
),
6065
},
6166
}
@@ -88,10 +93,10 @@ def _process_file(self, path) -> List[Advisory]:
8893

8994
with open(path) as f:
9095
record = yaml.safe_load(f)
91-
validate_schema(record)
9296

9397
if record['packages'] is None:
9498
return advisories
99+
validate_schema(record)
95100

96101
for p in record['packages']:
97102
advisories.extend(self._load_advisories(
@@ -123,7 +128,8 @@ def _load_advisories(
123128
name=pkg_infos['name'],
124129
type='alpine',
125130
version=version,
126-
qualifiers={'arch': arch, 'distroversion': distroversion, 'reponame': reponame},
131+
qualifiers={
132+
'arch': arch, 'distroversion': distroversion, 'reponame': reponame},
127133
)
128134
for arch in archs
129135
}

0 commit comments

Comments
 (0)