Skip to content

Commit

Permalink
[processor/attributes] enable SHA-256 feature gate by default (#22831)
Browse files Browse the repository at this point in the history
Enable SHA-256 as hashing algorithm by default for attributesprocessor hashing action
  • Loading branch information
atoulme committed May 30, 2023
1 parent f871ac8 commit 8b1c9f6
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 13 deletions.
20 changes: 20 additions & 0 deletions .chloggen/enable-featuregate-sha256.yaml
Original file line number Diff line number Diff line change
@@ -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:
2 changes: 1 addition & 1 deletion internal/coreinternal/attraction/attraction.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
)

Expand Down
8 changes: 4 additions & 4 deletions processor/attributesprocessor/attributes_log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
{
Expand All @@ -297,7 +297,7 @@ func TestLogAttributes_Hash(t *testing.T) {
"user.id": 10,
},
expectedAttributes: map[string]interface{}{
"user.id": "71aa908aff1548c8c6cdecf63545261584738a25",
"user.id": "a111f275cc2e7588000001d300a31e76336d15b9d314cd1a1d8f3d3556975eed",
},
},
{
Expand All @@ -306,7 +306,7 @@ func TestLogAttributes_Hash(t *testing.T) {
"user.balance": 99.1,
},
expectedAttributes: map[string]interface{}{
"user.balance": "76429edab4855b03073f9429fd5d10313c28655e",
"user.balance": "05fabd78b01be9692863cb0985f600c99da82979af18db5c55173c2a30adb924",
},
},
{
Expand All @@ -315,7 +315,7 @@ func TestLogAttributes_Hash(t *testing.T) {
"user.authenticated": true,
},
expectedAttributes: map[string]interface{}{
"user.authenticated": "bf8b4530d8d246dd74ac53a13471bba17941dff7",
"user.authenticated": "4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a",
},
},
}
Expand Down
8 changes: 4 additions & 4 deletions processor/attributesprocessor/attributes_metric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
{
Expand All @@ -306,7 +306,7 @@ func TestMetricAttributes_Hash(t *testing.T) {
"user.id": 10,
},
expectedAttributes: map[string]interface{}{
"user.id": "71aa908aff1548c8c6cdecf63545261584738a25",
"user.id": "a111f275cc2e7588000001d300a31e76336d15b9d314cd1a1d8f3d3556975eed",
},
},
{
Expand All @@ -315,7 +315,7 @@ func TestMetricAttributes_Hash(t *testing.T) {
"user.balance": 99.1,
},
expectedAttributes: map[string]interface{}{
"user.balance": "76429edab4855b03073f9429fd5d10313c28655e",
"user.balance": "05fabd78b01be9692863cb0985f600c99da82979af18db5c55173c2a30adb924",
},
},
{
Expand All @@ -324,7 +324,7 @@ func TestMetricAttributes_Hash(t *testing.T) {
"user.authenticated": true,
},
expectedAttributes: map[string]interface{}{
"user.authenticated": "bf8b4530d8d246dd74ac53a13471bba17941dff7",
"user.authenticated": "4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a",
},
},
}
Expand Down
8 changes: 4 additions & 4 deletions processor/attributesprocessor/attributes_trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
{
Expand All @@ -319,7 +319,7 @@ func TestAttributes_Hash(t *testing.T) {
"user.id": 10,
},
expectedAttributes: map[string]interface{}{
"user.id": "71aa908aff1548c8c6cdecf63545261584738a25",
"user.id": "a111f275cc2e7588000001d300a31e76336d15b9d314cd1a1d8f3d3556975eed",
},
},
{
Expand All @@ -328,7 +328,7 @@ func TestAttributes_Hash(t *testing.T) {
"user.balance": 99.1,
},
expectedAttributes: map[string]interface{}{
"user.balance": "76429edab4855b03073f9429fd5d10313c28655e",
"user.balance": "05fabd78b01be9692863cb0985f600c99da82979af18db5c55173c2a30adb924",
},
},
{
Expand All @@ -337,7 +337,7 @@ func TestAttributes_Hash(t *testing.T) {
"user.authenticated": true,
},
expectedAttributes: map[string]interface{}{
"user.authenticated": "bf8b4530d8d246dd74ac53a13471bba17941dff7",
"user.authenticated": "4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a",
},
},
}
Expand Down

0 comments on commit 8b1c9f6

Please sign in to comment.