npm / jsesc / 3.1.0

jsesc 3.1.0

Source
https://github.com/mathiasbynens/jsesc
Tag scanned
v3.1.0
Compared with
v3.0.2 (0 signals introduced since)
Files
9 scanned, 2 skipped (binary, oversized, or unrecognised)
Signals
0 critical · 0 warn · 43 info
Scan time
4.4 s
LLM review
Reviewed by claude-haiku-5-5 (Anthropic): 6 of 6 warn and critical signals; 6 demoted to info.
Disclude version
4.0.0
Scanned (UTC)
2026-10-14 19:48

Signals

Ordered by severity, then signals introduced in this release. Hidden characters are shown as ⟨U+…⟩.

  1. info unicode-surrogate bin/jsesc:38:37

    surrogate pair \uD834\uDF06 (non-scalar Unicode codepoints in string literal) (token pass, confidence 0.70)

    				'\nExamples:\n',
    				'\tjsesc \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
    				'\tjsesc --json \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
    				'\tjsesc --json --escape-everything \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
  2. info unicode-surrogate bin/jsesc:39:44

    surrogate pair \uD834\uDF06 (non-scalar Unicode codepoints in string literal) (token pass, confidence 0.70)

    				'\tjsesc \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
    				'\tjsesc --json \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
    				'\tjsesc --json --escape-everything \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
    				'\tjsesc --double-quotes --wrap \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
  3. info unicode-surrogate bin/jsesc:40:64

    surrogate pair \uD834\uDF06 (non-scalar Unicode codepoints in string literal) (token pass, confidence 0.70)

    				'\tjsesc --json \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
    				'\tjsesc --json --escape-everything \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
    				'\tjsesc --double-quotes --wrap \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
    				'\techo \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\' | jsesc'
  4. info unicode-surrogate bin/jsesc:41:60

    surrogate pair \uD834\uDF06 (non-scalar Unicode codepoints in string literal) (token pass, confidence 0.70)

    				'\tjsesc --json --escape-everything \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
    				'\tjsesc --double-quotes --wrap \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
    				'\techo \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\' | jsesc'
    			].join('\n'));
  5. info unicode-surrogate bin/jsesc:42:36

    surrogate pair \uD834\uDF06 (non-scalar Unicode codepoints in string literal) (token pass, confidence 0.70)

    				'\tjsesc --double-quotes --wrap \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
    				'\techo \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\' | jsesc'
    			].join('\n'));
    			return process.exit(1);
  6. info whitespace-anomaly jsesc.js:6:1

    file mixes tab and space indentation (254 tab-indented and 13 space-indented lines) (raw pass, confidence 0.40)

    const forOwn = (object, callback) => {
    	for (const key in object) {
    		if (hasOwnProperty.call(object, key)) {
    			callback(key, object[key]);
  7. info whitespace-anomaly src/jsesc.js:6:1

    file mixes tab and space indentation (254 tab-indented and 13 space-indented lines) (raw pass, confidence 0.40)

    const forOwn = (object, callback) => {
    	for (const key in object) {
    		if (hasOwnProperty.call(object, key)) {
    			callback(key, object[key]);
  8. info whitespace-anomaly tests/tests.js:7:1

    file mixes tab and space indentation (627 tab-indented and 47 space-indented lines) (raw pass, confidence 0.40)

    describe('common usage', function() {
    	it('works correctly for common operations', function() {
    		assert.equal(
    			typeof jsesc.version,
  9. info unicode-surrogate tests/tests.js:92:37

    surrogate pair \uD834\uDF06 (non-scalar Unicode codepoints in string literal) (token pass, confidence 0.70)

    		assert.equal(
    			jsesc('\0foo\u2029bar\nbaz\xA9qux\uD834\uDF06flops\uD834_\uDF06_\uDF06\uD834\xA0\u2000', {
    				'minimal': true
    			}),
  10. info unicode-surrogate tests/tests.js:92:54

    orphaned high surrogate \uD834 (no matching low surrogate) (token pass, confidence 0.65)

    		assert.equal(
    			jsesc('\0foo\u2029bar\nbaz\xA9qux\uD834\uDF06flops\uD834_\uDF06_\uDF06\uD834\xA0\u2000', {
    				'minimal': true
    			}),
  11. info unicode-surrogate tests/tests.js:92:61

    orphaned low surrogate \uDF06 (no preceding high surrogate) (token pass, confidence 0.65)

    		assert.equal(
    			jsesc('\0foo\u2029bar\nbaz\xA9qux\uD834\uDF06flops\uD834_\uDF06_\uDF06\uD834\xA0\u2000', {
    				'minimal': true
    			}),
  12. info unicode-surrogate tests/tests.js:92:68

    orphaned low surrogate \uDF06 (no preceding high surrogate) (token pass, confidence 0.65)

    		assert.equal(
    			jsesc('\0foo\u2029bar\nbaz\xA9qux\uD834\uDF06flops\uD834_\uDF06_\uDF06\uD834\xA0\u2000', {
    				'minimal': true
    			}),
  13. info unicode-surrogate tests/tests.js:92:74

    orphaned high surrogate \uD834 (no matching low surrogate) (token pass, confidence 0.65)

    		assert.equal(
    			jsesc('\0foo\u2029bar\nbaz\xA9qux\uD834\uDF06flops\uD834_\uDF06_\uDF06\uD834\xA0\u2000', {
    				'minimal': true
    			}),
  14. info unicode-surrogate tests/tests.js:95:34

    surrogate pair \uD834\uDF06 (non-scalar Unicode codepoints in string literal) (token pass, confidence 0.70)

    			}),
    			'\\0foo\\u2029bar\\nbaz\xA9qux\uD834\uDF06flops\\uD834_\\uDF06_\\uDF06\\uD834\\xA0\\u2000',
    			'minimal'
    		);
  15. info unicode-surrogate tests/tests.js:95:52

    orphaned high surrogate \uD834 (no matching low surrogate) (token pass, confidence 0.65)

    			}),
    			'\\0foo\\u2029bar\\nbaz\xA9qux\uD834\uDF06flops\\uD834_\\uDF06_\\uDF06\\uD834\\xA0\\u2000',
    			'minimal'
    		);
  16. info unicode-surrogate tests/tests.js:95:60

    orphaned low surrogate \uDF06 (no preceding high surrogate) (token pass, confidence 0.65)

    			}),
    			'\\0foo\\u2029bar\\nbaz\xA9qux\uD834\uDF06flops\\uD834_\\uDF06_\\uDF06\\uD834\\xA0\\u2000',
    			'minimal'
    		);
  17. info unicode-surrogate tests/tests.js:95:68

    orphaned low surrogate \uDF06 (no preceding high surrogate) (token pass, confidence 0.65)

    			}),
    			'\\0foo\\u2029bar\\nbaz\xA9qux\uD834\uDF06flops\\uD834_\\uDF06_\\uDF06\\uD834\\xA0\\u2000',
    			'minimal'
    		);
  18. info unicode-surrogate tests/tests.js:95:75

    orphaned high surrogate \uD834 (no matching low surrogate) (token pass, confidence 0.65)

    			}),
    			'\\0foo\\u2029bar\\nbaz\xA9qux\uD834\uDF06flops\\uD834_\\uDF06_\\uDF06\\uD834\\xA0\\u2000',
    			'minimal'
    		);
  19. info unicode-surrogate tests/tests.js:211:12

    surrogate pair \uD834\uDF06 (non-scalar Unicode codepoints in string literal) (token pass, confidence 0.70)

    		assert.equal(
    			jsesc('a\uD834\uDF06b', {
    				'es6': true
    			}),
  20. info unicode-surrogate tests/tests.js:218:12

    surrogate pair \uD834\uDF06 (non-scalar Unicode codepoints in string literal) (token pass, confidence 0.70)

    		assert.equal(
    			jsesc('a\uD834\uDF06b\uD83D\uDCA9c', {
    				'es6': true
    			}),
  21. info unicode-surrogate tests/tests.js:218:25

    surrogate pair \uD83D\uDCA9 (non-scalar Unicode codepoints in string literal) (token pass, confidence 0.70)

    		assert.equal(
    			jsesc('a\uD834\uDF06b\uD83D\uDCA9c', {
    				'es6': true
    			}),
  22. info unicode-surrogate tests/tests.js:225:12

    surrogate pair \uD834\uDF06 (non-scalar Unicode codepoints in string literal) (token pass, confidence 0.70)

    		assert.equal(
    			jsesc('a\uD834\uDF06b\uD83D\uDCA9c', {
    				'es6': true,
    				'escapeEverything': true
  23. info unicode-surrogate tests/tests.js:225:25

    surrogate pair \uD83D\uDCA9 (non-scalar Unicode codepoints in string literal) (token pass, confidence 0.70)

    		assert.equal(
    			jsesc('a\uD834\uDF06b\uD83D\uDCA9c', {
    				'es6': true,
    				'escapeEverything': true
  24. info unicode-surrogate tests/tests.js:503:14

    surrogate pair \uD834\uDF06 (non-scalar Unicode codepoints in string literal) (token pass, confidence 0.70)

    		assert.equal(
    			jsesc('foo\uD834\uDF06bar\xA9baz', {
    				'json': true,
    				'es6': true // override default `es6: false` when `json` is enabled
  25. info unicode-surrogate tests/tests.js:515:7

    surrogate pair \uD83D\uDCA9 (non-scalar Unicode codepoints in string literal) (token pass, confidence 0.70)

    					'hello': 'world',
    					'\uD83D\uDCA9': 'foo',
    					'pile': '\uD83D\uDCA9'
    				};
  26. info unicode-surrogate tests/tests.js:516:15

    surrogate pair \uD83D\uDCA9 (non-scalar Unicode codepoints in string literal) (token pass, confidence 0.70)

    					'\uD83D\uDCA9': 'foo',
    					'pile': '\uD83D\uDCA9'
    				};
    			}
  27. info unicode-surrogate tests/tests.js:522:24

    orphaned high surrogate \uD83D (no matching low surrogate) (token pass, confidence 0.65)

    			jsesc(tmp, { 'json' : true }),
    			'{"hello":"world","\\uD83D\\uDCA9":"foo","pile":"\\uD83D\\uDCA9"}',
    			'`toJSON` methods are called when `json: true`'
    		);
  28. info unicode-surrogate tests/tests.js:522:31

    orphaned low surrogate \uDCA9 (no preceding high surrogate) (token pass, confidence 0.65)

    			jsesc(tmp, { 'json' : true }),
    			'{"hello":"world","\\uD83D\\uDCA9":"foo","pile":"\\uD83D\\uDCA9"}',
    			'`toJSON` methods are called when `json: true`'
    		);
  29. info unicode-surrogate tests/tests.js:522:54

    orphaned high surrogate \uD83D (no matching low surrogate) (token pass, confidence 0.65)

    			jsesc(tmp, { 'json' : true }),
    			'{"hello":"world","\\uD83D\\uDCA9":"foo","pile":"\\uD83D\\uDCA9"}',
    			'`toJSON` methods are called when `json: true`'
    		);
  30. info unicode-surrogate tests/tests.js:522:61

    orphaned low surrogate \uDCA9 (no preceding high surrogate) (token pass, confidence 0.65)

    			jsesc(tmp, { 'json' : true }),
    			'{"hello":"world","\\uD83D\\uDCA9":"foo","pile":"\\uD83D\\uDCA9"}',
    			'`toJSON` methods are called when `json: true`'
    		);
  31. info unicode-surrogate tests/tests.js:527:24

    orphaned high surrogate \uD83D (no matching low surrogate) (token pass, confidence 0.65)

    			jsesc(tmp),
    			'{"hello":"world","\\uD83D\\uDCA9":"foo","pile":"\\uD83D\\uDCA9"}',
    			'`toJSON` methods are not called when `json: false`'
    		);
  32. info unicode-surrogate tests/tests.js:527:31

    orphaned low surrogate \uDCA9 (no preceding high surrogate) (token pass, confidence 0.65)

    			jsesc(tmp),
    			'{"hello":"world","\\uD83D\\uDCA9":"foo","pile":"\\uD83D\\uDCA9"}',
    			'`toJSON` methods are not called when `json: false`'
    		);
  33. info unicode-surrogate tests/tests.js:527:54

    orphaned high surrogate \uD83D (no matching low surrogate) (token pass, confidence 0.65)

    			jsesc(tmp),
    			'{"hello":"world","\\uD83D\\uDCA9":"foo","pile":"\\uD83D\\uDCA9"}',
    			'`toJSON` methods are not called when `json: false`'
    		);
  34. info unicode-surrogate tests/tests.js:527:61

    orphaned low surrogate \uDCA9 (no preceding high surrogate) (token pass, confidence 0.65)

    			jsesc(tmp),
    			'{"hello":"world","\\uD83D\\uDCA9":"foo","pile":"\\uD83D\\uDCA9"}',
    			'`toJSON` methods are not called when `json: false`'
    		);
  35. info unicode-surrogate tests/tests.js:585:21

    surrogate pair \uD83D\uDCA9 (non-scalar Unicode codepoints in string literal) (token pass, confidence 0.70)

    		assert.equal(
    			jsesc('\u2192\xE9\uD83D\uDCA9', {
    				'lowercaseHex': true,
    				'es6': true
  36. info unicode-surrogate tests/tests.js:593:21

    surrogate pair \uD83D\uDCA9 (non-scalar Unicode codepoints in string literal) (token pass, confidence 0.70)

    		assert.equal(
    			jsesc('\u2192\xE9\uD83D\uDCA9', {
    				'lowercaseHex': false,
    				'es6': true
  37. info critical → info by review dynamic-execution tests/tests.js:617:4

    `eval` called with a non-literal expression (ast pass, confidence 0.90)

    		assert.ok(
    			eval('\'' + jsesc(allSymbols) + '\'') == allSymbols,
    			'All Unicode symbols, space-separated, default quote type (single quotes)'
    		);
    likely benign LLM, confidence 0.90 Test assertion that evals jsesc output to verify round-trip escaping of Unicode symbols.
    Reasoning

    The eval is in a test file for the jsesc library, round-tripping escaped strings of Unicode symbols to verify the escaper's output. The argument is generated by jsesc from a fixed test constant, not external input. Flagged by the AST pass as a non-literal eval, but the context is a legitimate test assertion.

  38. info critical → info by review dynamic-execution tests/tests.js:621:4

    `eval` called with a non-literal expression (ast pass, confidence 0.90)

    		assert.ok(
    			eval('\'' + jsesc(allSymbols, {
    				'quotes': 'single'
    			}) + '\'') == allSymbols,
    likely benign LLM, confidence 0.90 Test assertion evaluating single-quoted jsesc output to check escaping correctness.
    Reasoning

    Same jsesc round-trip test in a test suite, using single-quote wrapping on a fixed constant. No external input reaches the eval.

  39. info critical → info by review dynamic-execution tests/tests.js:627:4

    `eval` called with a non-literal expression (ast pass, confidence 0.90)

    		assert.ok(
    			eval('`' + jsesc(allSymbols, {
    				'quotes': 'backtick'
    			}) + '`') == allSymbols,
    likely benign LLM, confidence 0.90 Test assertion evaluating backtick-quoted jsesc output to verify escaping.
    Reasoning

    Round-trip test of jsesc backtick-quoted output against a fixed test constant inside a test file. Eval here is the test mechanism itself.

  40. info critical → info by review dynamic-execution tests/tests.js:633:4

    `eval` called with a non-literal expression (ast pass, confidence 0.75)

    		assert.ok(
    			eval(jsesc(allSymbols, {
    				'quotes': 'single',
    				'wrap': true
    likely benign LLM, confidence 0.90 Test assertion evaluating wrapped jsesc output to verify round-trip correctness.
    Reasoning

    Round-trip test of jsesc wrapped output using a fixed constant. The eval verifies that the escaped literal parses back to the original value, which is the purpose of this jsesc test.

  41. info critical → info by review dynamic-execution tests/tests.js:640:4

    `eval` called with a non-literal expression (ast pass, confidence 0.90)

    		assert.ok(
    			eval('"' + jsesc(allSymbols, {
    				'quotes': 'double'
    			}) + '"') == allSymbols,
    likely benign LLM, confidence 0.90 Test assertion evaluating double-quoted jsesc output to verify escaping.
    Reasoning

    Double-quoted jsesc round-trip check in a test file operating on a fixed test constant. No untrusted input is involved.

  42. info critical → info by review dynamic-execution tests/tests.js:646:4

    `eval` called with a non-literal expression (ast pass, confidence 0.75)

    		assert.ok(
    			eval(jsesc(allSymbols, {
    				'quotes': 'double',
    				'wrap': true
    likely benign LLM, confidence 0.90 Test assertion evaluating wrapped double-quoted jsesc output to verify escaping.
    Reasoning

    Wrapped double-quote jsesc round-trip test in a test suite using fixed data. The eval is the verification step, not a dropper or injection vector.

  43. info high-complexity tests/tests.js:666:5

    compression ratio 0.680 is >2σ above file mean 0.292 (raw pass, confidence 0.50)

    			}),
    			'[undefined,Infinity,Infinity,-Infinity,-Infinity,0,0,0,0,0,0,\'str\',function zomg() { return \'desu\'; },null,true,true,false,false,{\'foo\':42,\'hah\':[1,2,3,{\'foo\':42}]}]',
    			'Escaping a non-flat array with all kinds of values'
    		);

Reproduce This Scan

Run disclude locally to verify. Add --format sarif for SARIF output. Add --llm (with an API key in the environment) to include the LLM review.

cargo install disclude --version 4.0.0
git clone https://github.com/mathiasbynens/jsesc jsesc && cd jsesc
git checkout v3.1.0
disclude scan --severity info --diff v3.0.2 .