This commit is contained in:
Pete Matsyburka
2025-09-24 12:07:54 +03:00
parent f4426a8ee0
commit b64a84a362
51 changed files with 725 additions and 147 deletions
+15
View File
@@ -0,0 +1,15 @@
# frozen_string_literal: true
class CspController < ActionController::API
FILTER_REPORT_REGEXP = /extension|sandbox/i
SANITIZE_REGEXP = %r{(/[sdep]/)(\w{5})[^/"]+}
def create
data = request.raw_post.gsub(SANITIZE_REGEXP, '\1\2')
Rails.logger.warn(data) if Rails.env.development?
Rollbar.warning('CSP', data:) if defined?(Rollbar) && !data.match?(FILTER_REPORT_REGEXP)
end
end