-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: scrub sensitive data from Sentry requests
- Loading branch information
1 parent
6f5fe53
commit 71e8217
Showing
6 changed files
with
149 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { | ||
beforeSend, | ||
beforeSendTransaction, | ||
cleanSensitiveData, | ||
} from '../utils'; | ||
|
||
const sensitive = 'sensitive'; | ||
const safe = 'safe'; | ||
|
||
const originalData = { | ||
a: safe, | ||
access_code: sensitive, | ||
accessCode: sensitive, | ||
city: sensitive, | ||
date_of_birth: sensitive, | ||
email: sensitive, | ||
extra_info: sensitive, | ||
first_name: sensitive, | ||
last_name: sensitive, | ||
membership_number: sensitive, | ||
native_language: sensitive, | ||
phone_number: sensitive, | ||
postal_code: sensitive, | ||
service_language: sensitive, | ||
street_address: sensitive, | ||
user_email: sensitive, | ||
user_name: sensitive, | ||
user_phone_number: sensitive, | ||
zipcode: sensitive, | ||
arrayOfObjects: [ | ||
{ a: safe, accessCode: sensitive }, | ||
{ b: safe, accessCode: sensitive }, | ||
], | ||
arrayOfStrings: [safe], | ||
object: { c: safe, userEmail: sensitive, userName: sensitive }, | ||
}; | ||
|
||
const cleanedData = { | ||
a: safe, | ||
arrayOfObjects: [{ a: safe }, { b: safe }], | ||
arrayOfStrings: [safe], | ||
object: { c: safe }, | ||
}; | ||
|
||
describe('beforeSend', () => { | ||
it('should clear sensitive data', () => { | ||
expect( | ||
beforeSend({ extra: { data: originalData }, type: undefined }) | ||
).toEqual({ extra: { data: cleanedData } }); | ||
}); | ||
}); | ||
|
||
describe('beforeSendTransaction', () => { | ||
it('should clear sensitive data', () => { | ||
expect( | ||
beforeSendTransaction({ | ||
extra: { data: originalData }, | ||
type: 'transaction', | ||
}) | ||
).toEqual({ extra: { data: cleanedData }, type: 'transaction' }); | ||
}); | ||
}); | ||
|
||
describe('cleanSensitiveData', () => { | ||
it('should clear sensitive data', () => { | ||
expect(cleanSensitiveData(originalData)).toEqual(cleanedData); | ||
}); | ||
}); |
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