-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add download_cve_report_csv method to download the csv report (#…
…161) This method takes a while in environments where the amount of images is very high, please use it carefully.
- Loading branch information
1 parent
80c41ec
commit 8611ed3
Showing
6 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import os | ||
|
||
from expects import * | ||
from mamba import * | ||
|
||
from sdcclient import SdScanningClient | ||
from specs import be_successful_api_call | ||
|
||
with description("CVE Reports", "integration") as self: | ||
with before.all: | ||
self.client = SdScanningClient(sdc_url=os.getenv("SDC_SECURE_URL", "https://secure.sysdig.com"), | ||
token=os.getenv("SDC_SECURE_TOKEN")) | ||
with context("when the CSV of static can be downloaded"): | ||
with it("is able to download it for OS vulnerabilities"): | ||
ok, csv = self.client.download_cve_report_csv(vuln_type="os", scope_type="static") | ||
|
||
expect((ok, csv)).to(be_successful_api_call) | ||
expect(csv).to(start_with("Image Name,Tag,Package Name,Package Version,Package Path,Severity,Fixed In," | ||
"Vulnerability ID,Links,Image Digest,Runtime Metadata")) | ||
|
||
with it("is able to download it for non-OS vulnerabilities"): | ||
ok, csv = self.client.download_cve_report_csv(vuln_type="non-os", scope_type="static") | ||
|
||
expect((ok, csv)).to(be_successful_api_call) | ||
expect(csv).to(start_with("Image Name,Tag,Package Name,Package Version,Package Path,Severity,Fixed In," | ||
"Vulnerability ID,Links,Image Digest,Runtime Metadata")) | ||
|
||
with context("when the CSV of runtime can be downloaded"): | ||
with it("is able to download it for OS vulnerabilities"): | ||
ok, csv = self.client.download_cve_report_csv(vuln_type="os", scope_type="runtime") | ||
|
||
expect((ok, csv)).to(be_successful_api_call) | ||
expect(csv).to(start_with("Image Name,Tag,Package Name,Package Version,Package Path,Severity,Fixed In," | ||
"Vulnerability ID,Links,Image Digest,Runtime Metadata")) | ||
|
||
with it("is able to download it for non-OS vulnerabilities"): | ||
ok, csv = self.client.download_cve_report_csv(vuln_type="non-os", scope_type="runtime") | ||
|
||
expect((ok, csv)).to(be_successful_api_call) | ||
expect(csv).to(start_with("Image Name,Tag,Package Name,Package Version,Package Path,Severity,Fixed In," | ||
"Vulnerability ID,Links,Image Digest,Runtime Metadata")) |
File renamed without changes.
File renamed without changes.