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

Incorrect login redirect in some rare cases #4042

Open
joemull opened this issue Mar 19, 2024 · 0 comments
Open

Incorrect login redirect in some rare cases #4042

joemull opened this issue Mar 19, 2024 · 0 comments
Assignees
Labels
bug Something's not working medium t-shirt S Small

Comments

@joemull
Copy link
Member

joemull commented Mar 19, 2024

Problem

I was working on #3899 and realised that this function has a bug, though I don't think this code is ever run because we don't pass a string as login_redirect:

elif isinstance(login_redirect, str):
params = urlencode({"next": redirect})
return redirect('{0}?{1}'.format(reverse('core_login'), params))

Line 49 should have login_redirect, probably?

To reproduce

  1. In dev, set login_redirect to a string inside base_check.
  2. Log out and try to access the manager page.
  3. Inspect the URL.

Here's the pdb output:

> /home/joe/git/janepr/src/security/decorators.py(51)base_check()
-> params = urlencode({"next": redirect})
(Pdb) n
> /home/joe/git/janepr/src/security/decorators.py(52)base_check()
-> return redirect('{0}?{1}'.format(reverse('core_login'), params))
(Pdb) params
'next=%3Cfunction+redirect+at+0x7ff153f1b010%3E'
@joemull joemull added the bug Something's not working label Mar 19, 2024
@joemull joemull self-assigned this Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something's not working medium t-shirt S Small
Projects
None yet
Development

No branches or pull requests

1 participant