Skip to content

Commit

Permalink
Added 'SameSite=Strict' cookie attribute, reducing overall CSRF attac…
Browse files Browse the repository at this point in the history
…k surface
  • Loading branch information
0xLanks authored and 0xLanks committed May 5, 2022
1 parent 11b9f17 commit 4033c72
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions BlogEngine/BlogEngine.NET/Global.asax
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,17 @@
{
BlogEngineConfig.SetCulture(sender, e);
}
protected void Application_PreSendRequestHeaders ()
{
var httpContext = HttpContext.Current;
if (httpContext != null) {
var cookieValueSuffix = "; SameSite=Strict";
var cookies = httpContext.Response.Cookies;
for (var i = 0; i < cookies.Count; i++)
{
var cookie = cookies[i]; cookie.Value += cookieValueSuffix;
}
}
}
</script>

0 comments on commit 4033c72

Please sign in to comment.