Socket
Socket
Sign inDemoInstall

fast-redact

Package Overview
Dependencies
Maintainers
2
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-redact - npm Package Compare versions

Comparing version 3.3.0 to 3.4.0

9

lib/redactor.js

@@ -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)

8

lib/restorer.js

@@ -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 })

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc