Passed
Push — main ( 6d7555...1ff08b )
by Jan
05:47 queued 16s
created

openscap_report.scap_results_parser.parsers.known_references   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 62.5%

Importance

Changes 0
Metric Value
eloc 33
dl 0
loc 39
ccs 5
cts 8
cp 0.625
rs 10
c 0
b 0
f 0
wmc 3

1 Function

Rating   Name   Duplication   Size   Complexity  
A update_references() 0 6 3
1 1
from ..namespaces import NAMESPACES
2
3
# pylint: disable=line-too-long
4 1
KNOWN_REFERENCES = {
5
    "http://www.ssi.gouv.fr/administration/bonnes-pratiques/": "ANSSI",
6
    "https://public.cyber.mil/stigs/cci/": "CCI",
7
    "https://www.ccn-cert.cni.es/pdf/guias/series-ccn-stic/guias-de-acceso-publico-ccn-stic/6768-ccn-stic-610a22-perfilado-de-seguridad-red-hat-enterprise-linux-9-0/file.html": "CCN for RHEL 9",  # noqa: E501
8
    "https://www.cisecurity.org/controls/": "CIS",
9
    "https://www.cisecurity.org/benchmark/red_hat_linux/": "CIS for RHEL",
10
    "https://www.fbi.gov/file-repository/cjis-security-policy-v5_5_20160601-2-1.pdf": "CJIS",  # noqa: E501
11
    "http://www.cnss.gov/Assets/pdf/CNSSI-1253.pdf": "CNSS",
12
    "https://www.isaca.org/resources/cobit": "COBIT",
13
    "http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-171.pdf": "CUI",  # noqa: E501
14
    "https://www.gpo.gov/fdsys/pkg/CFR-2007-title45-vol1/pdf/CFR-2007-title45-vol1-chapA-subchapC.pdf": "HIPAA",  # noqa: E501
15
    "https://www.isa.org/products/ansi-isa-62443-3-3-99-03-03-2013-security-for-indu": "ISA-62443-2013",  # noqa: E501
16
    "https://www.isa.org/products/isa-62443-2-1-2009-security-for-industrial-automat": "ISA-62443-2009",  # noqa: E501
17
    "https://www.cyber.gov.au/acsc/view-all-content/ism": "ISM",
18
    "https://www.iso.org/standard/54534.html": "ISO 27001-2013",
19
    "https://www.nerc.com/pa/Stand/Standard%20Purpose%20Statement%20DL/US_Standard_One-Stop-Shop.xlsx": "NERC-CIP",  # noqa: E501
20
    "http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r4.pdf": "NIST 800-53",  # noqa: E501
21
    "https://nvlpubs.nist.gov/nistpubs/CSWP/NIST.CSWP.04162018.pdf": "NIST CSF",  # noqa: E501
22
    "https://www.niap-ccevs.org/Profile/PP.cfm": "OSPP",
23
    "https://www.pcisecuritystandards.org/documents/PCI_DSS_v3-2-1.pdf": "PCI-DSS v3",  # noqa: E501
24
    "https://docs-prv.pcisecuritystandards.org/PCI%20DSS/Standard/PCI-DSS-v4_0.pdf": "PCI-DSS v4",  # noqa: E501
25
    "https://public.cyber.mil/stigs/downloads/?_dl_facet_stigs=application-servers": "SRG-APP",  # noqa: E501
26
    "https://public.cyber.mil/stigs/downloads/?_dl_facet_stigs=operating-systems%2Cgeneral-purpose-os": "SRG-OS",  # noqa: E501
27
    "https://public.cyber.mil/stigs/downloads/?_dl_facet_stigs=operating-systems%2Cunix-linux": "STIG ID",  # noqa: E501
28
    "https://public.cyber.mil/stigs/srg-stig-tools/": "STIG ref",
29
}
30
# pylint: enable=line-too-long
31
32
33 1
def update_references(root):
34 1
    references_elements = root.findall(".//xccdf:Benchmark/xccdf:reference", NAMESPACES)
35 1
    for ref_el in references_elements:
36
        href = ref_el.get("href")
37
        if href is not None:
38
            KNOWN_REFERENCES[href] = ref_el.text
39