diff options
Diffstat (limited to '')
| -rw-r--r-- | webmentions_ssg/views.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/webmentions_ssg/views.py b/webmentions_ssg/views.py index d411296..cef81fc 100644 --- a/webmentions_ssg/views.py +++ b/webmentions_ssg/views.py @@ -6,7 +6,6 @@ import uuid from typing import cast -from urllib.parse import urlsplit import sqlalchemy as sa import sqlalchemy.exc as sa_exc @@ -30,6 +29,7 @@ from .models import ReceivedWebmention, SentWebmention, Source, User from .tasks.receiver import verify_webmention from .tasks.scanner import manual_scan_sources from .tasks.sender import send_webmention +from .url_security import is_safe_next_url root_page = Blueprint("root", __name__) @@ -72,10 +72,10 @@ def login() -> ResponseReturnValue: login_user(user) - next_page = request.args.get("next") - if not next_page or urlsplit(next_page).netloc != "": - next_page = url_for("root.index") - return redirect(next_page) + next_url = request.args.get("next") + if not next_url or not is_safe_next_url(next_url): + next_url = url_for("root.index") + return redirect(next_url) return render_template("login.html", form=form) |
