-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
close #9690
- Loading branch information
1 parent
4547916
commit b49ddbe
Showing
13 changed files
with
156 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,3 +88,37 @@ func TestMaskSinkURI(t *testing.T) { | |
require.Equal(t, tt.masked, maskedURI) | ||
} | ||
} | ||
|
||
func TestMaskSensitiveDataInURI(t *testing.T) { | ||
tests := []struct { | ||
uri string | ||
masked string | ||
}{ | ||
{ | ||
"mysql://root:[email protected]:3306/?time-zone=c", | ||
"mysql://root:[email protected]:3306/?time-zone=c", | ||
}, | ||
{ | ||
"", | ||
"", | ||
}, | ||
{ | ||
"abc", | ||
"abc", | ||
}, | ||
} | ||
for _, q := range sensitiveQueryParameterNames { | ||
tests = append(tests, struct { | ||
uri string | ||
masked string | ||
}{ | ||
"kafka://127.0.0.1:9093/cdc?" + q + "=verysecure", | ||
"kafka://127.0.0.1:9093/cdc?" + q + "=xxxxx", | ||
}) | ||
} | ||
|
||
for _, tt := range tests { | ||
maskedURI := MaskSensitiveDataInURI(tt.uri) | ||
require.Equal(t, tt.masked, maskedURI) | ||
} | ||
} |