Add manifest_src to CSP, add blob to connect_src (#8967)
This commit is contained in:
		
							parent
							
								
									9d4541c612
								
							
						
					
					
						commit
						8ab081ec32
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
					@ -15,14 +15,15 @@ Rails.application.config.content_security_policy do |p|
 | 
				
			||||||
  p.style_src       :self, :unsafe_inline, assets_host
 | 
					  p.style_src       :self, :unsafe_inline, assets_host
 | 
				
			||||||
  p.media_src       :self, :https, :data, assets_host
 | 
					  p.media_src       :self, :https, :data, assets_host
 | 
				
			||||||
  p.frame_src       :self, :https
 | 
					  p.frame_src       :self, :https
 | 
				
			||||||
 | 
					  p.manifest_src    :self, assets_host
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if Rails.env.development?
 | 
					  if Rails.env.development?
 | 
				
			||||||
    webpacker_urls = %w(ws http).map { |protocol| "#{protocol}#{Webpacker.dev_server.https? ? 's' : ''}://#{Webpacker.dev_server.host_with_port}" }
 | 
					    webpacker_urls = %w(ws http).map { |protocol| "#{protocol}#{Webpacker.dev_server.https? ? 's' : ''}://#{Webpacker.dev_server.host_with_port}" }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    p.connect_src :self, assets_host, Rails.configuration.x.streaming_api_base_url, *webpacker_urls
 | 
					    p.connect_src :self, :blob, assets_host, Rails.configuration.x.streaming_api_base_url, *webpacker_urls
 | 
				
			||||||
    p.script_src  :self, :unsafe_inline, :unsafe_eval, assets_host
 | 
					    p.script_src  :self, :unsafe_inline, :unsafe_eval, assets_host
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
    p.connect_src :self, assets_host, Rails.configuration.x.streaming_api_base_url
 | 
					    p.connect_src :self, :blob, assets_host, Rails.configuration.x.streaming_api_base_url
 | 
				
			||||||
    p.script_src  :self, assets_host
 | 
					    p.script_src  :self, assets_host
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue