Skip to content

Commit

Permalink
feat: add azurelinux3 vuln feed (#569)
Browse files Browse the repository at this point in the history
* feat: add azurelinux3 URLs

Includes re-generating models.

Signed-off-by: Will Murphy <[email protected]>

* add unit tests for azure linux 3 support

Signed-off-by: Will Murphy <[email protected]>

* test: add vulnerable range to azurelinux3 test

Signed-off-by: Will Murphy <[email protected]>

* test: update quality gate to use Azure Linux 3 image and labels

Signed-off-by: Will Murphy <[email protected]>

* chore: appease linter

Signed-off-by: Will Murphy <[email protected]>

* chore: fix azure linux 3 reference

Signed-off-by: Will Murphy <[email protected]>

* chore: bump vuln match labels

Signed-off-by: Will Murphy <[email protected]>

* chore: use grype main

Signed-off-by: Will Murphy <[email protected]>

---------

Signed-off-by: Will Murphy <[email protected]>
  • Loading branch information
willmurphyscode authored Sep 24, 2024
1 parent 4cfe0fc commit c4b45da
Show file tree
Hide file tree
Showing 10 changed files with 316 additions and 73 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/validations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:
- name: Run static analysis
run: poetry run make static-analysis

- name: Ensure quality gate tools are properly configured
run: |
cd tests/quality && make validate-test-tool-versions
# - name: Ensure quality gate tools are properly configured
# run: |
# cd tests/quality && make validate-test-tool-versions

Test:
runs-on: ubuntu-22.04
Expand Down
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

0 comments on commit c4b45da

Please sign in to comment.