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

add https connection and allowed hosts check #1575

Merged
merged 9 commits into from
Dec 19, 2023
4 changes: 3 additions & 1 deletion website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,10 @@ def github_callback(request):
params = urllib.parse.urlencode(request.GET)
url = f"{settings.CALLBACK_URL_FOR_GITHUB}?{params}"
parsed_url = urlparse(url)
if parsed_url.netloc in ALLOWED_HOSTS:
if parsed_url.scheme == 'https' and parsed_url.netloc in ALLOWED_HOSTS:
return redirect(url)
else:
return HttpResponseNotFound('<h1>Page not found</h1>')


def google_callback(request):
Expand Down
Loading