Skip to content

Commit

Permalink
Merge pull request #515 from auth0/change-term
Browse files Browse the repository at this point in the history
Use [REDACTED] instead of [SANITIZED] when cleaning errors
  • Loading branch information
jimmyjames authored Jul 23, 2020
2 parents 34c5f80 + 4cb50e2 commit bde5148
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
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

0 comments on commit bde5148

Please sign in to comment.