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 all commits
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
28 changes: 14 additions & 14 deletions test/errors.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ describe('Errors', function() {
describe('sanitizeErrorRequestData', function() {
describe('when passed in error is missing request data and headers', function() {
var error = { response: { request: {} } };
var sanitizedError = errors.sanitizeErrorRequestData(error);
var redactedError = errors.sanitizeErrorRequestData(error);

it('should return error', function() {
expect(sanitizedError).to.equal(error);
expect(redactedError).to.equal(error);
});
});

Expand All @@ -25,14 +25,14 @@ describe('Errors', function() {
}
}
};
const sanitizedError = errors.sanitizeErrorRequestData(error);
const sanitizedData = sanitizedError.response.request._data;
const redactedError = errors.sanitizeErrorRequestData(error);
const sanitizedData = redactedError.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 @@ -49,11 +49,11 @@ describe('Errors', function() {
}
}
};
const sanitizedError = errors.sanitizeErrorRequestData(error);
const sanitizedData = sanitizedError.response.request._header;
const redactedError = errors.sanitizeErrorRequestData(error);
const sanitizedData = redactedError.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 @@ -100,8 +100,8 @@ describe('Errors', function() {
expect(sanitizedError.originalError).to.eql(originalError);
});

it('should sanitize the original error sensitive information', function() {
expect(sanitizedError.originalError.response.request._data.secret).to.eql('[SANITIZED]');
it('should redact the original error sensitive information', function() {
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