Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fast-redact

Package Overview
Dependencies
Maintainers
1
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 1.1.2 to 1.1.3

28

lib/validator.js
'use strict'
const { Script } = require('vm')
const { createContext, runInContext } = require('vm')

@@ -26,8 +26,26 @@ module.exports = validator

const expr = s.replace(/^\*/, '〇').replace(/\.\*/g, '.〇').replace(/\[\*\]/g, '[〇]')
if (/\n|;/.test(expr)) throw Error()
if (/\/\*/.test(expr)) throw Error()
/* eslint-disable-next-line */
new Script(`
o.${expr}
if ([o.${expr}].length !== 1) throw Error()
`).runInNewContext({o: proxy, 〇: null})
runInContext(`
(function (
Array, ArrayBuffer, Atomics, Boolean, DataView, Date,
Error, EvalError, Float32Array, Float64Array, Function,
Int16Array, Int32Array, Int8Array, Intl, JSON, Map,
Math, NaN, Number, Object, Promise, Proxy, RangeError,
ReferenceError, Reflect, RegExp, Set, SharedArrayBuffer,
String, Symbol, SyntaxError, TypeError, URIError,
Uint16Array, Uint32Array, Uint8Array, Uint8ClampedArray,
WeakMap, WeakSet, WebAssembly, decodeURI,
decodeURIComponent, encodeURI, encodeURIComponent, escape,
isFinite, isNaN, parseFloat, parseInt, unescape
) {
'use strict'
arguments.constructor = null
o.${expr}
if ([o.${expr}].length !== 1) throw {}
})()
`, createContext({o: proxy, 〇: null, console}), {
codeGeneration: {strings: false, wasm: false}
})
} catch (e) {

@@ -34,0 +52,0 @@ throw Error(ERR_INVALID_PATH(s))

2

package.json
{
"name": "fast-redact",
"version": "1.1.2",
"version": "1.1.3",
"description": "very fast object redaction",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -232,3 +232,3 @@ # fast-redact

```
194 passing (450.351ms)
195 passing (581.051ms)
```

@@ -235,0 +235,0 @@

@@ -129,2 +129,5 @@ 'use strict'

}, err('a = o.b'))
throws((e) => {
fastRedact({paths: ['a\n']})
}, err('a\n'))
end()

@@ -131,0 +134,0 @@ })

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