Skip to content

Commit c6ec586

Browse files
committed
JS: Accept missing alert and clarify reason
1 parent 98d1d79 commit c6ec586

File tree

1 file changed

+3
-1
lines changed
  • javascript/ql/test/query-tests/Security/CWE-843

1 file changed

+3
-1
lines changed

javascript/ql/test/query-tests/Security/CWE-843/tst.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ express().get('/some/path', function (req, res) {
2727
foo.indexOf(prefix) == 1; // $ Alert
2828
foo.slice(1) === 'x'; // $ Alert
2929

30+
foo.length; // $ Alert
31+
3032
if (typeof foo === "string") {
3133
foo.indexOf();
3234
} else {
@@ -38,7 +40,7 @@ express().get('/some/path', function (req, res) {
3840

3941
(foo + f()).indexOf();
4042

41-
foo.length; // $ Alert
43+
foo.length; // $ MISSING: Alert - missed due to guards sanitising both branches
4244
});
4345

4446
new Koa().use(function handler(ctx) {

0 commit comments

Comments
 (0)