Skip to content

Commit

Permalink
Merge branch 'master' into update-device-credentials-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyjames authored Jul 23, 2020
2 parents 4c95eec + bde5148 commit 3a2a29e
Show file tree
Hide file tree
Showing 5 changed files with 28 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
4 changes: 4 additions & 0 deletions src/management/JobsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,10 @@ JobsManager.prototype.errors = function(params, cb) {
*
* @param {Object} data User data object.
* @param {String} data.user_id ID of the user to be verified.
* @param {String} [data.client_id] client_id of the client (application). If no value provided, the global Client ID will be used.
* @param {Object} [data.identity] Used to verify secondary, federated, and passwordless-email identities.
* @param {String} data.identity.user_id user_id of the identity.
* @param {String} data.identity.provider provider of the identity.
* @param {Function} [cb] Callback function.
*
* @return {Promise|undefined}
Expand Down
8 changes: 8 additions & 0 deletions src/management/TicketsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ TicketsManager.prototype.changePassword = function(data, cb) {
* }
* });
*
* @param {Object} data
* @param {String} [data.result_url] URL the user will be redirected to once ticket is used.
* @param {String} data.user_id user_id for whom the ticket should be created.
* @param {Integer} [data.ttl_sec] Number of seconds for which the ticket is valid before expiration.
* @param {Boolean} [data.includeEmailInRedirect] Whether to include the email address as part of the result_url (true), or not (false).
* @param {Object} [data.identity] Used to verify secondary, federated, and passwordless-email identities.
* @param {String} data.identity.user_id user_id of the identity.
* @param {String} data.identity.provider provider of the identity.
* @param {Function} [cb] Callback function.
* @return {Promise}
*/
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 3a2a29e

Please sign in to comment.