-
Notifications
You must be signed in to change notification settings - Fork 670
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
[BUG] Error creating secure cookie, caused by: securecookie: the value is too long #3750
Comments
Same issue here. |
@yubofredwang Is this a consistent behavior across users? |
@In0ut you can remove some claims from you id token to reduce the size. For me, I removed groups from the id token. @davidmirror-ops yes, this is consistent |
@yubofredwang Thanks I am going to try it |
I am experiencing the same problem and i've tried to emit groups from the token but it still says the token is too long. |
played around with this a bit. I was wondering if not using encryption would shorten the cookie size at all and it does but not by much. You can change the cookie limit actually above the 4096 but that's actually the limit on a lot of browsers, so really shouldn't change that. I think the only thing to do unf is to try to look at the token that's coming back from your idp and seeing what can be shortened. You can also add an option to remove the secure cookie component entirely if you'd like, but not sure how i feel about that. definitely worth bringing up to a wider audience first. are azure tokens that much longer than okta's? Can you paste an example? (redacted ofc, but without changing length)
|
For background, the reason these are encrypted is because flyte admin might be hosted on the same domain as other apps. If those other apps share the same idp, then logging into flyte will unlock access to other applications as well. This is not secure behavior so it's protected on the user/browser side by encrypting it with something only flyte knows about. Someone would have to check to make sure, but likely only the user id portion of the jwt is used. One possible solution to this is to just encrypt and store the user id, or whatever portion of the jwt that's used rather than the whole thing. this would shorten the cookie considerably. |
I am currently doing a fix in our internal fork but would like to see how @wild-endeavor thinks about the solution. Essentially, we are splitting up the access tokens into two and store them in two separate cookies. (flyte_at has the first half, flyte_at_1 has the second half). I can generalize this to handle token of arbitrary length by splitting into small cookies. Do you think that sounds like a valid solution to the community? |
I think it's the only real solution (besides storing in LocalStorage or something instead). Azure AD tokens for example are always huge even without all the groups. |
@yubofredwang @wild-endeavor As other Azure users are hitting the same issue, I was wondering If we could resume the discussion and see if we can work out a solution? |
We get exact the same issue when trying to use Azure AD for OIDC. I wonder why the cookie limit is relevant because the length of the query string is less than 1200 chars. Debug output of the RequestURI shows UTF-representation of the ampersand \0026 (instead of &) which looks strange. |
hey guys, for this issue, the cause is "github.com/gorilla/securecookie"'s hash function will generate a hashed token that exceeds the limit of 4096 of cookie size limit of browsers, which means the original query string might not exceed the limit but the encoded string does. Our internal solution is: split the hashed the access token into 2 cookies and combine them when fetching. It worked fine for us so we didn't really investigate on a more formal solution. |
Hi @yubofredwang ! We are encountering the same issue. Is your solution something that you could upstream as contribution or share the implemented solution with me? PS: Do you know a way to unblock the situation when the issue happens? |
sure, let me see if I can create a PR in a day or two. you can copy the code from the PR and apply locally. Should not be too complicated. @wild-endeavor @pingsutw what do you guys think? |
That would be amazing @yubofredwang :) |
@gdabisias sorry responding a little late due to work. Please refer to #4863 for a sample implmentation |
nice, thanks. @davidmirror-ops can we get this in so that we can then just have this in the next release? |
Describe the bug
When I use the AzureAD + OpenID for flyte authentication. The id token is too large to be stored in the cookie store. Thus, it will error out as:
User's authentication will fail.
Expected behavior
User should be able to authenticate.
Additional context to reproduce
No response
Screenshots
No response
Are you sure this issue hasn't been raised already?
Have you read the Code of Conduct?
The text was updated successfully, but these errors were encountered: