Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement feature-policy #988

Closed
tunetheweb opened this issue Jul 9, 2020 · 4 comments · Fixed by #1003
Closed

Implement feature-policy #988

tunetheweb opened this issue Jul 9, 2020 · 4 comments · Fixed by #1003
Labels
development Building the Almanac tech stack enhancement New feature or request good first issue Good for newcomers

Comments

@tunetheweb
Copy link
Member

Feature Policy is a relatively new feature were sites can send an HTTP header to tell the browser which powerful APIs are not used by this site and so you can say shouldn't be allowed. More info in this Smashing Magazine article.

This offers good protection for users so a third-party ad for example can't ask for location - which is bad for privacy and also bad for UX (as browsers may show up a pop up asking for permission before allowing it.

We don't use a lot of third-party scripts so think risk for us is low, but on other hand that means implementation risk (and effort) is also low. And we've been implementing other best practices on this site so think this would be a good one. Also its usage is likely to grow in future.

As we don't use any of these powerful APIs at the moment I'd suggest we go for a fairly restrictive Feature Policy, like below:

feature-policy: accelerometer 'none'; camera 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; payment 'none'; usb 'none'

I've implemented that (or a slight variety of that) on sites I manage with no issues.

This is fully supported by the flask-talisman security library we use so should be easy to implement.

@tunetheweb tunetheweb added enhancement New feature or request good first issue Good for newcomers development Building the Almanac tech stack labels Jul 9, 2020
@tunetheweb tunetheweb added this to the 2020 Platform Development milestone Jul 9, 2020
@rviscomi
Copy link
Member

rviscomi commented Jul 9, 2020

Should be a no-op, right? Seems like a good idea to me.

@tunetheweb
Copy link
Member Author

It should have no-impact and not require any further thought after implementing if that’s what you mean?

So only impact is time to write this (very small - basically config for flask-talisman), extra code in our code-base (very small) and if some future feature needs one of these APIs then will have to tweak our feature policy to allow it.

@tunetheweb
Copy link
Member Author

Securityheaders.com now gives us a nice green A grade:

Screenshot of securityheaders.com for almanac.httparchive.org showing all green

Aiming for an A+ with #1010 😀

@paulcalvano
Copy link
Contributor

Nice. Looks like that did it :).
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Building the Almanac tech stack enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants