Skip to content

Commit

Permalink
Remove HCE/openEuler valid oid checks because they don't have NASL
Browse files Browse the repository at this point in the history
  • Loading branch information
amy-gb committed Jan 8, 2025
1 parent 9307cf1 commit bf4cbff
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 96 deletions.
78 changes: 0 additions & 78 deletions tests/plugins/test_valid_oid.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,84 +672,6 @@ def test_rocky(self):
results[0].message,
)

def test_openeuler_ok(self):
path = Path("some/file.nasl")
content = (
' script_oid("1.3.6.1.4.1.25623.1.1.16.2022.123");\n'
' script_family("openEuler Local Security Checks");\n'
)
fake_context = self.create_file_plugin_context(
nasl_file=path, file_content=content
)
plugin = CheckValidOID(fake_context)

results = list(plugin.run())

self.assertEqual(len(results), 0)

def test_openeuler_not_ok(self):
path = Path("some/file.nasl")
content = (
' script_oid("1.3.6.1.4.1.25623.1.1.16.2022.123");\n'
' script_family("HCE Local Security Checks");\n'
)
fake_context = self.create_file_plugin_context(
nasl_file=path, file_content=content
)
plugin = CheckValidOID(fake_context)

results = list(plugin.run())

self.assertEqual(len(results), 1)

self.assertIsInstance(results[0], LinterError)
self.assertEqual(
(
"script_oid() is using an OID that is reserved for "
"openEuler '1.3.6.1.4.1.25623.1.1.16.2022.123'"
),
results[0].message,
)

def test_hce_ok(self):
path = Path("some/file.nasl")
content = (
' script_oid("1.3.6.1.4.1.25623.1.1.17.2022.123");\n'
' script_family("HCE Local Security Checks");\n'
)
fake_context = self.create_file_plugin_context(
nasl_file=path, file_content=content
)
plugin = CheckValidOID(fake_context)

results = list(plugin.run())

self.assertEqual(len(results), 0)

def test_hce_not_ok(self):
path = Path("some/file.nasl")
content = (
' script_oid("1.3.6.1.4.1.25623.1.1.17.2022.123");\n'
' script_family("openEuler Local Security Checks");\n'
)
fake_context = self.create_file_plugin_context(
nasl_file=path, file_content=content
)
plugin = CheckValidOID(fake_context)

results = list(plugin.run())

self.assertEqual(len(results), 1)

self.assertIsInstance(results[0], LinterError)
self.assertEqual(
(
"script_oid() is using an OID that is reserved for "
"HCE '1.3.6.1.4.1.25623.1.1.17.2022.123'"
),
results[0].message,
)

def test_opensuse_ok(self):
path = Path("some/file.nasl")
content = (
Expand Down
18 changes: 0 additions & 18 deletions troubadix/plugins/valid_oid.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,24 +324,6 @@ def check_content(
plugin=self.name,
)
return
elif vendor_number == "16":
if family != f"openEuler {family_template}":
yield LinterError(
f"script_oid() {is_using_reserved} openEuler "
f"'{str(oid)}'",
file=nasl_file,
plugin=self.name,
)
return
elif vendor_number == "17":
if family != f"HCE {family_template}":
yield LinterError(
f"script_oid() {is_using_reserved} HCE "
f"'{str(oid)}'",
file=nasl_file,
plugin=self.name,
)
return
elif vendor_number == "18":
if family != f"openSUSE {family_template}":
yield LinterError(
Expand Down

0 comments on commit bf4cbff

Please sign in to comment.