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

Feature/704; Allow csp font locally #711

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
14 changes: 9 additions & 5 deletions config/initializers/content_security_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,23 @@
#
# :unsafe_eval, allows execution of eval statements
# :unsafe_inline, allows inline resources usage
FRONTEND_URL = 'http://localhost:4200'

policy.default_src :none unless Rails.env.development?
policy.font_src :self, "http://localhost:4200/text-security-disc-compat.eot?#iefix",
"http://localhost:4200/text-security-disc.woff2",
"http://localhost:4200/text-security-disc-compat.ttf"

policy.img_src :self
policy.connect_src :self, 'https://sentry.puzzle.ch'

policy.font_src :self
policy.font_src :self, :https, "#{FRONTEND_URL}/text-security-disc-compat.eot?#iefix",
"#{FRONTEND_URL}/text-security-disc.woff2",
"#{FRONTEND_URL}/text-security-disc-compat.ttf" if Rails.env.development?

policy.script_src :self
policy.script_src :self, :unsafe_eval, "http://localhost:4200" if Rails.env.development?
policy.script_src :self, :unsafe_eval, FRONTEND_URL if Rails.env.development?

policy.style_src :self, :unsafe_inline
policy.style_src :self, :unsafe_inline, "http://localhost:4200" if Rails.env.development?
policy.style_src :self, :unsafe_inline, FRONTEND_URL if Rails.env.development?

# If you are using webpack-dev-server then specify webpack-dev-server host
policy.connect_src :self, "http://localhost:3035", "ws://localhost:4200" if Rails.env.development?
Expand Down
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"ember-cli-app-version": "6.0.1",
"ember-cli-babel": "^7.26.11",
"ember-cli-clipboard": "1.0.0",
"ember-cli-cors": "^0.0.2",
"ember-cli-dependency-checker": "^3.3.2",
"ember-cli-htmlbars": "6.2.0",
"ember-cli-inject-live-reload": "^2.1.0",
Expand Down
Loading
Loading