Ejemplo n.º 1
0
def test_create_service_vuln(session, service):
    data = bc.VulnerabilitySchema(strict=True).load(vuln_data).data
    bc._create_servicevuln(service.workspace, service, data)
    assert count(VulnerabilityGeneric, service.workspace) == 1
    assert count(Vulnerability, service.workspace) == 1
    vuln = service.workspace.vulnerabilities[0]
    assert vuln.service == service
    assert vuln.name == 'sql injection'
    assert vuln.description == 'test'
    assert vuln.severity == 'high'
    assert vuln.impact_accountability
    assert not vuln.impact_availability
    assert not vuln.impact_confidentiality
    assert vuln.references == {u'CVE-1234'}
Ejemplo n.º 2
0
def test_create_service_vuln(session, service):
    data = bc.VulnerabilitySchema().load(vuln_data)
    bc._create_servicevuln(service.workspace, service, data)
    assert count(VulnerabilityGeneric, service.workspace) == 1
    assert count(Vulnerability, service.workspace) == 1
    vuln = service.workspace.vulnerabilities[0]
    assert vuln.service == service
    assert vuln.name == 'sql injection'
    assert vuln.description == 'test'
    assert vuln.severity == 'high'
    assert vuln.impact_accountability
    assert not vuln.impact_availability
    assert not vuln.impact_confidentiality
    assert set(vuln.references) == set(vuln_data['refs'])
    assert set(vuln.cve) == set(vuln_data['cve'] + vuln_data['refs'])
    assert len(vuln.cve) == len(set(vuln_data['cve'] + vuln_data['refs']))
    assert vuln.tool == "some_tool"