-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new content-security-policy-report-only header
Report any violations to the console and also to honeybadger, but don't actually block any violations. The eventual goal will be to replace our current content-security-policy header (currently configured in princeton_ansible) with the contents of the content-security-policy-report-only introduced in this commit. We can do that when we don't see many violations in Honeybadger.
- Loading branch information
1 parent
0b1b86f
commit 8e69549
Showing
2 changed files
with
33 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
require 'rails_helper' | ||
RSpec.describe 'Content Security Policy' do | ||
let(:directives) do | ||
get '/' | ||
response.headers['content-security-policy-report-only'].split(';').map(&:strip) | ||
end | ||
it 'allows libwizard to embed the catalog in an iframe' do | ||
frame_ancestors_directive = directives.find { |directive| directive.start_with? 'frame-ancestors'} | ||
expect(frame_ancestors_directive).to include('https://princeton.libwizard.com') | ||
end | ||
it 'allows the catalog to embed figgy in an iframe' do | ||
frame_src_directive = directives.find { |directive| directive.start_with? 'frame-src'} | ||
expect(frame_src_directive).to include('https://figgy.princeton.edu') | ||
end | ||
end |