Fix/cs missing x frame options - #22638
michaelnebel wants to merge 3 commits into
Conversation
|
QHelp previews: csharp/ql/src/Security Features/CWE-451/MissingXFrameOptions.qhelpMissing clickjacking protectionWeb sites that do not restrict framing using the RecommendationSet the For ASP.NET Framework applications, the header may be specified either in the For ASP.NET Core applications, set the header on ExampleThe following example shows how to specify the This next example shows how to specify the protected void Application_BeginRequest(object sender, EventArgs e)
{
HttpContext.Current.Response.AddHeader("X-Frame-Options", "DENY");
}The following ASP.NET Core example uses an enforced Content Security Policy to disallow framing: void Configure(IApplicationBuilder app)
{
app.Use(async (context, next) =>
{
context.Response.Headers["Content-Security-Policy"] = "frame-ancestors 'none'";
await next();
});
}References
|
d143725 to
eed1f45
Compare
eed1f45 to
9e53b51
Compare
No description provided.