Add dashboard rule atlas
This commit is contained in:
parent
5db88d285e
commit
e43d7689a0
7 changed files with 130 additions and 17 deletions
|
|
@ -105,6 +105,17 @@ class TestDataLayer(unittest.TestCase):
|
|||
self.assertEqual(report["counts"], {"HIGH": 1, "MEDIUM": 1})
|
||||
self.assertEqual(report["findings"][0]["signature"], "ssh_root_login")
|
||||
|
||||
def test_rules_catalog_shape(self):
|
||||
catalog = web.rules_catalog(self.cfg)
|
||||
self.assertGreater(catalog["count"], 0)
|
||||
self.assertIn("exec", catalog["by_event"])
|
||||
self.assertIn("syscall", catalog["by_event"])
|
||||
self.assertIn("CRITICAL", catalog["by_severity"])
|
||||
self.assertIn("builtin", catalog["by_origin"])
|
||||
rule = next(r for r in catalog["rules"] if r["sid"] == 100002)
|
||||
self.assertEqual(rule["event"], "exec")
|
||||
self.assertIn("conditions", rule)
|
||||
|
||||
|
||||
class TestNetworkHelpers(unittest.TestCase):
|
||||
def test_is_loopback(self):
|
||||
|
|
@ -182,6 +193,12 @@ class TestAuth(unittest.TestCase):
|
|||
self.assertIn("findings", data)
|
||||
self.assertIn("count", data)
|
||||
|
||||
def test_rules_endpoint(self):
|
||||
resp = self._get("/api/rules", token="secret-token")
|
||||
data = json.loads(resp.read())
|
||||
self.assertIn("rules", data)
|
||||
self.assertGreater(data["count"], 0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue