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

Use [REDACTED] instead of [SANITIZED] when cleaning errors #515

Merged
merged 3 commits into from
Jul 23, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var sanitizeErrors = function(collection) {

Object.keys(collection).forEach(function(key) {
if (key.toLowerCase().match('password|secret|authorization')) {
collection[key] = '[SANITIZED]';
collection[key] = '[REDACTED]';
}
});
};
Expand Down
2 changes: 1 addition & 1 deletion test/auth0-rest-client.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ describe('Auth0RestClient', function() {
var client = new Auth0RestClient(API_URL + '/some-resource', options, this.providerMock);
client.getAll().catch(function(err) {
const originalRequestHeader = err.originalError.response.request._header;
expect(originalRequestHeader.authorization).to.equal('[SANITIZED]');
expect(originalRequestHeader.authorization).to.equal('[REDACTED]');
done();
nock.cleanAll();
});
Expand Down
14 changes: 7 additions & 7 deletions test/errors.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ describe('Errors', function() {
const sanitizedError = errors.sanitizeErrorRequestData(error);
Copy link
Contributor

Choose a reason for hiding this comment

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

do we want to update these variables as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

const sanitizedData = sanitizedError.response.request._data;

it('should return [SANITIZED] for DATA_SECRET', function() {
expect(sanitizedData.DATA_SECRET).to.equal('[SANITIZED]');
it('should return [REDACTED] for DATA_SECRET', function() {
expect(sanitizedData.DATA_SECRET).to.equal('[REDACTED]');
});
it('should return [SANITIZED] for DATA_SECRET', function() {
expect(sanitizedData.DATA_SECRET).to.equal('[SANITIZED]');
it('should return [REDACTED] for DATA_SECRET', function() {
expect(sanitizedData.DATA_SECRET).to.equal('[REDACTED]');
});
it('should return original value for USER_NAME', function() {
expect(sanitizedData.USER_NAME).to.equal(sanitizedData.USER_NAME);
Expand All @@ -52,8 +52,8 @@ describe('Errors', function() {
const sanitizedError = errors.sanitizeErrorRequestData(error);
Copy link
Contributor

Choose a reason for hiding this comment

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

also here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

const sanitizedData = sanitizedError.response.request._header;

it('should return [SANITIZED] for authorization', function() {
expect(sanitizedData.authorization).to.equal('[SANITIZED]');
it('should return [REDACTED] for authorization', function() {
expect(sanitizedData.authorization).to.equal('[REDACTED]');
});
});
});
Expand Down Expand Up @@ -101,7 +101,7 @@ describe('Errors', function() {
});

it('should sanitize the original error sensitive information', function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

and the messages?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

expect(sanitizedError.originalError.response.request._data.secret).to.eql('[SANITIZED]');
expect(sanitizedError.originalError.response.request._data.secret).to.eql('[REDACTED]');
});

it('should have a stack with the message and location the error was created', function() {
Expand Down