8000 Add test cases for non-stream field accesses and methods before and a… · github/codeql@b6b64d2 · GitHub
[go: up one dir, main page]

Skip to content

Commit b6b64d2

Browse files
committed
Add test cases for non-stream field accesses and methods before and after pipe operations
1 parent 03d1f9a commit b6b64d2

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@
99
| test.js:116:5:116:21 | stream.pipe(dest) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
1010
| test.js:125:5:125:26 | getStre ... e(dest) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
1111
| 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. |
12+
| test.js:171:5:171:50 | notStre ... itable) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
13+
| test.js:175:5:175:39 | notStre ... itable) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
14+
| test.js:179:17:179:40 | notStre ... itable) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
15+
| test.js:183:17:183:40 | notStre ... itable) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
16+
| test.js:193:5:193:32 | copyStr ... nation) | 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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,30 @@ function test() {
166166
const notStream = getNotAStream();
167167
notStream.pipe(arg1, arg2, arg3);
168168
}
169+
{ // Usage of pipe after a non-stream method
170+
const notStream = getNotAStream();
171+
notStream.nonStreamMethodName().pipe(writable); // $SPURIOUS:Alert
172+
}
173+
{ // Usage of pipe after a non-stream member
174+
const notStream = getNotAStream();
175+
notStream.someMember.pipe(writable); // $SPURIOUS:Alert
176+
}
177+
{ // Member access on a non-stream after pipe
178+
const notStream = getNotAStream();
179+
const val = notStream.pipe(writable).someMember; // $SPURIOUS:Alert
180+
}
181+
{ // Member access on a stream after pipe
182+
const notStream = getNotAStream();
183+
const val = notStream.pipe(writable).readable; // $Alert
184+
}
185+
{ // Method access on a non-stream after pipe
186+
const notStream = getNotAStream();
187+
const val = notStream.pipe(writable).someMethod();
188+
}
189+
{ // Pipe on fs readStream
190+
const fs = require('fs');
191+
const stream = fs.createReadStream('file.txt');
192+
const copyStream = stream;
193+
copyStream.pipe(destination); // $Alert
194+
}
169195
}

0 commit comments

Comments
 (0)
0