mirror of https://github.com/docusealco/docuseal
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
401 B
16 lines
401 B
# 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
|