Skip to content

Commit

Permalink
better naming sensitive -> sensitiveKeys
Browse files Browse the repository at this point in the history
  • Loading branch information
soulmonk committed May 29, 2020
1 parent 1b0cad6 commit 64534f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions secure-log-data.js
Expand Up @@ -21,14 +21,14 @@ const SENSATIVE_PATH = {
const TOKEN = /token=[^;]*/;
const TOKEN_ENC = /token%3[^&]*/;

function sanitize({ sensitive = [] } = {}) {
sensitive = sensitive.map(key => key.toLowerCase()).concat(SENSITIVE);
function sanitize({ sensitiveKeys = [] } = {}) {
sensitiveKeys = sensitiveKeys.map(key => key.toLowerCase()).concat(SENSITIVE);
return function (val) {
if (!this.isLeaf || !val) {
return;
} else if (
schemaError(this.key, this.parent && this.parent.node, sensitive) ||
sensitive.indexOf(this.key.toLowerCase()) !== -1 ||
schemaError(this.key, this.parent && this.parent.node, sensitiveKeys) ||
sensitiveKeys.indexOf(this.key.toLowerCase()) !== -1 ||
isSensativePath(this.key, this.parent && this.parent.path)) {
this.update('***');
} else if (TOKEN.test(val)) {
Expand Down
2 changes: 1 addition & 1 deletion test/secure-log-data.spec.js
Expand Up @@ -188,7 +188,7 @@ describe('secure-data.spec.js', function() {
user: 'bob'
}
}
}, { sensitive: ['mySensitiveField'] })).to.eql({
}, { sensitiveKeys: ['mySensitiveField'] })).to.eql({
headers: {
'mySensitiveField': '***',
'x-credentials': '***',
Expand Down

0 comments on commit 64534f0

Please sign in to comment.