mirror of
https://github.com/github/codeql.git
synced 2026-07-23 12:12:05 +02:00
19 lines
503 B
C#
19 lines
503 B
C#
using System;
|
|
using System.Web;
|
|
using System.Net;
|
|
|
|
public class HtmlEncode
|
|
{
|
|
public static void Bad(HttpContext ctx)
|
|
{
|
|
var user = WebUtility.UrlDecode(ctx.Request.QueryString["user"]);
|
|
ctx.Response.Write("Hello, " + WebUtility.UrlEncode(user)); // $ Alert=r1 $ Alert=r1
|
|
}
|
|
|
|
public static void Good(HttpContext ctx)
|
|
{
|
|
var user = WebUtility.UrlDecode(ctx.Request.QueryString["user"]);
|
|
ctx.Response.Write("Hello, " + WebUtility.HtmlEncode(user));
|
|
}
|
|
}
|