diff --git a/website/views.py b/website/views.py index 03c18be5c..44316768a 100644 --- a/website/views.py +++ b/website/views.py @@ -168,8 +168,12 @@ def index(request, template="index.html"): def github_callback(request): + ALLOWED_HOSTS = ['github.com'] params = urllib.parse.urlencode(request.GET) - return redirect(f"{settings.CALLBACK_URL_FOR_GITHUB}?{params}") + url = f"{settings.CALLBACK_URL_FOR_GITHUB}?{params}" + parsed_url = urlparse(url) + if parsed_url.netloc in ALLOWED_HOSTS: + return redirect(url) def google_callback(request):