-
Notifications
You must be signed in to change notification settings - Fork 327
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
Support larger session cookie #348
Comments
@alirazeen thanks for the kind words To clarify the URL is saved in a session cookie, not on the server. please review #109 and other items in the issues related to "cookie size" |
MaxLength
property in securecookie
?
Ah, got it. I overlooked something while I was looking at which browser cookies were being set by Vouch and didn't see the session cookie. In #109, you made an offhand remark that there might not be a need to set the domain on the session cookie. Why is it being done this way now? Isn't it enough for the session cookie to be set to the vouch domain? Are there situations where it's better to have the session cookie set to the original URL the user tried to visit? |
@nicholac could you please edit your post in the manner described in the README |
@bnfinet - Apos & thanks for checking - all formatted etc as per README in gist here: https://gist.github.com/nicholac/e980beefcfa9bde0bc54eb6f93513ab6 |
@nicholac thanks for doing that
How long is the URL you're trying to store? I just want to confirm that we're running into this same issue. |
Full URL at line 76 is 18 chars: Full URL at line 90 is 1677 chars: https://localhost/auth?code=<1561 chars>&state=O9RuclIZi44VvoSUzPECXnO6fW2wYG&session_state=26f0d197-8a08-4d66-b3a7-64da1f9b11ce I'd be happy to help out with a PR, but cant say I really know enough Go to contribute effectively. |
@bnfinet - Any pointers on the above & how we can get it to work with Azure OIDC? |
Reproducing this error with a MediaWiki installation. MediaWiki has some very long URLs that load static assets, such as I'm just hazarding a guess that it's one of those URLs that triggers it. Because what's weird is I can't reliably reproduce it. After an apparently random number of refreshes I trip the problem, then I can't again for ages. Obviously the main pages are much shorter URLs, but as I understand it, even 'assets' get passed through the Do we know how many characters crosses the threshold for the 'value is too long' message to occur? (which I have seen has come up in other projects: auth0-samples/auth0-golang-web-app#4, solo-io/gloo-portal-issues#56, markbates/goth#133 ) |
I am experiencing this issue using a Grafana dashboard URL that is 1800 characters long, using the google oauth provider and using Google Chrome version 111 on Linux. I can reproduce it 100% reliably. If I try to visit the URL, I consistently get a 400 Bad Request page from Vouch. In the logs, I see the following errors:
If I trim the URL down to 1600 characters (from 1800), I consistently get a "502 Bad Gateway" error from nginx. In vouch, the only error that I see logged is
Interestingly, if I trim the URL down to 1500 characters, I consistently see the "400 Bad Request" page from Vouch again. In the logs, I see:
(The "no destination URL requested" looks new.) If I trim it down to 1400 characters, I consistently get the 502 Bad Gateway page again:
At 1300 characters, we're back to "400 Bad Request" again (this alternating between vouch<->nginx as I decrease the URL length is very interesting/weird; maybe it is related to the browser's cookie eviction policy or something like that) At 1200 characters, the page loads without any issues. I only decreased the character count by 100 at a time, but it seems the max URL length is somewhere between 1200-1300 chars. I am not sure if this is directly related to a browser-imposed limit on cookie size, or if it also depends on the size of other cookies (e.g. JWT cookie / VouchCookie etc. - I haven't fully grokked how all these cookies work yet) |
@bduffany thanks for confirming, PR welcome Configuring the size of the session cookie beyond default 4096 sounds like it's worth trying |
Hello! First, I'd like to thank the authors of this very useful project!
I have a suggestion. I have noticed that when a user visits a vouch-protected site, and the URL is very long, completing the oauth flow will result in a
400 Bad Request
. I suspect it's because the initial session state is not saved correctly. I see the following log lines from vouch:Digging through the code and the Gorilla
sessions
andsecurecookie
packages, it looks like thesecurecookie
package lets you set theMaxLength
property for cookies. By default, it's set to 4096 bytes.From my understanding, these sessions are saved on the vouch server. If so, would it be possible to somehow expose the
MaxLength
option from thesecurecookie
package so that we can change it in the vouch config? That way, the users of the vouch-protected site will not have to resort to any workarounds. The current workaround is:The text was updated successfully, but these errors were encountered: