Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b10a948

Browse filesBrowse files
committed
Fixed false positives from strapi and rxjs/testing as well as when one passes function as second arg to pipe
1 parent e6ae8bb commit b10a948
Copy full SHA for b10a948

File tree

7 files changed

+11
-7
lines changed
Filter options

7 files changed

+11
-7
lines changed

‎javascript/ql/lib/ext/rxjs.model.yml

Copy file name to clipboardExpand all lines: javascript/ql/lib/ext/rxjs.model.yml
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ extensions:
55
data:
66
- ["NonNodeStream", "rxjs", "Fuzzy"]
77
- ["NonNodeStream", "rxjs/operators", "Fuzzy"]
8+
- ["NonNodeStream", "rxjs/testing", "Fuzzy"]
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
extensions:
2+
- addsTo:
3+
pack: codeql/javascript-all
4+
extensible: typeModel
5+
data:
6+
- ["NonNodeStream", "@strapi/utils", "Fuzzy"]

‎javascript/ql/src/Quality/UnhandledStreamPipe.ql

Copy file name to clipboardExpand all lines: javascript/ql/src/Quality/UnhandledStreamPipe.ql
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class PipeCall extends DataFlow::MethodCallNode {
1818
PipeCall() {
1919
this.getMethodName() = "pipe" and
2020
this.getNumArgument() = [1, 2] and
21-
not this.getArgument(0).asExpr() instanceof Function and
21+
not this.getArgument([0, 1]).asExpr() instanceof Function and
2222
not this.getArgument(0).asExpr() instanceof ObjectExpr and
2323
not this.getArgument(0).getALocalSource() = getNonNodeJsStreamType()
2424
}

‎javascript/ql/test/query-tests/Quality/UnhandledStreamPipe/rxjsStreams.js

Copy file name to clipboardExpand all lines: javascript/ql/test/query-tests/Quality/UnhandledStreamPipe/rxjsStreams.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ function f(){
1313
let testScheduler = new TestScheduler();
1414
testScheduler.run(({x, y, z}) => {
1515
const source = x('', {o: [a, b, c]});
16-
z(source.pipe(null)).toBe(expected,y,); // $SPURIOUS:Alert
16+
z(source.pipe(null)).toBe(expected,y,);
1717
});
1818
}
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { async } from '@strapi/utils';
22

33
const f = async () => {
4-
const permissionsInDB = await async.pipe(strapi.db.query('x').findMany,map('y'))(); // $SPURIOUS:Alert
4+
const permissionsInDB = await async.pipe(strapi.db.query('x').findMany,map('y'))();
55
}

‎javascript/ql/test/query-tests/Quality/UnhandledStreamPipe/test.expected

Copy file name to clipboardExpand all lines: javascript/ql/test/query-tests/Quality/UnhandledStreamPipe/test.expected
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
| rxjsStreams.js:16:7:16:23 | source.pipe(null) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
2-
| strapi.js:4:35:4:84 | async.p ... p('y')) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
31
| test.js:4:5:4:28 | stream. ... nation) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
42
| test.js:19:5:19:17 | s2.pipe(dest) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
53
| test.js:45:5:45:30 | stream2 ... ation2) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
@@ -13,4 +11,3 @@
1311
| test.js:143:5:143:62 | stream. ... itable) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
1412
| test.js:175:17:175:40 | notStre ... itable) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
1513
| test.js:185:5:185:32 | copyStr ... nation) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
16-
| test.js:216:5:216:38 | notStre ... ()=>{}) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |

‎javascript/ql/test/query-tests/Quality/UnhandledStreamPipe/test.js

Copy file name to clipboardExpand all lines: javascript/ql/test/query-tests/Quality/UnhandledStreamPipe/test.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,6 @@ function test() {
213213
}
214214
{
215215
const notStream = getNotAStream();
216-
notStream.pipe(getStream(),()=>{}); // $SPURIOUS:Alert
216+
notStream.pipe(getStream(),()=>{});
217217
}
218218
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.