mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
Added test cases for NextResponse and Response
This commit is contained in:
@@ -27,6 +27,10 @@
|
||||
| ReflectedXssContentTypes.js:39:13:39:35 | "FOO: " ... rams.id | ReflectedXssContentTypes.js:39:23:39:35 | req.params.id | ReflectedXssContentTypes.js:39:13:39:35 | "FOO: " ... rams.id | Cross-site scripting vulnerability due to a $@. | ReflectedXssContentTypes.js:39:23:39:35 | req.params.id | user-provided value |
|
||||
| ReflectedXssContentTypes.js:70:12:70:34 | "FOO: " ... rams.id | ReflectedXssContentTypes.js:70:22:70:34 | req.params.id | ReflectedXssContentTypes.js:70:12:70:34 | "FOO: " ... rams.id | Cross-site scripting vulnerability due to a $@. | ReflectedXssContentTypes.js:70:22:70:34 | req.params.id | user-provided value |
|
||||
| ReflectedXssGood3.js:139:12:139:27 | escapeHtml3(url) | ReflectedXssGood3.js:135:15:135:27 | req.params.id | ReflectedXssGood3.js:139:12:139:27 | escapeHtml3(url) | Cross-site scripting vulnerability due to a $@. | ReflectedXssGood3.js:135:15:135:27 | req.params.id | user-provided value |
|
||||
| app/api/route.ts:5:18:5:21 | body | app/api/route.ts:2:24:2:33 | req.json() | app/api/route.ts:5:18:5:21 | body | Cross-site scripting vulnerability due to a $@. | app/api/route.ts:2:24:2:33 | req.json() | user-provided value |
|
||||
| app/api/route.ts:13:18:13:21 | body | app/api/route.ts:2:24:2:33 | req.json() | app/api/route.ts:13:18:13:21 | body | Cross-site scripting vulnerability due to a $@. | app/api/route.ts:2:24:2:33 | req.json() | user-provided value |
|
||||
| app/api/route.ts:25:18:25:21 | body | app/api/route.ts:2:24:2:33 | req.json() | app/api/route.ts:25:18:25:21 | body | Cross-site scripting vulnerability due to a $@. | app/api/route.ts:2:24:2:33 | req.json() | user-provided value |
|
||||
| app/api/route.ts:29:25:29:28 | body | app/api/route.ts:2:24:2:33 | req.json() | app/api/route.ts:29:25:29:28 | body | Cross-site scripting vulnerability due to a $@. | app/api/route.ts:2:24:2:33 | req.json() | user-provided value |
|
||||
| etherpad.js:11:12:11:19 | response | etherpad.js:9:16:9:30 | req.query.jsonp | etherpad.js:11:12:11:19 | response | Cross-site scripting vulnerability due to a $@. | etherpad.js:9:16:9:30 | req.query.jsonp | user-provided value |
|
||||
| formatting.js:6:14:6:47 | util.fo ... , evil) | formatting.js:4:16:4:29 | req.query.evil | formatting.js:6:14:6:47 | util.fo ... , evil) | Cross-site scripting vulnerability due to a $@. | formatting.js:4:16:4:29 | req.query.evil | user-provided value |
|
||||
| formatting.js:7:14:7:53 | require ... , evil) | formatting.js:4:16:4:29 | req.query.evil | formatting.js:7:14:7:53 | require ... , evil) | Cross-site scripting vulnerability due to a $@. | formatting.js:4:16:4:29 | req.query.evil | user-provided value |
|
||||
@@ -128,6 +132,12 @@ edges
|
||||
| ReflectedXssGood3.js:135:15:135:27 | req.params.id | ReflectedXssGood3.js:135:9:135:27 | url | provenance | |
|
||||
| ReflectedXssGood3.js:139:24:139:26 | url | ReflectedXssGood3.js:68:22:68:26 | value | provenance | |
|
||||
| ReflectedXssGood3.js:139:24:139:26 | url | ReflectedXssGood3.js:139:12:139:27 | escapeHtml3(url) | provenance | |
|
||||
| app/api/route.ts:2:11:2:33 | body | app/api/route.ts:5:18:5:21 | body | provenance | |
|
||||
| app/api/route.ts:2:11:2:33 | body | app/api/route.ts:13:18:13:21 | body | provenance | |
|
||||
| app/api/route.ts:2:11:2:33 | body | app/api/route.ts:25:18:25:21 | body | provenance | |
|
||||
| app/api/route.ts:2:11:2:33 | body | app/api/route.ts:29:25:29:28 | body | provenance | |
|
||||
| app/api/route.ts:2:18:2:33 | await req.json() | app/api/route.ts:2:11:2:33 | body | provenance | |
|
||||
| app/api/route.ts:2:24:2:33 | req.json() | app/api/route.ts:2:18:2:33 | await req.json() | provenance | |
|
||||
| etherpad.js:9:5:9:53 | response | etherpad.js:11:12:11:19 | response | provenance | |
|
||||
| etherpad.js:9:16:9:30 | req.query.jsonp | etherpad.js:9:5:9:53 | response | provenance | |
|
||||
| formatting.js:4:9:4:29 | evil | formatting.js:6:43:6:46 | evil | provenance | |
|
||||
@@ -309,6 +319,13 @@ nodes
|
||||
| ReflectedXssGood3.js:135:15:135:27 | req.params.id | semmle.label | req.params.id |
|
||||
| ReflectedXssGood3.js:139:12:139:27 | escapeHtml3(url) | semmle.label | escapeHtml3(url) |
|
||||
| ReflectedXssGood3.js:139:24:139:26 | url | semmle.label | url |
|
||||
| app/api/route.ts:2:11:2:33 | body | semmle.label | body |
|
||||
| app/api/route.ts:2:18:2:33 | await req.json() | semmle.label | await req.json() |
|
||||
| app/api/route.ts:2:24:2:33 | req.json() | semmle.label | req.json() |
|
||||
| app/api/route.ts:5:18:5:21 | body | semmle.label | body |
|
||||
| app/api/route.ts:13:18:13:21 | body | semmle.label | body |
|
||||
| app/api/route.ts:25:18:25:21 | body | semmle.label | body |
|
||||
| app/api/route.ts:29:25:29:28 | body | semmle.label | body |
|
||||
| etherpad.js:9:5:9:53 | response | semmle.label | response |
|
||||
| etherpad.js:9:16:9:30 | req.query.jsonp | semmle.label | req.query.jsonp |
|
||||
| etherpad.js:11:12:11:19 | response | semmle.label | response |
|
||||
|
||||
@@ -26,6 +26,10 @@
|
||||
| ReflectedXssContentTypes.js:39:13:39:35 | "FOO: " ... rams.id | Cross-site scripting vulnerability due to $@. | ReflectedXssContentTypes.js:39:23:39:35 | req.params.id | user-provided value |
|
||||
| ReflectedXssContentTypes.js:70:12:70:34 | "FOO: " ... rams.id | Cross-site scripting vulnerability due to $@. | ReflectedXssContentTypes.js:70:22:70:34 | req.params.id | user-provided value |
|
||||
| ReflectedXssGood3.js:139:12:139:27 | escapeHtml3(url) | Cross-site scripting vulnerability due to $@. | ReflectedXssGood3.js:135:15:135:27 | req.params.id | user-provided value |
|
||||
| app/api/route.ts:5:18:5:21 | body | Cross-site scripting vulnerability due to $@. | app/api/route.ts:2:24:2:33 | req.json() | user-provided value |
|
||||
| app/api/route.ts:13:18:13:21 | body | Cross-site scripting vulnerability due to $@. | app/api/route.ts:2:24:2:33 | req.json() | user-provided value |
|
||||
| app/api/route.ts:25:18:25:21 | body | Cross-site scripting vulnerability due to $@. | app/api/route.ts:2:24:2:33 | req.json() | user-provided value |
|
||||
| app/api/route.ts:29:25:29:28 | body | Cross-site scripting vulnerability due to $@. | app/api/route.ts:2:24:2:33 | req.json() | user-provided value |
|
||||
| formatting.js:6:14:6:47 | util.fo ... , evil) | Cross-site scripting vulnerability due to $@. | formatting.js:4:16:4:29 | req.query.evil | user-provided value |
|
||||
| formatting.js:7:14:7:53 | require ... , evil) | Cross-site scripting vulnerability due to $@. | formatting.js:4:16:4:29 | req.query.evil | user-provided value |
|
||||
| live-server.js:6:13:6:50 | `<html> ... /html>` | Cross-site scripting vulnerability due to $@. | live-server.js:4:21:4:27 | req.url | user-provided value |
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
export async function POST(req: Request) {
|
||||
const body = await req.json(); // $ Source
|
||||
|
||||
new Response(body, {headers: { 'Content-Type': 'application/json' }});
|
||||
new Response(body, {headers: { 'Content-Type': 'text/html' }}); // $ Alert
|
||||
|
||||
const headers2 = new Headers(req.headers);
|
||||
headers2.append('Content-Type', 'application/json');
|
||||
new Response(body, { headers: headers2 });
|
||||
|
||||
const headers3 = new Headers(req.headers);
|
||||
headers3.append('Content-Type', 'text/html');
|
||||
new Response(body, { headers: headers3 }); // $ Alert
|
||||
|
||||
const headers4 = new Headers({
|
||||
...Object.fromEntries(req.headers),
|
||||
'Content-Type': 'application/json'
|
||||
});
|
||||
new Response(body, { headers: headers4 });
|
||||
|
||||
const headers5 = new Headers({
|
||||
...Object.fromEntries(req.headers),
|
||||
'Content-Type': 'text/html'
|
||||
});
|
||||
new Response(body, { headers: headers5 }); // $ Alert
|
||||
|
||||
const headers = new Headers(req.headers);
|
||||
headers.set('Content-Type', 'text/html');
|
||||
return new Response(body, { headers }); // $ Alert
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
const body = await req.json(); // $ MISSING: Source
|
||||
|
||||
new NextResponse(body, {headers: { 'Content-Type': 'application/json' }});
|
||||
new NextResponse(body, {headers: { 'Content-Type': 'text/html' }}); // $ MISSING: Alert
|
||||
|
||||
const headers2 = new Headers(req.headers);
|
||||
headers2.append('Content-Type', 'application/json');
|
||||
new NextResponse(body, { headers: headers2 });
|
||||
|
||||
const headers3 = new Headers(req.headers);
|
||||
headers3.append('Content-Type', 'text/html');
|
||||
new NextResponse(body, { headers: headers3 }); // $ MISSING: Alert
|
||||
|
||||
const headers4 = new Headers({
|
||||
...Object.fromEntries(req.headers),
|
||||
'Content-Type': 'application/json'
|
||||
});
|
||||
new NextResponse(body, { headers: headers4 });
|
||||
|
||||
const headers5 = new Headers({
|
||||
...Object.fromEntries(req.headers),
|
||||
'Content-Type': 'text/html'
|
||||
});
|
||||
new NextResponse(body, { headers: headers5 }); // $ MISSING: Alert
|
||||
|
||||
const headers = new Headers(req.headers);
|
||||
headers.set('Content-Type', 'text/html');
|
||||
return new NextResponse(body, { headers }); // $ MISSING: Alert
|
||||
}
|
||||
Reference in New Issue
Block a user