From 9677ec666b885f2f111ef3057d01afe8e95f4dd1 Mon Sep 17 00:00:00 2001 From: Daniel D'Avella Date: Fri, 8 Mar 2024 10:27:41 -0500 Subject: [PATCH 1/2] Add findings section to detectorTool --- codetf.schema.json | 61 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 54 insertions(+), 7 deletions(-) diff --git a/codetf.schema.json b/codetf.schema.json index da6f8aa..a363f88 100644 --- a/codetf.schema.json +++ b/codetf.schema.json @@ -210,17 +210,64 @@ "type": "string", "description": "Name of the tool that detected the issue" }, - "ruleId": { - "type": "string", - "description": "ID of the tool vendor rule that detected the issue" + "rule": { + "$ref": "#/definitions/detector/rule", + "description": "The rule that detected the issue" }, - "ruleDescription": { - "type": "string", - "description": "Short description of the tool vendor rule that detected the issue" + "findings": { + "type": "array", + "items": { "$ref": "#/definitions/detector/finding" } } }, "additionalProperties": true, - "required": ["name", "ruleId"] + "required": ["name", "rule", "findings"] + }, + + "detector": { + "finding": { + "type": "object", + "properties": { + "guid": { + "type": "string", + "description": "A unique identifier for the finding" + }, + "fixed": { + "type": "boolean", + "description": "Whether the finding was fixed by the codemod" + }, + "reason": { + "type": "string", + "description": "Reason the finding was not fixed" + } + }, + "additionalProperties": true, + "required": ["guid", "fixed"], + "if": { + "properties": { + "fixed": { "boolean": false } + }, + "required": ["reason"] + } + }, + "rule": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The ID of the rule" + }, + "name": { + "type": "string", + "description": "The name of the rule" + }, + "description": { + "type": "string", + "description": "A description of the rule" + } + }, + "additionalProperties": false, + "required": ["id", "name"] + } } }, From 2a1715a25a0a2a8063c303d75423d35cef163b5b Mon Sep 17 00:00:00 2001 From: Daniel D'Avella Date: Fri, 8 Mar 2024 10:56:26 -0500 Subject: [PATCH 2/2] Address code review feedback --- codetf.schema.json | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/codetf.schema.json b/codetf.schema.json index a363f88..24e48a0 100644 --- a/codetf.schema.json +++ b/codetf.schema.json @@ -216,7 +216,8 @@ }, "findings": { "type": "array", - "items": { "$ref": "#/definitions/detector/finding" } + "items": { "$ref": "#/definitions/detector/finding" }, + "maxItems": 20 } }, "additionalProperties": true, @@ -227,9 +228,9 @@ "finding": { "type": "object", "properties": { - "guid": { + "id": { "type": "string", - "description": "A unique identifier for the finding" + "description": "A unique identifier for the finding (e.g. 'guid' from SARIF)" }, "fixed": { "type": "boolean", @@ -241,7 +242,7 @@ } }, "additionalProperties": true, - "required": ["guid", "fixed"], + "required": ["id", "fixed"], "if": { "properties": { "fixed": { "boolean": false } @@ -258,11 +259,11 @@ }, "name": { "type": "string", - "description": "The name of the rule" + "description": "The name of the rule. Potentially the same as the ID, but more human-readable" }, - "description": { + "url": { "type": "string", - "description": "A description of the rule" + "description": "Link to the rule documentation" } }, "additionalProperties": false,