Skip to content

Adds login redirect after authentication#1683

Open
neurocis wants to merge 1 commit into
agent0ai:readyfrom
neurocis:feat/login-forward
Open

Adds login redirect after authentication#1683
neurocis wants to merge 1 commit into
agent0ai:readyfrom
neurocis:feat/login-forward

Conversation

@neurocis
Copy link
Copy Markdown
Contributor

Pushing to main as development seems stale atm.

Improves user experience by redirecting users to their intended page upon successful login. Implements secure URL validation to prevent open redirect vulnerabilities and supports both server-side and client-side redirects.

How to Test

  1. Log out and attempt to access a protected page; verify redirection to login with a next parameter.
  2. Log in successfully; confirm automatic redirection to the original protected page.
  3. Test with a malicious next URL to ensure redirection only occurs to safe, same-origin paths.

Breaking Changes

None.

@3clyp50 3clyp50 changed the base branch from main to ready June 1, 2026 17:06
Copy link
Copy Markdown
Contributor

@3clyp50 3clyp50 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the UX improvement. I rebased this locally onto ready; there is one blocker before merge: the redirect safety check still allows a backslash open-redirect form.

Comment thread helpers/api.py
"""Return True when value is a safe same-origin redirect target."""
if not value:
return False
if "\r" in value or "\n" in value:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also reject \. next=/%5Cevil.example passes validation, Flask sends Location: /\evil.example, and browsers normalize that to an external navigation. Please add a regression test for this case too.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants