-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Instrumentation.ElasticsearchClient] Fix sensitive data in url.full …
…(former db.url) tag (#1684)
- Loading branch information
Showing
7 changed files
with
73 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
using System; | ||
|
||
namespace OpenTelemetry.Trace; | ||
|
||
internal static class UriHelper | ||
{ | ||
private const string RedactedText = "REDACTED"; | ||
|
||
public static Uri ScrubUserInfo(Uri uri) | ||
{ | ||
var uriBuilder = new UriBuilder(uri); | ||
if (!string.IsNullOrEmpty(uriBuilder.UserName)) | ||
{ | ||
uriBuilder.UserName = RedactedText; | ||
} | ||
|
||
if (!string.IsNullOrEmpty(uriBuilder.Password)) | ||
{ | ||
uriBuilder.Password = RedactedText; | ||
} | ||
|
||
return uriBuilder.Uri; | ||
} | ||
} |
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