From 8b41f4a7aedb4cbcc5b3fdc95ed572bb7f21278a Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Fri, 26 May 2023 13:44:03 -0700 Subject: [PATCH 1/3] [processor/attributes] enable SHA-256 as default hashing algorithm for attributesprocessor hashing action --- .chloggen/enable-featuregate-sha256.yaml | 20 +++++++++++++++++++ .../coreinternal/attraction/attraction.go | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 .chloggen/enable-featuregate-sha256.yaml diff --git a/.chloggen/enable-featuregate-sha256.yaml b/.chloggen/enable-featuregate-sha256.yaml new file mode 100644 index 0000000000000..d250f06272071 --- /dev/null +++ b/.chloggen/enable-featuregate-sha256.yaml @@ -0,0 +1,20 @@ +# Use this changelog template to create an entry for release notes. +# If your change doesn't affect end users, such as a test fix or a tooling change, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: attributesprocessor + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Enable SHA-256 as hashing algorithm by default for attributesprocessor hashing action + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [4759] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/internal/coreinternal/attraction/attraction.go b/internal/coreinternal/attraction/attraction.go index bac500ebf1a7e..c141f3402c684 100644 --- a/internal/coreinternal/attraction/attraction.go +++ b/internal/coreinternal/attraction/attraction.go @@ -17,7 +17,7 @@ import ( var enableSha256Gate = featuregate.GlobalRegistry().MustRegister( "coreinternal.attraction.hash.sha256", - featuregate.StageAlpha, + featuregate.StageBeta, featuregate.WithRegisterDescription("When enabled, switches hashing algorithm from SHA-1 to SHA-2 256"), ) From 1049f38f7fcfd3ff813a5e34d0ea512e2d9eb411 Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Fri, 26 May 2023 13:48:58 -0700 Subject: [PATCH 2/3] update tests in attributesprocessor --- processor/attributesprocessor/attributes_log_test.go | 8 ++++---- processor/attributesprocessor/attributes_metric_test.go | 8 ++++---- processor/attributesprocessor/attributes_trace_test.go | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/processor/attributesprocessor/attributes_log_test.go b/processor/attributesprocessor/attributes_log_test.go index 5c7dc697c34a0..5eadd37e7c7f3 100644 --- a/processor/attributesprocessor/attributes_log_test.go +++ b/processor/attributesprocessor/attributes_log_test.go @@ -288,7 +288,7 @@ func TestLogAttributes_Hash(t *testing.T) { "user.email": "john.doe@example.com", }, expectedAttributes: map[string]interface{}{ - "user.email": "73ec53c4ba1747d485ae2a0d7bfafa6cda80a5a9", + "user.email": "836f82db99121b3481011f16b49dfa5fbc714a0d1b1b9f784a1ebbbf5b39577f", }, }, { @@ -297,7 +297,7 @@ func TestLogAttributes_Hash(t *testing.T) { "user.id": 10, }, expectedAttributes: map[string]interface{}{ - "user.id": "71aa908aff1548c8c6cdecf63545261584738a25", + "user.id": "a111f275cc2e7588000001d300a31e76336d15b9d314cd1a1d8f3d3556975eed", }, }, { @@ -306,7 +306,7 @@ func TestLogAttributes_Hash(t *testing.T) { "user.balance": 99.1, }, expectedAttributes: map[string]interface{}{ - "user.balance": "76429edab4855b03073f9429fd5d10313c28655e", + "user.balance": "05fabd78b01be9692863cb0985f600c99da82979af18db5c55173c2a30adb924", }, }, { @@ -315,7 +315,7 @@ func TestLogAttributes_Hash(t *testing.T) { "user.authenticated": true, }, expectedAttributes: map[string]interface{}{ - "user.authenticated": "bf8b4530d8d246dd74ac53a13471bba17941dff7", + "user.authenticated": "4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a", }, }, } diff --git a/processor/attributesprocessor/attributes_metric_test.go b/processor/attributesprocessor/attributes_metric_test.go index 65dbb86c1eeb7..f91b388c63ad2 100644 --- a/processor/attributesprocessor/attributes_metric_test.go +++ b/processor/attributesprocessor/attributes_metric_test.go @@ -297,7 +297,7 @@ func TestMetricAttributes_Hash(t *testing.T) { "user.email": "john.doe@example.com", }, expectedAttributes: map[string]interface{}{ - "user.email": "73ec53c4ba1747d485ae2a0d7bfafa6cda80a5a9", + "user.email": "836f82db99121b3481011f16b49dfa5fbc714a0d1b1b9f784a1ebbbf5b39577f", }, }, { @@ -306,7 +306,7 @@ func TestMetricAttributes_Hash(t *testing.T) { "user.id": 10, }, expectedAttributes: map[string]interface{}{ - "user.id": "71aa908aff1548c8c6cdecf63545261584738a25", + "user.id": "a111f275cc2e7588000001d300a31e76336d15b9d314cd1a1d8f3d3556975eed", }, }, { @@ -315,7 +315,7 @@ func TestMetricAttributes_Hash(t *testing.T) { "user.balance": 99.1, }, expectedAttributes: map[string]interface{}{ - "user.balance": "76429edab4855b03073f9429fd5d10313c28655e", + "user.balance": "05fabd78b01be9692863cb0985f600c99da82979af18db5c55173c2a30adb924", }, }, { @@ -324,7 +324,7 @@ func TestMetricAttributes_Hash(t *testing.T) { "user.authenticated": true, }, expectedAttributes: map[string]interface{}{ - "user.authenticated": "bf8b4530d8d246dd74ac53a13471bba17941dff7", + "user.authenticated": "4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a", }, }, } diff --git a/processor/attributesprocessor/attributes_trace_test.go b/processor/attributesprocessor/attributes_trace_test.go index 66ebdae12dde7..956335977b0b9 100644 --- a/processor/attributesprocessor/attributes_trace_test.go +++ b/processor/attributesprocessor/attributes_trace_test.go @@ -310,7 +310,7 @@ func TestAttributes_Hash(t *testing.T) { "user.email": "john.doe@example.com", }, expectedAttributes: map[string]interface{}{ - "user.email": "73ec53c4ba1747d485ae2a0d7bfafa6cda80a5a9", + "user.email": "836f82db99121b3481011f16b49dfa5fbc714a0d1b1b9f784a1ebbbf5b39577f", }, }, { @@ -319,7 +319,7 @@ func TestAttributes_Hash(t *testing.T) { "user.id": 10, }, expectedAttributes: map[string]interface{}{ - "user.id": "71aa908aff1548c8c6cdecf63545261584738a25", + "user.id": "a111f275cc2e7588000001d300a31e76336d15b9d314cd1a1d8f3d3556975eed", }, }, { @@ -328,7 +328,7 @@ func TestAttributes_Hash(t *testing.T) { "user.balance": 99.1, }, expectedAttributes: map[string]interface{}{ - "user.balance": "76429edab4855b03073f9429fd5d10313c28655e", + "user.balance": "05fabd78b01be9692863cb0985f600c99da82979af18db5c55173c2a30adb924", }, }, { @@ -337,7 +337,7 @@ func TestAttributes_Hash(t *testing.T) { "user.authenticated": true, }, expectedAttributes: map[string]interface{}{ - "user.authenticated": "bf8b4530d8d246dd74ac53a13471bba17941dff7", + "user.authenticated": "4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a", }, }, } From 89b697f45d11dc0e7ec7b27021688f344c4eef4c Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Fri, 26 May 2023 13:50:06 -0700 Subject: [PATCH 3/3] change to breaking change --- .chloggen/enable-featuregate-sha256.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chloggen/enable-featuregate-sha256.yaml b/.chloggen/enable-featuregate-sha256.yaml index d250f06272071..b17967c420318 100644 --- a/.chloggen/enable-featuregate-sha256.yaml +++ b/.chloggen/enable-featuregate-sha256.yaml @@ -3,7 +3,7 @@ # you should instead start your pull request title with [chore] or use the "Skip Changelog" label. # One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: enhancement +change_type: breaking # The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) component: attributesprocessor