Skip to content

Commit 252b822

Browse files
committed
fix: solve aditional sidekiq csp
1 parent 33fd6a0 commit 252b822

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

lib/middleware/security_headers.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,17 @@ def initialize(app)
2828
@app = app
2929
end
3030

31+
SIDEKIQ_CSP = "default-src 'self'; img-src 'self' data:; " \
32+
"style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'".freeze
33+
3134
def call(env)
3235
status, headers, body = @app.call(env)
33-
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
3442

3543
HEADERS.each { |key, value| headers[key] ||= value }
3644
[status, headers, body]

0 commit comments

Comments
 (0)