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

Add CSP frame-ancestors, make X-Frame-Options conditional #977

Merged
merged 4 commits into from
May 19, 2018
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### HEAD
* Add CSP `frame-ancestors`, make `X-Frame-Options` conditional ([#977](https://github.com/roots/trellis/pull/977))
* Common: Install `git` instead of `git-core` ([#989](https://github.com/roots/trellis/pull/989))
* Add `xdebug.remote_autostart` to simplify xdebug sessions ([#985](https://github.com/roots/trellis/pull/985))
* Enable nginx to start on boot ([#980](https://github.com/roots/trellis/pull/980))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The X-Frame-Options header indicates whether a browser should be allowed
# to render a page within a frame or iframe.
add_header X-Frame-Options SAMEORIGIN always;
# add_header X-Frame-Options SAMEORIGIN always;

# MIME type sniffing security protection
# There are very few edge cases where you wouldn't want this enabled.
Expand Down
14 changes: 14 additions & 0 deletions roles/wordpress-setup/templates/wordpress-site.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,20 @@ server {

{% endblock %}

{% block embed_security -%}
{% if item.value.nginx_embed_security | default(nginx_embed_security | default(true)) -%}
add_header Content-Security-Policy "frame-ancestors 'self'" always;

# Conditional X-Frame-Options until https://core.trac.wordpress.org/ticket/40020 is resolved
set $x_frame_options SAMEORIGIN;
if ($arg_customize_changeset_uuid) {
set $x_frame_options "";
}
add_header X-Frame-Options $x_frame_options always;

{% endif -%}
{% endblock -%}

{% block location_php -%}
location ~ \.php$ {
{% block location_php_basic -%}
Expand Down