question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: Cookie settings (HttpOnly, Secure)

See original GitHub issue

Hi,

I’m using external-auth-server together with Kubernetes and Traefik v2.1. It’s really simple to configure and use.

I had, actually still have one issue which took me hours to find out why it happens exactly. In my case, I have Home-Assistant as the service which should be protected by external-auth-server. This application is a progressive web app (PWA) which means, it uses service-worker quite heavily. So, each initial authentication process was working fine (clean browser or incognito tab), because there was no Service Worker in place. After an hour (the token expired), I get redirected to Google for another sign in. But this time the final cookie cannot be set or read and the requests ends in a 503-error.

I guess the issue behind is that the two cookies’ set have the flag httpOnly. This disallows the service-worker from getting/setting the cookies. But I’m not absolutely sure whether this is the only problem. But if I tick the option Bypass for network in the Chrome debug tools, then everything is working fine.

Is there already such an option to configure which flags should be set by external-auth-server? If not, would this be a huge task? I know I will lose a bit of security by not setting this flag. But I don’t see any other possibility. On the other hand, I’m not very experienced with service-workers.

Thank you. Best Danny

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:19 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
travisghansencommented, Feb 7, 2020

Ok yeah. The next branch already makes it configurable for the non-csrf cookie. I’ll add the sameSite in there as well and add config options for the csrf stuff as well as it appears needed.

1reaction
mlushpenkocommented, Feb 6, 2020

https://www.troyhunt.com/promiscuous-cookies-and-their-impending-death-via-the-samesite-policy/

New chrome release is coming, so SameSite is also needed for single sign-on scenarios, was about to open an issue but found this one 😃

My colleague just added SameSite and Secure here https://github.com/travisghansen/external-auth-server/blob/af3ae4a462f1cb0281d57db868c51b95b961e6f2/src/plugin/oauth/index.js#L441 and in scrf cookie and seems to be working fine (maybe a bit more testing is needed, but initially looks good)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using HTTP cookies - MDN Web Docs
A cookie with the Secure attribute is only sent to the server with an encrypted request over the HTTPS protocol. It's never sent...
Read more >
HttpOnly - OWASP Foundation
Using the HttpOnly flag when generating a cookie helps mitigate the risk of client side script accessing the protected cookie (if the browser...
Read more >
What is an HttpOnly Cookie? - Knowledge Base - CookiePro
An HttpOnly Cookie is a tag added to a browser cookie that prevents client-side scripts from accessing data.
Read more >
Secure, HttpOnly, SameSite HTTP Cookies Attributes and Set ...
Secure attribute is more straight-forward to understand. A Secure cookie is only sent to the server with an encrypted request over the HTTPS ......
Read more >
Securing cookies with httponly and secure flags [updated 2020]
Security of cookies is an important subject. HttpOnly and secure flags can be used to make the cookies more secure. When a secure...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found