diff options
Diffstat (limited to 'app/validators/json_schemas')
-rw-r--r-- | app/validators/json_schemas/security_scan_info.json | 28 | ||||
-rw-r--r-- | app/validators/json_schemas/vulnerability_finding_details.json | 266 |
2 files changed, 217 insertions, 77 deletions
diff --git a/app/validators/json_schemas/security_scan_info.json b/app/validators/json_schemas/security_scan_info.json new file mode 100644 index 00000000000..c8932c1870d --- /dev/null +++ b/app/validators/json_schemas/security_scan_info.json @@ -0,0 +1,28 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "title": "Security::Scan#info schema", + "description": "The schema validates the content of the Security::Scan#info attribute", + "additionalProperties": false, + "properties": { + "errors": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "type": { + "type": "string" + }, + "message": { + "type": "string" + } + }, + "required": [ + "type", + "message" + ] + } + } + } +} diff --git a/app/validators/json_schemas/vulnerability_finding_details.json b/app/validators/json_schemas/vulnerability_finding_details.json index f2940866f4b..2ba1fc9e9db 100644 --- a/app/validators/json_schemas/vulnerability_finding_details.json +++ b/app/validators/json_schemas/vulnerability_finding_details.json @@ -6,60 +6,67 @@ "^.*$": { "allOf": [ { "$ref": "#/definitions/named_field" }, - { "$ref": "#/definitions/type_list" } + { "$ref": "#/definitions/detail_type" } ] } }, "definitions": { - "type_list": { + "detail_type": { "oneOf": [ { "$ref": "#/definitions/named_list" }, { "$ref": "#/definitions/list" }, { "$ref": "#/definitions/table" }, - { "$ref": "#/definitions/text" }, { "$ref": "#/definitions/url" }, { "$ref": "#/definitions/code" }, - { "$ref": "#/definitions/int" }, - + { "$ref": "#/definitions/value" }, + { "$ref": "#/definitions/diff" }, + { "$ref": "#/definitions/markdown" }, { "$ref": "#/definitions/commit" }, { "$ref": "#/definitions/file_location" }, { "$ref": "#/definitions/module_location" } ] }, - "lang_text": { - "type": "object", - "required": [ "value", "lang" ], - "properties": { - "lang": { "type": "string" }, - "value": { "type": "string" } - } - }, - "lang_text_list": { - "type": "array", - "items": { "$ref": "#/definitions/lang_text" } + "text_value": { + "type": "string" }, "named_field": { "type": "object", - "required": [ "name" ], + "required": [ + "name" + ], "properties": { - "name": { "$ref": "#/definitions/lang_text_list" }, - "description": { "$ref": "#/definitions/lang_text_list" } + "name": { + "$ref": "#/definitions/text_value", + "minLength": 1 + }, + "description": { + "$ref": "#/definitions/text_value" + } } }, "named_list": { "type": "object", "description": "An object with named and typed fields", - "required": [ "type", "items" ], + "required": [ + "type", + "items" + ], "properties": { - "type": { "const": "named-list" }, + "type": { + "const": "named-list" + }, "items": { "type": "object", "patternProperties": { "^.*$": { "allOf": [ - { "$ref": "#/definitions/named_field" }, - { "$ref": "#/definitions/type_list" } + { + "$ref": "#/definitions/named_field" + }, + { + "$ref": "#/definitions/detail_type" + } ] } } @@ -69,38 +76,45 @@ "list": { "type": "object", "description": "A list of typed fields", - "required": [ "type", "items" ], + "required": [ + "type", + "items" + ], "properties": { - "type": { "const": "list" }, + "type": { + "const": "list" + }, "items": { "type": "array", - "items": { "$ref": "#/definitions/type_list" } + "items": { + "$ref": "#/definitions/detail_type" + } } } }, "table": { "type": "object", "description": "A table of typed fields", - "required": [], + "required": [ + "type", + "rows" + ], "properties": { - "type": { "const": "table" }, - "items": { - "type": "object", - "properties": { - "header": { - "type": "array", - "items": { - "$ref": "#/definitions/type_list" - } - }, - "rows": { - "type": "array", - "items": { - "type": "array", - "items": { - "$ref": "#/definitions/type_list" - } - } + "type": { + "const": "table" + }, + "header": { + "type": "array", + "items": { + "$ref": "#/definitions/detail_type" + } + }, + "rows": { + "type": "array", + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/detail_type" } } } @@ -109,73 +123,171 @@ "text": { "type": "object", "description": "Raw text", - "required": [ "type", "value" ], + "required": [ + "type", + "value" + ], "properties": { - "type": { "const": "text" }, - "value": { "$ref": "#/definitions/lang_text_list" } + "type": { + "const": "text" + }, + "value": { + "$ref": "#/definitions/text_value" + } } }, "url": { "type": "object", "description": "A single URL", - "required": [ "type", "href" ], + "required": [ + "type", + "href" + ], "properties": { - "type": { "const": "url" }, - "text": { "$ref": "#/definitions/lang_text_list" }, - "href": { "type": "string" } + "type": { + "const": "url" + }, + "text": { + "$ref": "#/definitions/text_value" + }, + "href": { + "type": "string", + "minLength": 1, + "examples": ["http://mysite.com"] + } } }, "code": { "type": "object", "description": "A codeblock", - "required": [ "type", "value" ], + "required": [ + "type", + "value" + ], "properties": { - "type": { "const": "code" }, - "value": { "type": "string" }, - "lang": { "type": "string" } + "type": { + "const": "code" + }, + "value": { + "type": "string" + }, + "lang": { + "type": "string", + "description": "A programming language" + } } }, - "int": { + "value": { "type": "object", - "description": "An integer", - "required": [ "type", "value" ], + "description": "A field that can store a range of types of value", + "required": ["type", "value"], "properties": { - "type": { "const": "int" }, - "value": { "type": "integer" }, - "format": { - "type": "string", - "enum": [ "default", "hex" ] + "type": { "const": "value" }, + "value": { + "type": ["number", "string", "boolean"] + } + } + }, + "diff": { + "type": "object", + "description": "A diff", + "required": [ + "type", + "before", + "after" + ], + "properties": { + "type": { + "const": "diff" + }, + "before": { + "type": "string" + }, + "after": { + "type": "string" + } + } + }, + "markdown": { + "type": "object", + "description": "GitLab flavoured markdown, see https://docs.gitlab.com/ee/user/markdown.html", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "const": "markdown" + }, + "value": { + "$ref": "#/definitions/text_value", + "examples": ["Here is markdown `inline code` #1 [test](gitlab.com)\n\n![GitLab Logo](https://about.gitlab.com/images/press/logo/preview/gitlab-logo-white-preview.png)"] } } }, "commit": { "type": "object", - "description": "A specific commit within the project", - "required": [ "type", "value" ], + "description": "A commit/tag/branch within the GitLab project", + "required": [ + "type", + "value" + ], "properties": { - "type": { "const": "commit" }, - "value": { "type": "string", "description": "The commit SHA" } + "type": { + "const": "commit" + }, + "value": { + "type": "string", + "description": "The commit SHA", + "minLength": 1 + } } }, "file_location": { "type": "object", "description": "A location within a file in the project", - "required": [ "type", "file_name", "line_start" ], + "required": [ + "type", + "file_name", + "line_start" + ], "properties": { - "type": { "const": "file-location" }, - "file_name": { "type": "string" }, - "line_start": { "type": "integer" }, - "line_end": { "type": "integer" } + "type": { + "const": "file-location" + }, + "file_name": { + "type": "string", + "minLength": 1 + }, + "line_start": { + "type": "integer" + }, + "line_end": { + "type": "integer" + } } }, "module_location": { "type": "object", "description": "A location within a binary module of the form module+relative_offset", - "required": [ "type", "module_name", "offset" ], + "required": [ + "type", + "module_name", + "offset" + ], "properties": { - "type": { "const": "module-location" }, - "module_name": { "type": "string" }, - "offset": { "type": "integer" } + "type": { + "const": "module-location" + }, + "module_name": { + "type": "string", + "minLength": 1, + "examples": ["compiled_binary"] + }, + "offset": { + "type": "integer", + "examples": [100] + } } } } |