Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

obfuscate ip addresses in alert error message #511

Merged
merged 3 commits into from
Sep 8, 2023

Conversation

eirsep
Copy link
Member

@eirsep eirsep commented Aug 17, 2023

Description

Currently alertError class' message field is storing exception messages along with IP addresses if message contains any IPs

This change obfuscates the ip address in exception messages stored in disk and shown to user

lezzago
lezzago previously approved these changes Aug 17, 2023
@codecov
Copy link

codecov bot commented Aug 17, 2023

Codecov Report

Merging #511 (eab148d) into main (d797db5) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##               main     #511      +/-   ##
============================================
+ Coverage     74.63%   74.66%   +0.02%     
  Complexity      872      872              
============================================
  Files           130      130              
  Lines          5662     5667       +5     
  Branches        697      697              
============================================
+ Hits           4226     4231       +5     
  Misses         1130     1130              
  Partials        306      306              
Files Changed Coverage Δ
...g/opensearch/commons/alerting/alerts/AlertError.kt 44.44% <100.00%> (+12.62%) ⬆️


fun obfuscateIPAddresses(exceptionMessage: String): String {
val ipAddressPattern = "\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"
val obfuscatedMessage = exceptionMessage.replace(ipAddressPattern.toRegex(), "X.X.X.X")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use x.x.x.x lowercase

bowenlan-amzn
bowenlan-amzn previously approved these changes Aug 18, 2023
lezzago
lezzago previously approved these changes Sep 8, 2023
Signed-off-by: Surya Sashank Nistala <[email protected]>
Signed-off-by: Surya Sashank Nistala <[email protected]>
@lezzago lezzago merged commit b8e6e75 into opensearch-project:main Sep 8, 2023
8 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 8, 2023
* obfuscate ip addresses in alert error message

Signed-off-by: Surya Sashank Nistala <[email protected]>

* make ip obfuscation lower case

Signed-off-by: Surya Sashank Nistala <[email protected]>

* update test with lowercase ip obfuscation

Signed-off-by: Surya Sashank Nistala <[email protected]>

---------

Signed-off-by: Surya Sashank Nistala <[email protected]>
(cherry picked from commit b8e6e75)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 8, 2023
* obfuscate ip addresses in alert error message

Signed-off-by: Surya Sashank Nistala <[email protected]>

* make ip obfuscation lower case

Signed-off-by: Surya Sashank Nistala <[email protected]>

* update test with lowercase ip obfuscation

Signed-off-by: Surya Sashank Nistala <[email protected]>

---------

Signed-off-by: Surya Sashank Nistala <[email protected]>
(cherry picked from commit b8e6e75)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 8, 2023
* obfuscate ip addresses in alert error message

Signed-off-by: Surya Sashank Nistala <[email protected]>

* make ip obfuscation lower case

Signed-off-by: Surya Sashank Nistala <[email protected]>

* update test with lowercase ip obfuscation

Signed-off-by: Surya Sashank Nistala <[email protected]>

---------

Signed-off-by: Surya Sashank Nistala <[email protected]>
(cherry picked from commit b8e6e75)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 8, 2023
* obfuscate ip addresses in alert error message

Signed-off-by: Surya Sashank Nistala <[email protected]>

* make ip obfuscation lower case

Signed-off-by: Surya Sashank Nistala <[email protected]>

* update test with lowercase ip obfuscation

Signed-off-by: Surya Sashank Nistala <[email protected]>

---------

Signed-off-by: Surya Sashank Nistala <[email protected]>
(cherry picked from commit b8e6e75)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 8, 2023
* obfuscate ip addresses in alert error message

Signed-off-by: Surya Sashank Nistala <[email protected]>

* make ip obfuscation lower case

Signed-off-by: Surya Sashank Nistala <[email protected]>

* update test with lowercase ip obfuscation

Signed-off-by: Surya Sashank Nistala <[email protected]>

---------

Signed-off-by: Surya Sashank Nistala <[email protected]>
(cherry picked from commit b8e6e75)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 8, 2023
* obfuscate ip addresses in alert error message

Signed-off-by: Surya Sashank Nistala <[email protected]>

* make ip obfuscation lower case

Signed-off-by: Surya Sashank Nistala <[email protected]>

* update test with lowercase ip obfuscation

Signed-off-by: Surya Sashank Nistala <[email protected]>

---------

Signed-off-by: Surya Sashank Nistala <[email protected]>
(cherry picked from commit b8e6e75)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 8, 2023
* obfuscate ip addresses in alert error message

Signed-off-by: Surya Sashank Nistala <[email protected]>

* make ip obfuscation lower case

Signed-off-by: Surya Sashank Nistala <[email protected]>

* update test with lowercase ip obfuscation

Signed-off-by: Surya Sashank Nistala <[email protected]>

---------

Signed-off-by: Surya Sashank Nistala <[email protected]>
(cherry picked from commit b8e6e75)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 8, 2023
* obfuscate ip addresses in alert error message

Signed-off-by: Surya Sashank Nistala <[email protected]>

* make ip obfuscation lower case

Signed-off-by: Surya Sashank Nistala <[email protected]>

* update test with lowercase ip obfuscation

Signed-off-by: Surya Sashank Nistala <[email protected]>

---------

Signed-off-by: Surya Sashank Nistala <[email protected]>
(cherry picked from commit b8e6e75)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
engechas pushed a commit that referenced this pull request Apr 11, 2024
* 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 <[email protected]>
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>
engechas pushed a commit that referenced this pull request Apr 11, 2024
* 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 <[email protected]>
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>
engechas pushed a commit that referenced this pull request Apr 11, 2024
* 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 <[email protected]>
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>
engechas pushed a commit that referenced this pull request Apr 11, 2024
* 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 <[email protected]>
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>
engechas pushed a commit that referenced this pull request Apr 11, 2024
* 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 <[email protected]>
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>
engechas pushed a commit that referenced this pull request Apr 11, 2024
* 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 <[email protected]>
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>
engechas pushed a commit that referenced this pull request Apr 11, 2024
* 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 <[email protected]>
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>
engechas pushed a commit that referenced this pull request Apr 11, 2024
* 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 <[email protected]>
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>
AWSHurneyt pushed a commit to AWSHurneyt/common-utils that referenced this pull request Apr 12, 2024
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 <[email protected]>
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>
Signed-off-by: AWSHurneyt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants