Skip to content

Support larger session cookie #348

Description

@alirazeen

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:

{"level":"debug","ts":1610000281.386837,"msg":"raw URL is https://<LONG_REDACTED_URL>"}
{"level":"debug","ts":1610000281.3869734,"msg":"session requestedURL set to <LONG_REDACTED_URL>"}
{"level":"debug","ts":1610000281.386992,"msg":"saving session with failcount 1"}
{"level":"error","ts":1610000281.3871233,"msg":"securecookie: the value is too long"}
{"level":"debug","ts":1610000281.3871434,"msg":"redirecting to oauthURL <OAUTH_ENDPOINT>"}

Digging through the code and the Gorilla sessions and securecookie packages, it looks like the securecookie package lets you set the MaxLength 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 the securecookie 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:

  1. Initiate the first login to the site using a short URL.
  2. On successful login, use the long URL.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions