From 7ba61255120472e29daaab8dd36b84eb822213cb Mon Sep 17 00:00:00 2001 From: elsapet Date: Mon, 14 Nov 2022 17:37:14 +0200 Subject: [PATCH] fix: update classification patterns (#120) --- .../db/data_type_classification_patterns/104_emails.json | 2 +- .../1_email_address.json | 4 ++-- .../2_email_address.json | 2 +- .../60_date_of_birth.json | 4 +--- .../data_type_classification_patterns/99_passwords.json | 2 +- scripts/data_type_classification_patterns.json | 8 ++++---- scripts/main.rb | 2 +- 7 files changed, 11 insertions(+), 13 deletions(-) diff --git a/pkg/classification/db/data_type_classification_patterns/104_emails.json b/pkg/classification/db/data_type_classification_patterns/104_emails.json index 78fe50242..b6b9cce99 100644 --- a/pkg/classification/db/data_type_classification_patterns/104_emails.json +++ b/pkg/classification/db/data_type_classification_patterns/104_emails.json @@ -2,7 +2,7 @@ "metadata": { "version": "1.0" }, "id": 104, "data_type_uuid": "e07133d8-b62b-47ed-abcd-9c9d189b362a", - "exclude_regexp": "\\b((notification|config(uration)?|template|enabled|settings?|sent\\s?by|type))\\b", + "exclude_regexp": "\\b(notification|config(uration)?|template|enabled|settings?|sent\\s?by|type|required)\\b", "exclude_types": ["boolean", "date"], "friendly_name": "Emails", "health_context_data_type_uuid": null, diff --git a/pkg/classification/db/data_type_classification_patterns/1_email_address.json b/pkg/classification/db/data_type_classification_patterns/1_email_address.json index db0960279..cb7bf961e 100644 --- a/pkg/classification/db/data_type_classification_patterns/1_email_address.json +++ b/pkg/classification/db/data_type_classification_patterns/1_email_address.json @@ -2,11 +2,11 @@ "metadata": { "version": "1.0" }, "id": 1, "data_type_uuid": "22e24c62-82d3-4b72-827c-e261533331bd", - "exclude_regexp": "\\b(.*(notification|config(uration)?|template|enabled|token|reminder|subject|body|handover|sent.by|settings?|accept|label|id|voice|type).*)\\b", + "exclude_regexp": "\\b(.*(notification|config(uration)?|template|enabled|token|reminder|subject|body|handover|sent.by|settings?|accept|label|id|voice|type).*|required)\\b", "exclude_types": ["boolean", "date", "bool"], "friendly_name": "Email Address", "health_context_data_type_uuid": null, - "include_regexp": "\b.*email.*\b", + "include_regexp": "\\b.*email.*\\b", "include_types": ["object", "string"], "match_column": true, "match_object": false, diff --git a/pkg/classification/db/data_type_classification_patterns/2_email_address.json b/pkg/classification/db/data_type_classification_patterns/2_email_address.json index ca7cdd309..f4cec4466 100644 --- a/pkg/classification/db/data_type_classification_patterns/2_email_address.json +++ b/pkg/classification/db/data_type_classification_patterns/2_email_address.json @@ -2,7 +2,7 @@ "metadata": { "version": "1.0" }, "id": 2, "data_type_uuid": "22e24c62-82d3-4b72-827c-e261533331bd", - "exclude_regexp": "\\b(.*notification|config(uration)?|template|enabled|accept|label|token|reminder|subject|body|handover|sent.by|settings?|id|voicemail.*)\\b", + "exclude_regexp": "\\b(.*notification|config(uration)?|template|enabled|accept|label|token|reminder|subject|body|handover|sent.by|settings?|id|voicemail.*|required)\\b", "exclude_types": ["boolean", "date", "bool"], "friendly_name": "Email Address", "health_context_data_type_uuid": null, diff --git a/pkg/classification/db/data_type_classification_patterns/60_date_of_birth.json b/pkg/classification/db/data_type_classification_patterns/60_date_of_birth.json index 8a7b4c558..2dd6323cd 100644 --- a/pkg/classification/db/data_type_classification_patterns/60_date_of_birth.json +++ b/pkg/classification/db/data_type_classification_patterns/60_date_of_birth.json @@ -1,7 +1,5 @@ { - "metadata": { - "version": "1.0" - }, + "metadata": { "version": "1.0" }, "id": 60, "data_type_uuid": "da48dfad-7322-411b-988d-5bde0d7bc659", "exclude_regexp": null, diff --git a/pkg/classification/db/data_type_classification_patterns/99_passwords.json b/pkg/classification/db/data_type_classification_patterns/99_passwords.json index dfe56f5ef..2e552aec6 100644 --- a/pkg/classification/db/data_type_classification_patterns/99_passwords.json +++ b/pkg/classification/db/data_type_classification_patterns/99_passwords.json @@ -2,7 +2,7 @@ "metadata": { "version": "1.0" }, "id": 99, "data_type_uuid": "02bb0d3a-2c8c-4842-be1c-c057f0dccd63", - "exclude_regexp": "\\b(token)|(.*config.*)\\b", + "exclude_regexp": "\\b(token)|(.*config.*)|(request)|(reset)|(required)|((mis)?match)|(forgot)|(success)|(retrieval)|(minimum)|(length)|(changed)\\b", "exclude_types": ["boolean", "date", "number"], "friendly_name": "Passwords", "health_context_data_type_uuid": null, diff --git a/scripts/data_type_classification_patterns.json b/scripts/data_type_classification_patterns.json index 5d3a9186d..2c6e989eb 100644 --- a/scripts/data_type_classification_patterns.json +++ b/scripts/data_type_classification_patterns.json @@ -2,7 +2,7 @@ { "id": 1, "data_type_uuid": "22e24c62-82d3-4b72-827c-e261533331bd", - "exclude_regexp": "\\b(.*(notification|config(uration)?|template|enabled|token|reminder|subject|body|handover|sent.by|settings?|accept|label|id|voice|type).*)\\b", + "exclude_regexp": "\\b(.*(notification|config(uration)?|template|enabled|token|reminder|subject|body|handover|sent.by|settings?|accept|label|id|voice|type).*|required)\\b", "exclude_types": ["boolean", "date", "bool"], "friendly_name": "Email Address", "health_context_data_type_uuid": null, @@ -15,7 +15,7 @@ { "id": 2, "data_type_uuid": "22e24c62-82d3-4b72-827c-e261533331bd", - "exclude_regexp": "\\b(.*notification|config(uration)?|template|enabled|accept|label|token|reminder|subject|body|handover|sent.by|settings?|id|voicemail.*)\\b", + "exclude_regexp": "\\b(.*notification|config(uration)?|template|enabled|accept|label|token|reminder|subject|body|handover|sent.by|settings?|id|voicemail.*|required)\\b", "exclude_types": ["boolean", "date", "bool"], "friendly_name": "Email Address", "health_context_data_type_uuid": null, @@ -1250,7 +1250,7 @@ { "id": 99, "data_type_uuid": "02bb0d3a-2c8c-4842-be1c-c057f0dccd63", - "exclude_regexp": "\\b(token)|(.*config.*)\\b", + "exclude_regexp": "\\b(token)|(.*config.*)|(request)|(reset)|(required)|((mis)?match)|(forgot)|(success)|(retrieval)|(minimum)|(length)|(changed)\\b", "exclude_types": ["boolean", "date", "number"], "friendly_name": "Passwords", "health_context_data_type_uuid": null, @@ -1315,7 +1315,7 @@ { "id": 104, "data_type_uuid": "e07133d8-b62b-47ed-abcd-9c9d189b362a", - "exclude_regexp": "\\b((notification|config(uration)?|template|enabled|settings?|sent\\s?by|type))\\b", + "exclude_regexp": "\\b(notification|config(uration)?|template|enabled|settings?|sent\\s?by|type|required)\\b", "exclude_types": ["boolean", "date"], "friendly_name": "Emails", "health_context_data_type_uuid": null, diff --git a/scripts/main.rb b/scripts/main.rb index 59fbf281f..94b19ff87 100644 --- a/scripts/main.rb +++ b/scripts/main.rb @@ -31,7 +31,7 @@ # remove spaces in object type pattern["object_type"] = pattern["object_type"].map { |object_type| object_type.downcase.gsub(" ", "_") } - filename = "pkg/classification/db/data_type_classification_patterns/#{pattern["friendly_name"].downcase.gsub(/\s+/, "_").gsub("/", "_")}.json" + filename = "pkg/classification/db/data_type_classification_patterns/#{pattern["id"]}_#{pattern["friendly_name"].downcase.gsub(/\s+/, "_").gsub("/", "_")}.json" File.open(filename, "w") do |new_file| new_file << {metadata: {version: "1.0"}}.merge(pattern).to_json end