From 299d4e4e6ebb43abf6a735ebeb661bd0aa0f80e5 Mon Sep 17 00:00:00 2001 From: cxMiguelSilva Date: Mon, 6 Feb 2023 11:15:39 +0000 Subject: [PATCH] fix missing results a lineDetection --- .../website_with_http20enabled_disabled/query.rego | 12 ++++++------ .../test/positive_expected_result.json | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/assets/queries/azureResourceManager/website_with_http20enabled_disabled/query.rego b/assets/queries/azureResourceManager/website_with_http20enabled_disabled/query.rego index c5a78c8f7da..1d4db0cd6f7 100644 --- a/assets/queries/azureResourceManager/website_with_http20enabled_disabled/query.rego +++ b/assets/queries/azureResourceManager/website_with_http20enabled_disabled/query.rego @@ -35,9 +35,9 @@ CxPolicy[result] { "resourceName": value.name, "searchKey": sprintf("%s.name={{%s}}.properties.siteConfig", [common_lib.concat_path(path), value.name]), "issueType": "MissingAttribute", - "keyExpectedValue": "resource with type 'Microsoft.Web/sites' should have the 'http20Enabled' property defined", - "keyActualValue": "resource with type 'Microsoft.Web/sites' doesn't have 'http20Enabled' property defined", - "searchLine": common_lib.build_search_line(path, ["properties", "siteConfig"]), + "keyExpectedValue": "resource with type 'Microsoft.Web/sites' should have the 'http20Enabled' property defined in siteConfig", + "keyActualValue": "resource with type 'Microsoft.Web/sites' doesn't have 'http20Enabled' property defined in siteConfig", + "searchLine": common_lib.build_search_line(path, ["properties"]), } } @@ -56,8 +56,8 @@ CxPolicy[result] { "searchKey": sprintf("%s.name={{%s}}.properties.siteConfig.http20Enabled", [common_lib.concat_path(path), value.name]), "searchKey": "resources.type={{Microsoft.Web/sites}}.properties.siteConfig.http20Enabled", "issueType": "IncorrectValue", - "keyExpectedValue": sprintf("resource with type 'Microsoft.Web/sites' should have the 'http20Enabled' %s set to true", [val_type]), - "keyActualValue": "resource with type 'Microsoft.Web/sites' doesn't have 'http20Enabled' set to true", - "searchLine": common_lib.build_search_line(path, ["properties", "siteConfig", "http20Enabled"]), + "keyExpectedValue": sprintf("resource with type 'Microsoft.Web/sites' should have the 'http20Enabled' %s set to true in siteConfig", [val_type]), + "keyActualValue": "resource with type 'Microsoft.Web/sites' doesn't have 'http20Enabled' set to true in siteConfig", + "searchLine": common_lib.build_search_line(path, ["properties"]), } } diff --git a/assets/queries/azureResourceManager/website_with_http20enabled_disabled/test/positive_expected_result.json b/assets/queries/azureResourceManager/website_with_http20enabled_disabled/test/positive_expected_result.json index d67f93e3409..7e237461eb5 100644 --- a/assets/queries/azureResourceManager/website_with_http20enabled_disabled/test/positive_expected_result.json +++ b/assets/queries/azureResourceManager/website_with_http20enabled_disabled/test/positive_expected_result.json @@ -8,13 +8,13 @@ { "queryName": "Website with 'Http20Enabled' Disabled", "severity": "LOW", - "line": 19, + "line": 15, "fileName": "positive2.json" }, { "queryName": "Website with 'Http20Enabled' Disabled", "severity": "LOW", - "line": 18, + "line": 15, "fileName": "positive3.json" }, { @@ -26,13 +26,13 @@ { "queryName": "Website with 'Http20Enabled' Disabled", "severity": "LOW", - "line": 21, + "line": 17, "fileName": "positive5.json" }, { "queryName": "Website with 'Http20Enabled' Disabled", "severity": "LOW", - "line": 20, + "line": 17, "fileName": "positive6.json" } ]