add security headers

pull/604/merge
Pete Matsyburka 1 month ago
parent 7fe56941fd
commit 6806772346

@ -9,6 +9,7 @@ module Api
before_action :set_cors_headers before_action :set_cors_headers
before_action :set_noindex_headers before_action :set_noindex_headers
before_action :set_security_headers
def show def show
blob_uuid, purp, exp = ApplicationRecord.signed_id_verifier.verified(params[:signed_uuid]) blob_uuid, purp, exp = ApplicationRecord.signed_id_verifier.verified(params[:signed_uuid])

@ -9,6 +9,7 @@ module Api
before_action :set_cors_headers before_action :set_cors_headers
before_action :set_noindex_headers before_action :set_noindex_headers
before_action :set_security_headers
# rubocop:disable Metrics # rubocop:disable Metrics
def show def show

@ -102,6 +102,10 @@ module Api
headers['X-Robots-Tag'] = 'noindex' headers['X-Robots-Tag'] = 'noindex'
end end
def set_security_headers
response.headers['X-Content-Type-Options'] = 'nosniff'
end
def set_cors_headers def set_cors_headers
headers['Access-Control-Allow-Origin'] = '*' headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, PATCH, DELETE, OPTIONS' headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, PATCH, DELETE, OPTIONS'

@ -25,6 +25,14 @@ module DocuSeal
config.active_storage.draw_routes = ENV['MULTITENANT'] != 'true' config.active_storage.draw_routes = ENV['MULTITENANT'] != 'true'
config.active_storage.content_types_to_serve_as_binary += %w[
application/javascript
text/javascript
application/ecmascript
text/ecmascript
application/wasm
]
config.i18n.available_locales = %i[en en-US en-GB es-ES fr-FR pt-PT de-DE it-IT nl-NL config.i18n.available_locales = %i[en en-US en-GB es-ES fr-FR pt-PT de-DE it-IT nl-NL
es it de fr nl pl uk cs pt he ar ko ja] es it de fr nl pl uk cs pt he ar ko ja]
config.i18n.fallbacks = [:en] config.i18n.fallbacks = [:en]

Loading…
Cancel
Save