-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #207 from TomasHofman/logging-message-sanitization
Sanitize log message - remove Authorization HTTP header values
- Loading branch information
Showing
3 changed files
with
44 additions
and
1 deletion.
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
21 changes: 21 additions & 0 deletions
21
src/test/java/org/jgroups/protocols/kubernetes/UtilsTest.java
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,21 @@ | ||
package org.jgroups.protocols.kubernetes; | ||
|
||
import org.assertj.core.api.Assertions; | ||
import org.junit.Test; | ||
|
||
import java.util.Map; | ||
|
||
public class UtilsTest { | ||
|
||
@Test | ||
public void testSanitizeHttpHeaders() { | ||
Map<String, String> sanitized = Utils.sanitizeHttpHeaders(Map.of( | ||
"Host", "jgroups.org", | ||
"Authorization", "Basic abcd", | ||
"authorization", "Bearer abcd" | ||
)); | ||
Assertions.assertThat(sanitized.get("Host")).isEqualTo("jgroups.org"); | ||
Assertions.assertThat(sanitized.get("Authorization")).isEqualTo("***"); | ||
Assertions.assertThat(sanitized.get("authorization")).isEqualTo("***"); | ||
} | ||
} |