#5249 Drop the ssh key from the information stored in the cookie
Merged 3 years ago by ngompa. Opened 3 years ago by pingou.

file modified
+5
@@ -152,4 +152,9 @@ 

      except pagure.exceptions.PagureException as err:

          flask.flash(str(err), "error")

  

+     if flask.g.fas_user.get("ssh_key"):

+         del(flask.g.fas_user.ssh_key)

+     if flask.session.get("FLASK_FAS_OPENID_USER").get("ssh_key"):

+         del(flask.session["FLASK_FAS_OPENID_USER"]["ssh_key"])

+ 

      return flask.redirect(return_url)

Some ssh keys can be very long or some users can have multiple ssh keys,
either can result in a significant amount of data stored in the cookie
and in some cases too much information. If it goes above the limit for
cookie size, the browser will not store the cookie leading to pagure
considering the user is not authenticated.
This then becomes really confusing. The user goes to a page that
requires authentication, they are redirected to the authentication
server, there they log in, they're sent back to pagure that set-ups the
user, they are then redirected to the page they were trying to access in
the first place, but since the cookie didn't stick, pagure considers
them not authenticated and sends them back to the authentication server
and we're entering a loop of redirects between pagure and the
authentication server, neither of which are producing an
error/stacktrace that would give some clues to the admins.

However, it turns out that pagure only uses the ssh key information to
set-up the user on the pagure side right after authentication. So there
is absolutely no need to keep that information in memory or in the
cookie. We can thus, safely, drop that information frome the cookie
which in turns, breaks the issue described above.

Signed-off-by: Pierre-Yves Chibon pingou@pingoured.fr

rebased onto 4b027ce3cca2ae2fc6ae7833e8a9e44fc9a07511

3 years ago

pretty please pagure-ci rebuild

3 years ago

rebased onto 3beb56acdbd2e39e4df561833fc356046f099625

3 years ago

rebased onto 512f23f

3 years ago

Pull-Request has been merged by ngompa

3 years ago
Metadata