2021年4月8日 星期四

解決 ASP .Net Core MVC 3.1 的Clickjacking弱點

 弱掃偵測偵測到一個ClickJacking的弱點

Web Application Potentially Vulnerable to Clickjacking

解決方法在 Startup.cs 的Configure 加上 header SAMEORIGIN 如下方程式碼

或是加上deny 不能同時加 同時加就會500

app.Use(async (context, next) =>
	{
	context.Response.Headers.Add("X-Frame-Options", "SAMEORIGIN");
	await next();
	});

沒有留言: