Skip to content
This repository has been archived by the owner on Nov 25, 2017. It is now read-only.

Add preload option #7

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

adelevie
Copy link

Depends on #6, but I probably could separate the two if you don't want the Docker PR.

@adelevie adelevie force-pushed the add-preload-option branch from 46514b4 to 2e34ed7 Compare March 26, 2017 15:41
Copy link
Contributor

@alex alex left a 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.

@adelevie
Copy link
Author

adelevie commented Aug 8, 2017

Good call. I'll remove and gitignore it.

Copy link
Contributor

@edmorley edmorley left a 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.
Copy link
Contributor

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/).

Copy link
Author

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
Copy link
Contributor

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? :-)

Copy link
Author

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']
Copy link
Contributor

@edmorley edmorley Aug 10, 2017

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()).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good!

@adelevie
Copy link
Author

Thanks for the review and feedback, @edmorley. Might take me a week or so to get around to these.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants