fast-redact
Advanced tools
Comparing version 3.3.0 to 3.4.0
@@ -14,8 +14,17 @@ 'use strict' | ||
const { censor, secret } = this | ||
const originalSecret = {} | ||
const secretKeys = Object.keys(secret) | ||
for (var i = 0; i < secretKeys.length; i++) { | ||
originalSecret[secretKeys[i]] = secret[secretKeys[i]] | ||
} | ||
${redactTmpl(secret, isCensorFct, censorFctTakesPath)} | ||
this.compileRestore() | ||
${dynamicRedactTmpl(wcLen > 0, isCensorFct, censorFctTakesPath)} | ||
this.secret = originalSecret | ||
${resultTmpl(serialize)} | ||
`).bind(state) | ||
redact.secret = secret | ||
if (serialize === false) { | ||
@@ -22,0 +31,0 @@ redact.restore = (o) => state.restore(o) |
@@ -73,5 +73,7 @@ 'use strict' | ||
const o = secret[k] | ||
if (o.flat === true) this.groupRestore(o) | ||
else this.nestedRestore(o) | ||
secret[k] = null | ||
if (o) { | ||
if (o.flat === true) this.groupRestore(o) | ||
else this.nestedRestore(o) | ||
secret[k] = null | ||
} | ||
} | ||
@@ -78,0 +80,0 @@ ` : '' |
{ | ||
"name": "fast-redact", | ||
"version": "3.3.0", | ||
"version": "3.4.0", | ||
"description": "very fast object redaction", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -321,2 +321,13 @@ 'use strict' | ||
test('does not increment secret size', ({ end, is }) => { | ||
const redact = fastRedact({ paths: ['*.b'], censor: censorFct, serialize: false }) | ||
is(redact({ a: { b: '0123456' } }).a.b, 'xxx56') | ||
is(redact.secret[''].length, 1) | ||
is(redact({ c: { b: '0123456', d: 'pristine' } }).c.b, 'xxx56') | ||
is(redact.secret[''].length, 1) | ||
is(redact({ c: { b: '0123456', d: 'pristine' } }).c.d, 'pristine') | ||
is(redact.secret[''].length, 1) | ||
end() | ||
}) | ||
test('masks according to supplied censor-with-path function', ({ end, is }) => { | ||
@@ -323,0 +334,0 @@ const redact = fastRedact({ paths: ['a'], censor: censorWithPath, serialize: false }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
91218
2196