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
10 scanned, 1 skipped (binary, oversized, or unrecognised)
Signals
0 critical · 0 warn · 45 info
Scan time
7.7 s
LLM review
Reviewed by claude-haiku-5-5 (Anthropic): 8 of 8 warn and critical signals; 8 demoted to info.
Disclude version
4.1.0
Scanned (UTC)
2026-10-22 17:33

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 warn → info by review dynamic-import tests/index.html:23:22

    [embedded javascript] `require` called with a non-literal specifier (ast pass, confidence 0.60)

    
    			window.require && require({
    				'baseUrl': '../node_modules/requirejs/',
    				'urlArgs': 't=' + (+new Date),
    dismissed LLM, confidence 0.93 RequireJS configuration block in the jsesc test page that sets baseUrl and cache-busting urlArgs.
    Reasoning

    This is a RequireJS test-page configuration: window.require is checked and require is called with a config object setting baseUrl and a cache-busting urlArgs. The non-literal parts are a config value and a timestamp, not a payload loader. Standard AMD bootstrap in a test harness.

  9. info warn → info by review dynamic-import tests/index.html:31:5

    [embedded javascript] `require` called with a non-literal specifier (ast pass, confidence 0.60)

    			['jsesc'], function(stringEscape) {
    				require(['tests.js']);
    			});
    		
    dismissed LLM, confidence 0.93 RequireJS call that loads the local tests.js module in the jsesc test page.
    Reasoning

    The call loads the local test module 'tests.js' through RequireJS after the jsesc dependency resolves. The specifier is a fixed local path in a test page, so the finding is a false positive on AMD loading.

  10. 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,
  11. 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
    			}),
  12. 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
    			}),
  13. 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
    			}),
  14. 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
    			}),
  15. 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
    			}),
  16. 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'
    		);
  17. 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'
    		);
  18. 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'
    		);
  19. 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'
    		);
  20. 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'
    		);
  21. 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
    			}),
  22. 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
    			}),
  23. 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
    			}),
  24. 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
  25. 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
  26. 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
  27. 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'
    				};
  28. 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'
    				};
    			}
  29. 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`'
    		);
  30. 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`'
    		);
  31. 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`'
    		);
  32. 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`'
    		);
  33. 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`'
    		);
  34. 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`'
    		);
  35. 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`'
    		);
  36. 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`'
    		);
  37. 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
  38. 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
  39. 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.92 Test assertion that evaluates jsesc-generated single-quoted string literals to verify round-trip escaping.
    Reasoning

    This is a jsesc round-trip test. It evals a string built from jsesc output with single quotes and asserts the result equals the original symbols. The eval input is generated locally from a fixed test fixture, not from untrusted input. The pattern is a known test idiom for verifying escape output is valid JS.

  40. 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.92 Test assertion evaluating single-quote jsesc output to check it round-trips to the original symbols.
    Reasoning

    Same jsesc round-trip test as the other eval assertions: escaped output with single-quote option is evaluated and compared to the original symbol set. Input is a fixed local fixture.

  41. 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.92 Test assertion evaluating backtick-quoted jsesc output to verify round-trip correctness.
    Reasoning

    Round-trip test for backtick-quoted jsesc output, evaluated and compared to the source symbols. The eval input comes from a deterministic test fixture, consistent with a legitimate escaping test suite.

  42. 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.92 Test assertion evaluating wrapped jsesc output to verify it parses and round-trips correctly.
    Reasoning

    Round-trip test with wrap:true, so jsesc output is a complete JS expression that is eval'd and compared against the fixture. This validates the wrapped output form. No external or attacker-controlled input is involved.

  43. 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.92 Test assertion evaluating double-quoted jsesc output to check round-trip escaping.
    Reasoning

    Round-trip test for double-quoted jsesc output, evaluated against the original symbols. It is a deterministic test of the escaper and carries no malicious indicators.

  44. 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.92 Test assertion evaluating wrapped double-quoted jsesc output to verify round-trip correctness.
    Reasoning

    Double-quoted, wrap:true round-trip test of jsesc output, evaluated and compared with the fixture. This is a standard escaper test pattern, and the input is local and fixed.

  45. 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.1.0
git clone https://github.com/mathiasbynens/jsesc jsesc && cd jsesc
git checkout v3.1.0
disclude scan --severity info --diff v3.0.2 .