We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 33fd6a0 commit 252b822Copy full SHA for 252b822
1 file changed
lib/middleware/security_headers.rb
@@ -28,9 +28,17 @@ def initialize(app)
28
@app = app
29
end
30
31
+ SIDEKIQ_CSP = "default-src 'self'; img-src 'self' data:; " \
32
+ "style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'".freeze
33
+
34
def call(env)
35
status, headers, body = @app.call(env)
- return [status, headers, body] if env['PATH_INFO'].start_with?('/sidekiq')
36
37
+ if env['PATH_INFO'].start_with?('/sidekiq')
38
+ headers.delete('Content-Security-Policy')
39
+ headers['Content-Security-Policy'] = SIDEKIQ_CSP
40
+ return [status, headers, body]
41
+ end
42
43
HEADERS.each { |key, value| headers[key] ||= value }
44
[status, headers, body]
0 commit comments