mirror of
https://github.com/github/codeql.git
synced 2026-05-03 04:39:29 +02:00
apply suggestions from code review
This commit is contained in:
@@ -6,14 +6,13 @@ using System.Collections.Generic;
|
||||
|
||||
public class UrlRedirectHandler2 : IHttpHandler
|
||||
{
|
||||
private const String VALID_REDIRECT = "http://cwe.mitre.org/data/definitions/601.html";
|
||||
private List<string> VALID_REDIRECTS = new List<string>{ "http://cwe.mitre.org/data/definitions/601.html", "http://cwe.mitre.org/data/definitions/79.html" };
|
||||
|
||||
public void ProcessRequest(HttpContext ctx)
|
||||
{
|
||||
// BAD: a request parameter is incorporated without validation into a URL redirect
|
||||
ctx.Response.Redirect(ctx.Request.QueryString["page"]);
|
||||
|
||||
List<string> VALID_REDIRECTS = new List<string>{ "http://cwe.mitre.org/data/definitions/601.html", "http://cwe.mitre.org/data/definitions/79.html" };
|
||||
var redirectUrl = ctx.Request.QueryString["page"];
|
||||
if (VALID_REDIRECTS.Contains(redirectUrl))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user