Skip to content

Commit

Permalink
Change: Various deprecated PCIDSS VT relevant clean-ups
Browse files Browse the repository at this point in the history
- Update exclusion pattern after moving some VTs
- Remove various exclusion pattern which are no longer required / not
  valid anymore
- Remove multiple TODOs which are no longer required / valid
- Adjust tests accordingly
  • Loading branch information
cfi-gb committed Jun 12, 2024
1 parent 19200fe commit ceac3a0
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 58 deletions.
4 changes: 2 additions & 2 deletions tests/plugins/test_duplicated_script_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def test_excluded_tag(self):
self.assertEqual(len(results), 0)

def test_excluded_dependencies(self):
path = Path("gsf/PCIDSS/v2.0/PCI-DSS-2.0.nasl")
path = Path("some/file/just/for/unit/tests.nasl")
content = (
' script_dependencies("vt1.nasl", "vt2.nasl");\n'
' script_dependencies("vt3.nasl", "vt4.nasl");\n'
Expand All @@ -123,7 +123,7 @@ def test_excluded_dependencies(self):
self.assertEqual(len(results), 0)

def test_not_excluded_dependencies(self):
path = Path("v2.0/PCI-DSS-2.0.nasl")
path = Path("some/file.nasl")
content = (
' script_dependencies("vt1.nasl", "vt2.nasl");\n'
' script_dependencies("vt3.nasl", "vt4.nasl");\n'
Expand Down
10 changes: 1 addition & 9 deletions troubadix/plugins/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,6 @@ def run(
dependencies += [dep for dep in _dependencies if dep != ""]

for dep in dependencies:
# TODO: gsf/PCIDSS/PCI-DSS.nasl,
# gsf/PCIDSS/v2.0/PCI-DSS-2.0.nasl
# and GSHB/EL15/GSHB.nasl
# are using a variable which we currently
# can't handle.
if "+d+.nasl" in dep:
continue

if not any(
(root / vers / dep).exists() for vers in FEED_VERSIONS
):
Expand All @@ -103,7 +95,7 @@ def run(
continue

parent_folder = parts[0]
if parent_folder in ["PCIDSS", "Policy", "GSHB"]:
if parent_folder in ["Policy", "GSHB"]:
yield LinterWarning(
f"The script dependency {dep} is in a "
"subdirectory, which might be misplaced.",
Expand Down
7 changes: 0 additions & 7 deletions troubadix/plugins/dependency_category_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,6 @@ def check_content(
).split(",")

for dep in dependencies:
# TODO: gsf/PCIDSS/PCI-DSS.nasl,
# gsf/PCIDSS/v2.0/PCI-DSS-2.0.nasl
# and GSHB/EL15/GSHB.nasl
# are using a variable which we currently can't handle.
if "+d+.nasl" in dep:
continue

dependency_path = None
for vers in FEED_VERSIONS:
if (root / vers / dep).exists():
Expand Down
7 changes: 0 additions & 7 deletions troubadix/plugins/deprecated_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ def run(self) -> Iterator[LinterResult]:
).split(",")

for dep in dependencies:
# TODO: gsf/PCIDSS/PCI-DSS.nasl,
# gsf/PCIDSS/v2.0/PCI-DSS-2.0.nasl
# and GSHB/EL15/GSHB.nasl
# are using a variable which we currently can't handle.
if "+d+.nasl" in dep:
continue

dependency_path = None
for vers in FEED_VERSIONS:
if (root / vers / dep).exists():
Expand Down
4 changes: 1 addition & 3 deletions troubadix/plugins/duplicated_script_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
from troubadix.plugin import FilePlugin, LinterError, LinterResult

allowed_dup_dependencies = [
"GSHB/EL15/GSHB.nasl",
"gsf/PCIDSS/PCI-DSS.nasl",
"gsf/PCIDSS/v2.0/PCI-DSS-2.0.nasl",
"some/file/just/for/unit/tests.nasl",
]


Expand Down
19 changes: 0 additions & 19 deletions troubadix/plugins/misplaced_compare_in_if.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,6 @@
# version. As changing the if now might change their behavior and the VTs are
# candidates for deprecation they are ignored for now.
IGNORE_FILES = [
"PCIDSS_M8.2.4.a.nasl",
"PCIDSS_M10.3.2.nasl",
"PCIDSS_M10.2.6.nasl",
"PCIDSS_M10.2.4.nasl",
"PCIDSS_M8.2.5.a.nasl",
"PCIDSS_M10.3.1.nasl",
"PCI-DSS.nasl",
"PCIDSS_M8.1.4.nasl",
"PCIDSS_M10.3.3.nasl",
"PCIDSS_M10.2.5.nasl",
"PCIDSS_M8.1.7.nasl",
"PCIDSS_M10.3.5.nasl",
"PCIDSS_M8.1.8.nasl",
"PCIDSS_M10.3.6.nasl",
"PCIDSS_M8.2.3.a.nasl",
"PCIDSS_M8.1.6.a.nasl",
"PCIDSS_M10.3.4.nasl",
"PCIDSS_M5.2.a.nasl",
"PCIDSS_M5.1.nasl",
"GSHB_WMI_Apache.nasl",
"GSHB_WMI_EFS.nasl",
"GSHB_WMI_Antivir.nasl",
Expand Down
1 change: 0 additions & 1 deletion troubadix/plugins/reporting_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"GSHB/GSHB_WMI_CD-FD-User-only-access.nasl",
"gb_dicom_service_ae_title_brute_force.nasl",
"Policy/policy_controls_fail.nasl",
"PCIDSS/PCI-DSS.nasl",
"2016/gb_ssl_tls_weak_hash_algo.nasl",
"2018/gb_unquoted_path_vulnerabilities_win.nasl",
"2009/remote-net-hub-3com.nasl",
Expand Down
6 changes: 1 addition & 5 deletions troubadix/plugins/security_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,7 @@ def _check_security_message_absent(
file_content (str): The content of the VT
"""
# Policy VTs might use both, security_message and log_message
if (
"Policy/" in str(nasl_file)
or "PCIDSS/" in str(nasl_file)
or "GSHB/" in str(nasl_file)
):
if "Policy/" in str(nasl_file) or "GSHB/" in str(nasl_file):
return

if _file_contains_security_message(file_content):
Expand Down
10 changes: 5 additions & 5 deletions troubadix/plugins/spelling.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,16 @@
r"(deb_(dla_)?[0-9]+(_[0-9]+)?|gb_ubuntu_.+)\.nasl",
r"ure\s+==>\s+sure",
),
# gsf/PCIDSS VTs are currently using some german text parts
# gsf/attic/PCIDSS*/ VTs are currently using some german text parts
# nb: codespell seems to have some issues with
# german umlauts in the codespell.exclude so a few of these
# were also excluded here instead of directly
# via codespell.exclude.
PatternInFilesCheck(
[
"PCIDSS/",
"attic/PCIDSS/",
"GSHB/",
"attic/PCIDSS_",
"attic/PCIDSS-2.0/",
"ITG_Kompendium/",
"Policy/ITG/",
],
Expand All @@ -95,12 +95,12 @@
r"modell|klick|generell|vor)\s+==>\s+",
re.IGNORECASE,
),
# False positives in the gsf/PCIDSS and GSHB/ VTs:
# False positives in the gsf/attic/PCIDSS*/ and GSHB/ VTs:
# string('\nIn the file sent\nin milliseconds
# There are too many hits to maintain
# them in codespell.exclude so exclude them for now here.
PatternInFilesCheck(
["PCIDSS/", "GSHB/", "attic/PCIDSS_", "Policy/ITG/"],
["attic/PCIDSS/", "GSHB/", "attic/PCIDSS-2.0/", "Policy/ITG/"],
r"n[iI]n\s+==>\s+inn",
),
# False positive in this VT in German example responses.
Expand Down

0 comments on commit ceac3a0

Please sign in to comment.