Skip to content

Disable FLOC by introducing permissions policy header #8145

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

Merged
merged 1 commit into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dockerfiles/nginx/proxito.conf
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ server {
add_header Cache-Tag $cache_tag always;
set $referrer_policy $upstream_http_referrer_policy;
add_header Referrer-Policy $referrer_policy always;
set $permissions_policy $upstream_http_permissions_policy;
add_header Permissions-Policy $permissions_policy always;
}

# Serve 404 pages here
Expand Down
7 changes: 7 additions & 0 deletions readthedocs/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ class CommunityBaseSettings(Settings):
"/admin/",
)

# Permissions Policy
# https://github.com/adamchainz/django-permissions-policy
PERMISSIONS_POLICY = {
Copy link
Member

Choose a reason for hiding this comment

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

Is this something we can easily test? Would be good to have at least an integration test to make sure the setting, etc. is correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you thinking a validatehttp check? Or a pagerduty/CF check? I think those would be the best places for it.

Copy link
Member

Choose a reason for hiding this comment

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

I think a regular Django test + validatehttp are 💯

"interest-cohort": [],
}

# Read the Docs
READ_THE_DOCS_EXTENSIONS = ext
RTD_LATEST = 'latest'
Expand Down Expand Up @@ -228,6 +234,7 @@ def USE_PROMOS(self): # noqa
'corsheaders.middleware.CorsMiddleware',
'csp.middleware.CSPMiddleware',
'readthedocs.core.middleware.ReferrerPolicyMiddleware',
'django_permissions_policy.PermissionsPolicyMiddleware',
)

AUTHENTICATION_BACKENDS = (
Expand Down
2 changes: 2 additions & 0 deletions requirements/pip.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,5 @@ django-debug-toolbar==3.2.1

# For enabling content-security-policy
django-csp==3.7
# For setting the permissions-policy security header
django-permissions-policy==4.0.0