Skip to content

Commit 9ebaac8

Browse files
committed
JS: Add tests for Response object sink
1 parent 887942e commit 9ebaac8

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
const express = require('express');
2+
3+
// Note: We're using using express for the taint source in order to to test 'Response'
4+
// in isolation from the more complicated http frameworks.
5+
6+
express().get('/foo', (req) => {
7+
const data = req.body; // $ MISSING: Source
8+
9+
new Response(data); // $ MISSING: Alert
10+
new Response(data, {}); // $ MISSING: Alert
11+
new Response(data, { headers: null }); // $ MISSING: Alert
12+
13+
new Response(data, { headers: { 'content-type': 'text/plain'}});
14+
new Response(data, { headers: { 'content-type': 'text/html'}}); // $ MISSING: Alert
15+
16+
new Response(data, { headers: { 'Content-Type': 'text/plain'}});
17+
new Response(data, { headers: { 'Content-Type': 'text/html'}}); // $ MISSING: Alert
18+
19+
const headers1 = new Headers({ 'content-type': 'text/plain'});
20+
new Response(data, { headers: headers1 });
21+
22+
const headers2 = new Headers({ 'content-type': 'text/html'});
23+
new Response(data, { headers: headers2 }); // $ MISSING: Alert
24+
25+
const headers3 = new Headers();
26+
new Response(data, { headers: headers3 }); // $ MISSING: Alert
27+
28+
const headers4 = new Headers();
29+
headers4.set('content-type', 'text/plain');
30+
new Response(data, { headers: headers4 });
31+
32+
const headers5 = new Headers();
33+
headers5.set('content-type', 'text/html');
34+
new Response(data, { headers: headers5 }); // $ MISSING: Alert
35+
36+
const headers6 = new Headers();
37+
headers6.set('unrelated-header', 'text/plain');
38+
new Response(data, { headers: headers6 }); // $ MISSING: Alert
39+
});

0 commit comments

Comments
 (0)