not-kennethreitz / flask-sslify

Force SSL on your Flask app.
https://pypi.python.org/pypi/Flask-SSLify
BSD 2-Clause "Simplified" License
503 stars 85 forks source link

allow abort #27

Closed buckhx closed 8 years ago

buckhx commented 9 years ago

abort(403) if an HTTP connection is made when expecting HTTPS

This will force clients to use HTTPS. If they added auth credentials in the params or body they would have been visible from the initial insecure request.

ryan-lane commented 9 years ago

This looks like a good feature. Would you mind rebasing your PR?

buckhx commented 9 years ago

Merged and tried to match the pattern followed by the other args

ryan-lane commented 9 years ago

I'd like to get @woodrow's input on this.

woodrow commented 9 years ago

This seems fine, though I've got a couple of suggestions that might make this even more user-friendly:

$ curl -i http://api.stripe.com
HTTP/1.0 403 Forbidden
Cache-Control: no-cache
Connection: close
Content-Type: application/json

{
  "error": {
    "message" : "The Stripe API is only accessible over HTTPS.  Please see <https://stripe.com/docs> for more information.",
    "type": "invalid_request_error"
  }
}
kennethreitz commented 8 years ago

I don't think this is a good solution to the problem you are trying to solve. A 4xx response will have the same effect as a 3xx response if sensitive data was being sent in the original request.

Thanks for submitting it, though!