-
Notifications
You must be signed in to change notification settings - Fork 3
Add preload option #7
base: master
Are you sure you want to change the base?
Conversation
46514b4
to
2e34ed7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code looks good to me, I skimmed over the docker bits.
I don't think you want to check .cache/
in though, that's a local py.test
thing.
Good call. I'll remove and gitignore it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Thank you for the PR :-)
I've just landed a few things on master (Travis support, flake8 config, ...) - I don't suppose you could rebase and also add an entry to the new changelog in the README (perhaps under a new version section called "Unreleased")?
@@ -48,8 +48,26 @@ You can pass some keyword arguments to `sslify` to control its behavior: | |||
* `proxy_header` (default: `X-Forwarded-Proto`) - for services behind a proxy, | |||
this is the name of the header that contains the *real* request scheme. | |||
|
|||
* `preload` (default: 'False') - adds the "preload" directive. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about something like this to give a bit more context?
adds the `preload` directive, which is required for inclusion on the [HSTS preload list](https://hstspreload.appspot.com/).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -0,0 +1,10 @@ | |||
FROM python:3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind separating the Docker part out of this PR? :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't mind at all!
env['wsgi.url_scheme'] = 'https' | ||
app_iter, status, headers = run_wsgi_app(app, env) | ||
assert status == '200 OK' | ||
assert 'preload' in headers['Strict-Transport-Security'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be best to validate the entire header, rather than just that the "preload" string exists in it? (Like the test above does)
For example the header max-age=123 preload
would pass this test, but be ignored by browsers (due to lack of ;
delimiter) according to the spec:
https://tools.ietf.org/html/rfc6797#section-6.1
In addition it may be worth also adding a second test, that confirms both subdomains=True
and preload=True
can be set at the same time (named something like test_hsts_all_options_combined()
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good!
Thanks for the review and feedback, @edmorley. Might take me a week or so to get around to these. |
Depends on #6, but I probably could separate the two if you don't want the Docker PR.