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

feat: add Azure Linux 3 vulnerability feed #569

Merged
merged 8 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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 src/vunnel/providers/mariner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Config:
),
)
request_timeout: int = 125
allow_versions: list[str] = field(default_factory=lambda: ["1.0", "2.0"])
allow_versions: list[str] = field(default_factory=lambda: ["1.0", "2.0", "3.0"])


class Provider(provider.Provider):
Expand Down
14 changes: 8 additions & 6 deletions src/vunnel/providers/mariner/generate_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@
from subprocess import PIPE, Popen

import requests

MARINER_URL_BASE = "https://raw.githubusercontent.com/microsoft/CBL-MarinerVulnerabilityData/main/{}"
MARINER_URL_FILENAME = "cbl-mariner-{}-oval.xml"
from parser import VERSION_TO_FILENAME, VERSION_TO_URL


def download_version(version: str, dest_dir: str) -> None:
filename = MARINER_URL_FILENAME.format(version)
url = MARINER_URL_BASE.format(filename)
filename = VERSION_TO_FILENAME[version]
if not filename:
raise Exception(f"mariner/azurelinux provider misconfigured: no filename for version {version}")
url = VERSION_TO_URL[version]
if not url:
raise Exception(f"mariner/azurelinux provider misconfigured: no URL for version {version}")
r = requests.get(url, timeout=125)
destination = os.path.join(dest_dir, filename)
with open(destination, "wb") as w:
w.write(r.content)


def main() -> None:
versions = ["2.0"]
versions = ["2.0", "3.0"]
dest_path = tempfile.TemporaryDirectory()
for v in versions:
download_version(v, dest_path.name)
Expand Down
Loading
Loading