Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
gregkalapos committed May 4, 2021
1 parent 4001fdd commit 71aa0a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/Elastic.Apm/Filters/ErrorContextSanitizerFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ public IError Filter(IError error)
{
if (realError.Context.Request?.Headers != null && realError.ConfigSnapshot != null)
{
foreach (var key in realError.Context?.Request?.Headers?.Keys.ToList())
foreach (var key in realError.Context?.Request?.Headers?.Keys)
{
if (WildcardMatcher.IsAnyMatch(realError.ConfigSnapshot.SanitizeFieldNames, key)
&& realError.Context.Request.Headers[key] != Consts.Redacted)
if (WildcardMatcher.IsAnyMatch(realError.ConfigSnapshot.SanitizeFieldNames, key))
realError.Context.Request.Headers[key] = Consts.Redacted;
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/Elastic.Apm/Filters/HeaderDictionarySanitizerFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ public ITransaction Filter(ITransaction transaction)
{
if (realTransaction.IsContextCreated && realTransaction.Context.Request?.Headers != null)
{
foreach (var key in realTransaction.Context?.Request?.Headers?.Keys.ToList())
foreach (var key in realTransaction.Context?.Request?.Headers?.Keys)
{
if (WildcardMatcher.IsAnyMatch(realTransaction.ConfigSnapshot.SanitizeFieldNames, key)
&& realTransaction.Context.Request.Headers[key] != Consts.Redacted)
if (WildcardMatcher.IsAnyMatch(realTransaction.ConfigSnapshot.SanitizeFieldNames, key))
realTransaction.Context.Request.Headers[key] = Consts.Redacted;
}
}
Expand Down

0 comments on commit 71aa0a3

Please # to comment.