Skip to content

Commit

Permalink
Allow validation of cross-domain redirects (certbot#3561)
Browse files Browse the repository at this point in the history
* Update compatibility validator to pass redirect check when redirecting to a different domain, whether http or https.
  • Loading branch information
ohemorange authored Sep 29, 2016
1 parent 769ebfc commit 5fda61f
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,15 @@ def redirect(self, name, port=80, headers=None):
return False

redirect_location = response.headers.get("location", "")
# We're checking that the redirect we added behaves correctly.
# It's okay for some server configuration to redirect to an
# http URL, as long as it's on some other domain.
if not redirect_location.startswith("https://"):
return False
if not redirect_location.startswith("http://"):
return False
else:
if redirect_location[len("http://"):] == name:
return False

if response.status_code != 301:
logger.error("Server did not redirect with permanent code")
Expand Down

0 comments on commit 5fda61f

Please sign in to comment.