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

Improve HTTP security headers and proxify external requests #462

Closed
emanruse opened this issue Apr 1, 2019 · 17 comments
Closed

Improve HTTP security headers and proxify external requests #462

emanruse opened this issue Apr 1, 2019 · 17 comments
Labels
enhancement Improvement of an existing feature

Comments

@emanruse
Copy link

emanruse commented Apr 1, 2019

Currently invidio.us allows direct 3rd-party connections to (sub)domains of googlevideo.com. For improved privacy those can be proxified by making the backend part of invidio.us redirect the HTTP requests to the 3rd party host without exposing directly the viewer to Google. Then the user will connect only to invidio.us.

More details:

https://webbkoll.dataskydd.net/en/results?url=http%3A%2F%2Finvidio.us%2Fwatch%3Fv%3DC0DPdy98e4c

https://securityheaders.com/?q=https%3A%2F%2Finvidio.us%2Fwatch%3Fv%3DC0DPdy98e4c&hide=on&followRedirects=on

@Perflyst
Copy link
Contributor

Perflyst commented Apr 1, 2019 via email

@emanruse
Copy link
Author

emanruse commented Apr 1, 2019 via email

@omarroth
Copy link
Contributor

omarroth commented Apr 2, 2019

I believe this was mentioned in #34, but to re-iterate here: proxying /videoplayback URLs is more intensive for the site, so it's being rolled out more slowly to ensure there aren't any problems. I expect to change that to the default once I'm confident bandwidth won't be an issue.

@emanruse
Copy link
Author

emanruse commented Apr 2, 2019 via email

@omarroth
Copy link
Contributor

omarroth commented Apr 7, 2019

Added CSP, STS, and Referrer-Policy with a1b3b47.

Important to note is that max-age for Strict-Transport-Security is set to 1 week in order to address any problems before enabling preload.

In future please consider providing recommend action in addition to linking to a static report so it's easier to address.

@emanruse
Copy link
Author

emanruse commented Apr 7, 2019 via email

@omarroth omarroth added the enhancement Improvement of an existing feature label Apr 30, 2019
@omarroth
Copy link
Contributor

https://invidio.us is now preloaded.

Work for CSP is still in progress, as inline styles (among other things) are refactored.

Currently, securityheaders.com caps the grade at an A, since Invidious does not implement Feature-Policy, which is currently unavailable or experimental in all major browsers. Once there is an official spec expect support for this to be added.

Unless there are any other specific recommendations I believe this can be closed.

@emanruse
Copy link
Author

emanruse commented May 12, 2019 via email

@Perflyst
Copy link
Contributor

Of course there are third party requests while watching a video to googlevideo.com. You need to enable "proxy videos?" or add a &local=true to the uri to proxy the video through invidious.

@emanruse
Copy link
Author

emanruse commented May 13, 2019 via email

@Perflyst
Copy link
Contributor

Perflyst commented May 13, 2019 via email

@omarroth
Copy link
Contributor

omarroth commented May 13, 2019

I've already mentioned the reason for this above. The reason "proxy videos" is not enabled by default is because it's more bandwidth intensive for the site. "Proxy videos" is enabled by default for the official Tor instance, where privacy is more of a concern. You can enable it for your own instance with:

default_user_preferences:
  local: true

in config.yml.

CSP can be improved, but it doesn't need "fixing". As mentioned above refactoring inline styles and other assets will improve it.

Since no other recommendations for headers have been mentioned I'm going to close this.

@emanruse
Copy link
Author

emanruse commented May 14, 2019 via email

@emanruse
Copy link
Author

emanruse commented May 14, 2019 via email

@emanruse
Copy link
Author

@omarroth

"Proxy videos" is enabled by default for the official Tor instance

The Content-Security-Policy header is not different even for the Tor instance:

$ torsocks curl -I http://axqzx4s6s54s32yentfqojs3x5i7faxza6xo3ehd4bzzsg2ii4fv2iid.onion
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: text/html
X-Frame-Options: sameorigin
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Security-Policy: default-src blob: data: 'self' http://axqzx4s6s54s32yentfqojs3x5i7faxza6xo3ehd4bzzsg2ii4fv2iid.onion:8081 'unsafe-inline' 'unsafe-eval'; media-src blob: 'self' http://axqzx4s6s54s32yentfqojs3x5i7faxza6xo3ehd4bzzsg2ii4fv2iid.onion:8081 https://*.googlevideo.com:443
Referrer-Policy: same-origin
Content-Length: 0

$ curl -I https://invidio.us
HTTP/1.1 200 OK
Content-Type: text/html
X-Frame-Options: sameorigin
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Security-Policy: default-src blob: data: 'self' https://invidio.us 'unsafe-inline' 'unsafe-eval'; media-src blob: 'self' https://invidio.us https://*.googlevideo.com:443
Referrer-Policy: same-origin
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Content-Length: 0

@omarroth
Copy link
Contributor

omarroth commented May 17, 2019

The current issue is about the former and it is technically possible to have it.

It's absolutely technically possible if you're self-hosting and I've provided a configuration for it above. The reason why it's not enabled by default for the main instance is because it's impractical to provide for the current number of users. It is still provided as an option for users that would like to protect their privacy.

The Content-Security-Policy header is not different even for the Tor instance

My comment was in response to third-party requests. Watching videos through Tor will proxy them through the instance by default.

Since no other recommendations with headers have been mentioned I'm going to close this.

There have been.

I'm afraid you'll have to point them out to me. So far CSP and third-party requests have been mentioned and I believe have been addressed. If there is something else that falls under this issue then I'll be happy to reopen.

@emanruse
Copy link
Author

emanruse commented May 18, 2019 via email

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants