Skip to content

Commit

Permalink
feat: added exception item into options (#6018)
Browse files Browse the repository at this point in the history
  • Loading branch information
ammarkarachi committed Dec 11, 2020
1 parent 1dd373b commit 7a3be75
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
28 changes: 27 additions & 1 deletion packages/amplify-cli/src/__tests__/redaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,32 @@ describe('input-redaction', () => {
expect(redactedCategoriesJsonFromOptions.notifications.Pinpoint.FCM.ApiKey).toEqual(replacementstring);
const deletedInput = redactInput(input, true, replacementstring);
expect(deletedInput.argv).toBeFalsy();
expect(deletedInput.options).toBeFalsy();
expect(deletedInput.options).toEqual({});
});

it('should let sandboxId through', () => {
const redactedInput = redactInput(
{
argv: [],
options: {
sandboxId: '12321',
appID: '56345',
},
},
true,
);
expect(redactedInput.options?.sandboxId).toBeTruthy();
expect(redactedInput.options?.appID).toBeFalsy();
});

it('should let sandboxId through', () => {
const redactedInput = redactInput(
{
argv: [],
options: undefined,
},
true,
);
expect(redactedInput.options).toBeFalsy();
});
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { JSONUtilities } from 'amplify-cli-core';
import { Input } from '../input';
import _ from 'lodash';

const containsToRedact = ['key', 'id', 'password', 'name', 'arn', 'address', 'app'];
const quotes = '\\\\?"';
Expand Down Expand Up @@ -42,7 +43,9 @@ export default function redactInput(originalInput: Input, deleteArgAndOption: Bo
let redactString: Boolean = false;
if (deleteArgAndOption) {
delete input.argv;
delete input.options;
if (originalInput.options) {
input.options = _.pick(originalInput.options, 'sandboxId');
}
return input;
}
for (let i = 0; i < length; i++) {
Expand Down

0 comments on commit 7a3be75

Please sign in to comment.