From 8b1c9f615fdf723e136981bf59e5c0111503183b Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Tue, 30 May 2023 10:21:13 -0700 Subject: [PATCH] [processor/attributes] enable SHA-256 feature gate by default (#22831) Enable SHA-256 as hashing algorithm by default for attributesprocessor hashing action --- .chloggen/enable-featuregate-sha256.yaml | 20 +++++++++++++++++++ .../coreinternal/attraction/attraction.go | 2 +- .../attributes_log_test.go | 8 ++++---- .../attributes_metric_test.go | 8 ++++---- .../attributes_trace_test.go | 8 ++++---- 5 files changed, 33 insertions(+), 13 deletions(-) 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..b17967c420318 --- /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: breaking + +# 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"), ) 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", }, }, }