Skip to content

Commit bb48421

Browse files
author
Esben Sparre Andreasen
committed
JS: address doc review comments
1 parent 444a09a commit bb48421

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

change-notes/1.19/analysis-javascript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
| **Query** | **Tags** | **Purpose** |
1414
|-----------------------------------------------|------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
15-
| Stored cross-site scripting (`js/stored-xss`) | security, external/cwe/cwe-079, external/cwe/cwe-116 | Highlights uncontrolled stored values flowing into HTML content, indicating a violation of [CWE-079](https://cwe.mitre.org/data/definitions/79.html). Results shown on lgtm by default. |
15+
| Stored cross-site scripting (`js/stored-xss`) | security, external/cwe/cwe-079, external/cwe/cwe-116 | Highlights uncontrolled stored values flowing into HTML content, indicating a violation of [CWE-079](https://cwe.mitre.org/data/definitions/79.html). Results shown on LGTM by default. |
1616

1717
## Changes to existing queries
1818

javascript/ql/src/Security/CWE-079/examples/StoredXss.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ express().get('/list-directory', function(req, res) {
55
fs.readdir('/public', function (error, fileNames) {
66
var list = '<ul>';
77
fileNames.forEach(fileName => {
8-
list += '<li>' + fileName '</li>'; // BAD: `fileName` can contain HTML elements
8+
// BAD: `fileName` can contain HTML elements
9+
list += '<li>' + fileName '</li>';
910
});
1011
list += '</ul>'
1112
res.send(list);

javascript/ql/src/Security/CWE-079/examples/StoredXssGood.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ express().get('/list-directory', function(req, res) {
66
fs.readdir('/public', function (error, fileNames) {
77
var list = '<ul>';
88
fileNames.forEach(fileName => {
9-
list += '<li>' + escape(fileName) '</li>'; // GOOD: escaped `fileName` can not contain HTML elements
9+
// GOOD: escaped `fileName` can not contain HTML elements
10+
list += '<li>' + escape(fileName) '</li>';
1011
});
1112
list += '</ul>'
1213
res.send(list);

0 commit comments

Comments
 (0)