diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index 6d36672..f969314 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -56,7 +56,7 @@ jobs: LW_API_SECRET: ${{ secrets.LW_API_SECRET }} LW_BASE_DOMAIN: ${{ secrets.LW_BASE_DOMAIN }} - name: Report Status - if: contains(github.ref, "main") + if: github.ref_name == 'main' uses: ravsamhq/notify-slack-action@v2 with: status: ${{ job.status }} diff --git a/laceworksdk/api/v2/vulnerabilities.py b/laceworksdk/api/v2/vulnerabilities.py index b57d8bc..89f3366 100644 --- a/laceworksdk/api/v2/vulnerabilities.py +++ b/laceworksdk/api/v2/vulnerabilities.py @@ -42,6 +42,7 @@ def __init__(self, session): self.containers = self.ContainerVulnerabilitiesAPI(session, self._base_path) self.hosts = self.HostVulnerabilitiesAPI(session, self._base_path) self.packages = self.SoftwarePackagesAPI(session, self._base_path) + self.imageSummary = self.ImageSummaryVulnerabilitiesAPI(session, self._base_path) class ContainerVulnerabilitiesAPI(SearchEndpoint): """A class used to represent the Container Vulnerabilities API endpoint.""" @@ -90,6 +91,12 @@ def status(self, request_id): ) return response.json() + + class ImageSummaryVulnerabilitiesAPI(SearchEndpoint): + """A class used to represent the ImageSummary Vulnerabilities API endpoint.""" + + RESOURCE = "ImageSummary" + class HostVulnerabilitiesAPI(SearchEndpoint): """A class used to represent the Host Vulnerabilities API endpoint.""" diff --git a/tests/api/v2/test_vulnerabilities.py b/tests/api/v2/test_vulnerabilities.py index b6c3142..c1d7032 100644 --- a/tests/api/v2/test_vulnerabilities.py +++ b/tests/api/v2/test_vulnerabilities.py @@ -23,7 +23,8 @@ class TestVulnerabilitesEndpoint(SearchEndpoint): OBJECT_TYPE = VulnerabilitiesAPI OBJECT_MAP = { "containers": VulnerabilitiesAPI.ContainerVulnerabilitiesAPI, - "hosts": VulnerabilitiesAPI.HostVulnerabilitiesAPI + "hosts": VulnerabilitiesAPI.HostVulnerabilitiesAPI, + "imageSummary": VulnerabilitiesAPI.ImageSummaryVulnerabilitiesAPI } def test_vulnerabilities_containers_api_scan(self, api_object, request): @@ -67,3 +68,16 @@ def test_vulnerabilities_packages_api_scan(api, api_object): "pkgVer": "1.1.1-1ubuntu2.1~20.04" }]) assert "data" in response.keys() + + def test_vulnerabilities_image_summary_search(api, api_object): + json = { + "timeFilter": { + "startTime": "2024-03-18T00:00:00Z", + "endTime": "2024-03-19T08:00:00Z" + }, + "filters" : [ + {"field": "ndvContainers", "expression": "gt", "value": 0} + ] + } + response = api_object.imageSummary.search(json) + assert "data" in next(response, None) \ No newline at end of file