forked from opensearch-project/common-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
obfuscate ip addresses in alert error message (opensearch-project#511) (
opensearch-project#523) * obfuscate ip addresses in alert error message * make ip obfuscation lower case * update test with lowercase ip obfuscation --------- (cherry picked from commit b8e6e75) Signed-off-by: Surya Sashank Nistala <snistala@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
67ed815
commit b2a7ca6
Showing
2 changed files
with
35 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
25 changes: 25 additions & 0 deletions
25
src/test/kotlin/org/opensearch/commons/alerting/alerts/AlertErrorTests.kt
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,25 @@ | ||
package org.opensearch.commons.alerting.alerts | ||
|
||
import org.junit.Assert | ||
import org.junit.jupiter.api.Test | ||
import java.time.Instant | ||
|
||
class AlertErrorTests { | ||
|
||
@Test | ||
fun `test alertError obfuscates IP addresses in message`() { | ||
val message = | ||
"AlertingException[[5f32db4e2a4fa94f6778cb895dae7a24][10.212.77.91:9300][indices:admin/create]]; " + | ||
"nested: Exception[org.opensearch.transport.RemoteTransportException: [5f32db4e2a4fa94f6778cb895dae7a24][10.212.77.91:9300]" + | ||
"[indices:admin/create]];; java.lang.Exception: org.opensearch.transport.RemoteTransportException: [5f32db4e2a4fa94f6778cb895" + | ||
"dae7a24][10.212.77.91:9300][indices:admin/create]" | ||
val alertError = AlertError(Instant.now(), message = message) | ||
Assert.assertEquals( | ||
alertError.message, | ||
"AlertingException[[5f32db4e2a4fa94f6778cb895dae7a24][x.x.x.x:9300][indices:admin/create]]; " + | ||
"nested: Exception[org.opensearch.transport.RemoteTransportException: [5f32db4e2a4fa94f6778cb895dae7a24][x.x.x.x:9300]" + | ||
"[indices:admin/create]];; java.lang.Exception: org.opensearch.transport.RemoteTransportException: " + | ||
"[5f32db4e2a4fa94f6778cb895dae7a24][x.x.x.x:9300][indices:admin/create]" | ||
) | ||
} | ||
} |