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

Add SLES snapshot tests #343

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"schema":"https://raw.githubusercontent.com/anchore/vunnel/main/schema/vulnerability/os/schema-1.0.0.json","identifier":"sles:15.1/cve-2021-29154","item":{"Vulnerability":{"Name":"CVE-2021-29154","NamespaceName":"sles:15.1","Description":"BPF JIT compilers in the Linux kernel through 5.11.12 have incorrect computation of branch displacements, allowing them to execute arbitrary code within the kernel context. This affects arch/x86/net/bpf_jit_comp.c and arch/x86/net/bpf_jit_comp32.c.","Severity":"High","Link":"https://www.suse.com/security/cve/CVE-2021-29154","CVSS":[{"version":"3.1","vector_string":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H","base_metrics":{"base_score":7.0,"exploitability_score":1.0,"impact_score":5.9,"base_severity":"High"},"status":"N/A"}],"FixedIn":[{"Name":"kernel-default","NamespaceName":"sles:15.1","VersionFormat":"rpm","Version":"0:4.12.14-197.89.2","Module":"","VendorAdvisory":{"NoAdvisory":false,"AdvisorySummary":[]}}],"Metadata":{}}}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"schema":"https://raw.githubusercontent.com/anchore/vunnel/main/schema/vulnerability/os/schema-1.0.0.json","identifier":"sles:15/cve-2021-29154","item":{"Vulnerability":{"Name":"CVE-2021-29154","NamespaceName":"sles:15","Description":"BPF JIT compilers in the Linux kernel through 5.11.12 have incorrect computation of branch displacements, allowing them to execute arbitrary code within the kernel context. This affects arch/x86/net/bpf_jit_comp.c and arch/x86/net/bpf_jit_comp32.c.","Severity":"High","Link":"https://www.suse.com/security/cve/CVE-2021-29154","CVSS":[{"version":"3.1","vector_string":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H","base_metrics":{"base_score":7.0,"exploitability_score":1.0,"impact_score":5.9,"base_severity":"High"},"status":"N/A"}],"FixedIn":[{"Name":"kernel-default","NamespaceName":"sles:15","VersionFormat":"rpm","Version":"0:4.12.14-150.72.1","Module":"","VendorAdvisory":{"NoAdvisory":false,"AdvisorySummary":[]}}],"Metadata":{}}}}
23 changes: 23 additions & 0 deletions tests/unit/providers/sles/test_sles.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,3 +308,26 @@ def mock_download(self, *args, **kwargs):

assert 2 == workspace.num_result_entries()
assert workspace.result_schemas_valid(require_entries=True)


def test_provider_via_snapshot(helpers, disable_get_requests, monkeypatch):
workspace = helpers.provider_workspace_helper(name=Provider.name())

c = Config()
# keep all of the default values for the result store, but override the strategy
c.runtime.result_store = result.StoreStrategy.FLAT_FILE
p = Provider(
root=workspace.root,
config=c,
)

mock_data_path = helpers.local_dir("test-fixtures/suse_truncated.xml")
shutil.copy(mock_data_path, workspace.input_dir / "suse-linux-enterprise-server-15.xml")

def mock_download(self, *args, **kwargs):
return mock_data_path

monkeypatch.setattr(p.parser, "_download", mock_download)
p.update(None)

workspace.assert_result_snapshots()
Loading