From 25ce80ec7dc0d9155962aa96164f01420f2a4cfc Mon Sep 17 00:00:00 2001 From: John Van de Meulebrouck Brendgard Date: Mon, 11 Apr 2022 21:11:29 +0200 Subject: Added investigation_needed and made it required to specify either vulnerable or investigation_needed. --- example_data_1.json | 7 +++++++ src/schema.py | 31 ++++++++++++++++++++++--------- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/example_data_1.json b/example_data_1.json index 51d6a95..61942c4 100644 --- a/example_data_1.json +++ b/example_data_1.json @@ -46,6 +46,13 @@ "vulnerable": true, "reliability": 5, "description": "Uses RSA instead of elliptic curve." + }, + "possible_webshell": { + "display_name": "Webshells (PST)", + "investigation_needed": true, + "reliability": 1, + "description": "A webshell of type PST was confirmed at /test/webshell.php" } + } } diff --git a/src/schema.py b/src/schema.py index 29df4f3..f92a2ea 100644 --- a/src/schema.py +++ b/src/schema.py @@ -46,16 +46,29 @@ schema = { ".*": { "type": "object", "properties": { - "display_name": {"type": "string"}, - "vulnerable": {"type": "boolean"}, - "reliability": {"type": "integer"}, - "description": {"type": "string"}, + "display_name": {"type": "string"}, + "vulnerable": {"type": "boolean"}, + "investigation_needed": {"type": "boolean"}, + "reliability": {"type": "integer"}, + "description": {"type": "string"}, }, - "required": [ - "display_name", - "vulnerable", - # "reliability", # TODO: reliability is required if vulnerable = true - # "description", + "oneOf": [ + { + "required": [ + "display_name", + "vulnerable", + # "reliability", # TODO: reliability is required if vulnerable = true + # "description", + ] + }, + { + "required": [ + "display_name", + "investigation_needed", + # "reliability", # TODO: reliability is required if investigation_needed = true + # "description", + ] + }, ] }, }, -- cgit v1.1