Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added HttpOnly to all cookies #3170

Merged
merged 2 commits into from
Jul 29, 2016
Merged

Added HttpOnly to all cookies #3170

merged 2 commits into from
Jul 29, 2016

Conversation

scottbommarito
Copy link
Contributor

https://devdiv.visualstudio.com/DevDiv/_workitems?id=244714&_a=edit

Not sure how necessary any of this is, but now every usage of HttpCookie sets HttpOnly to true.

@dnfclas
Copy link

dnfclas commented Jul 28, 2016

Hi @scottbommarito, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by .NET Foundation and real humans are currently evaluating your PR.

TTYL, DNFBOT;

@maartenba
Copy link
Contributor

Some reading material: https://www.troyhunt.com/c-is-for-cookie-h-is-for-hacker/

Seems good, although we may want to set it in Web.config instead?

@scottbommarito
Copy link
Contributor Author

@maartenba Added it to the Web.config.

Do we want to add <httpCookies requireSSL="true" /> as well?

@scottbommarito
Copy link
Contributor Author

(forgot to tag people)
@skofman1 @shishirx34 @ryuyu

@@ -52,7 +52,9 @@ public FormsAuthenticationService(IAppConfiguration configuration)
if (_configuration.RequireSSL)
{
// Drop a second cookie indicating that the user is logged in via SSL (no secret data, just tells us to redirect them to SSL)
context.Response.Cookies.Add(new HttpCookie(ForceSSLCookieName, "true"));
HttpCookie responseCookie = new HttpCookie(ForceSSLCookieName, "true");
responseCookie.HttpOnly = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you still need to specify this here and above after making change in web.config?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically no, but it doesn't hurt to be extra cautious.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If its not required no point in adding it. I would prefer it be removed and declared at single position. Keeps it easy to maintain.

@shishirx34
Copy link
Contributor

Looks good.

@maartenba
Copy link
Contributor

:shipit:

@maartenba maartenba mentioned this pull request Jul 29, 2016
5 tasks
@scottbommarito scottbommarito merged commit cc94688 into dev Jul 29, 2016
@scottbommarito scottbommarito deleted the scottbom-cookiemonster branch July 29, 2016 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants