Merge pull request #2 from vshaveyko/embed-csp-multi-origin

CSP: allow multiple EMBED_ALLOWED_ORIGIN values
pull/697/head
Vs 2 months ago committed by GitHub
commit aa1eb1413c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -147,10 +147,14 @@ class ApplicationController < ActionController::Base
policy.directives['connect-src'] << 'ws:' if Rails.env.development? policy.directives['connect-src'] << 'ws:' if Rails.env.development?
# Allow the embedding app (set via EMBED_ALLOWED_ORIGIN) to iframe # Allow the embedding app(s) to iframe this DocuSeal instance. Required
# this DocuSeal instance. Required by the self-hosted JWT shim in # by the self-hosted JWT embed (embed_scripts_controller.rb + the
# `embed_scripts_controller.rb`. # token-auth EmbedBuilderController). EMBED_ALLOWED_ORIGIN may list
policy.frame_ancestors :self, ENV['EMBED_ALLOWED_ORIGIN'] if ENV['EMBED_ALLOWED_ORIGIN'].present? # several space-separated origins (e.g. an apex plus an app subdomain:
# "https://example.com https://app.example.com") — each becomes its own
# frame-ancestors source.
embed_origins = ENV['EMBED_ALLOWED_ORIGIN'].to_s.split
policy.frame_ancestors(:self, *embed_origins) if embed_origins.any?
end end
end end
end end

Loading…
Cancel
Save