github / github/codeql

False positive: it is valid to escape $ in javascript template string syntax

Offen
#15,077 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
false-positive
Vorherrschende Sprache
CodeQL
Sterne
10.1k
Forks
2.1k
Ø Merge
2 T. 15 Std.
Gemergte PRs (30 T.)
141

Beschreibung

**Description of the false positive**

js/useless-regexp-character-escape triggers for code like:

```javascript
const str = `hello \${name}`;
```

This is invalid, since without the backslash escape, that's a string interpolation of the `name` variable:

```javascript
const str = `hello ${name}`;
```

This triggered in the lit-html codebase on this line: https://github.com/lit/lit/blob/5eea178e0df1199cd29e9d46bc888d52882f18dd/packages/lit-html/src/lit-html.ts#L1418

Link to the code scanning issue: https://github.com/lit/lit/security/code-scanning/15

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.