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

UI should use authorization header instead of cookie #2085

Open
jessesuen opened this issue Aug 2, 2019 · 12 comments
Open

UI should use authorization header instead of cookie #2085

jessesuen opened this issue Aug 2, 2019 · 12 comments
Labels
component:ui User interfaces bugs and enhancements enhancement New feature or request security Security related

Comments

@jessesuen
Copy link
Member

jessesuen commented Aug 2, 2019

Following #1642, the UI should switch to authenticating calls using HTTP Authorization headers instead of a cookie.

This will allow us to double the size of the JWT token to 8KB (from 4KB), which users hitting when attempting to login and they are a member of too many groups.

@jessesuen jessesuen added enhancement New feature or request ui labels Aug 2, 2019
@jessesuen jessesuen added this to the v1.3 milestone Aug 2, 2019
@alexec
Copy link
Contributor

alexec commented Aug 6, 2019

How do you imagine logon working for this for UI users? HTTP Basic?

@alexec alexec self-assigned this Aug 8, 2019
@alexec alexec removed this from the v1.3 milestone Sep 6, 2019
@alexec
Copy link
Contributor

alexec commented Sep 6, 2019

I've taken this out of v1.3. I think we have mitigated for the time being.

@alexec alexec removed their assignment Sep 9, 2019
@alexec alexec added the wontfix This will not be worked on label Oct 2, 2019
@jannfis
Copy link
Member

jannfis commented Oct 22, 2019

@jessesuen @alexec How do we proceed with this topic? If we don't switch from authentication cookie to authentication header in the UI, then we really should implement additional CSRF protection for the API when being used by a browser which sends cookies (even if we now have SameSite attribute on the authentication cookie). If this issue stays wontfix, I'll start working on implementing proper CSRF protection using something like gorilla-csrf, but I really don't want to do this for the trashcan - i.e. if we switch from cookie to auth header.

@alexmt
Copy link
Collaborator

alexmt commented Oct 22, 2019

If we stop using cookie than UI will have to store token somewhere else. The local storage is definitely not secure. Honestly, I don't which other options are available.

I would keep using cookie in UI and implement CSRF protection.

@alexec
Copy link
Contributor

alexec commented Oct 22, 2019

@alexmt
Copy link
Collaborator

alexmt commented Oct 22, 2019

I've never heard about CSP before. Briefly checked this link from plugin readme: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy . Seems like CSP allows to control which files browser can load for the page. I could not figure out how it helps to store token. @alexec Am I missing something?

@alexec alexec removed the usability label Oct 24, 2019
@alexmt alexmt removed the wontfix This will not be worked on label Jan 27, 2020
@davidkarlsen
Copy link
Contributor

davidkarlsen commented Feb 17, 2020

Isn't session-storage safe? https://stackoverflow.com/questions/5523140/html5-local-storage-vs-session-storage

@mhamann
Copy link

mhamann commented Feb 18, 2020

What about converting to session IDs that are associated with a JWT stored on the server? Cookies are a good solution, but in my experience, storing JWTs in cookies isn't great. Session IDs are much more compact.

@davidkarlsen
Copy link
Contributor

@mhamann you then need a server-side session-store to have the link between sessionId and token (which has the claims) - leading to server-side state, which requires a store like redis or similar and also influences scalability (maybe not a big issue though)

@jannfis jannfis added component:ui User interfaces bugs and enhancements security Security related labels May 14, 2020
@RichiCoder1
Copy link

It'd be a bit more complicated, but another answer might be "chunking" the JWT, or splitting it across multiple cookies and then stitching it back together if it's larger then the 4k limit. That's how AspNet Core manages it.

@alexmt
Copy link
Collaborator

alexmt commented Aug 26, 2020

Ah, that is awesome suggestion @RichiCoder1 ! I really like it. It might be much easier to do because all the logic resides on server side.

@pranaypathik
Copy link

Ah, that is awesome suggestion @RichiCoder1 ! I really like it. It might be much easier to do because all the logic resides on server side.

I was wondering if this was still looked into. I was very interested in a fix for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:ui User interfaces bugs and enhancements enhancement New feature or request security Security related
Projects
None yet
Development

No branches or pull requests

8 participants