Skip to content

Commit 000e69f

Browse files
committed
Replaced fuzzy NonNodeStream MaD to a ql predicate to deal easier with submodules
1 parent 248f83c commit 000e69f

File tree

8 files changed

+21
-35
lines changed

8 files changed

+21
-35
lines changed

javascript/ql/lib/ext/arktype.model.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

javascript/ql/lib/ext/execa.model.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

javascript/ql/lib/ext/highland.model.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

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

Lines changed: 0 additions & 8 deletions
This file was deleted.

javascript/ql/lib/ext/strapi.model.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

javascript/ql/src/Quality/UnhandledStreamPipe.ql

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,26 @@ class PipeCall extends DataFlow::MethodCallNode {
3535
* This is used to exclude pipe calls on non-stream objects from analysis.
3636
*/
3737
DataFlow::Node getNonNodeJsStreamType() {
38-
result = ModelOutput::getATypeNode("NonNodeStream").asSource()
38+
result = getNonStreamApi().getAValueReachableFromSource()
39+
}
40+
41+
//highland, arktype execa
42+
API::Node getNonStreamApi() {
43+
exists(string moduleName |
44+
moduleName
45+
.regexpMatch([
46+
"rxjs(|/.*)", "@strapi(|/.*)", "highland(|/.*)", "execa(|/.*)", "arktype(|/.*)"
47+
]) and
48+
result = API::moduleImport(moduleName)
49+
)
50+
or
51+
result = getNonStreamApi().getAMember()
52+
or
53+
result = getNonStreamApi().getAParameter().getAParameter()
54+
or
55+
result = getNonStreamApi().getReturn()
56+
or
57+
result = getNonStreamApi().getPromised()
3958
}
4059

4160
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ function f(){
1616
z(source.pipe(null)).toBe(expected,y,);
1717
});
1818

19-
z.option$.pipe(pluck("x")) // $SPURIOUS:Alert
19+
z.option$.pipe(pluck("x"))
2020
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
| rxjsStreams.js:19:3:19:28 | z.optio ... k("x")) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
21
| 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. |
32
| 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. |
43
| 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. |

0 commit comments

Comments
 (0)