From 1e0db8afb720241d3985ec39f8d448d7a97742db Mon Sep 17 00:00:00 2001 From: pabois Date: Fri, 8 Dec 2023 10:43:24 +0100 Subject: [PATCH 1/4] add csp --- app/assets/javascripts/leaflet.js | 1 + .../stylesheets/admin/commons/sidebar.sass | 2 + app/assets/stylesheets/leaflet.sass | 1 + .../admin/communication/blocks/edit.html.erb | 2 +- .../templates/organizations/_show.html.erb | 8 +- .../communication/extranets/_sidebar.html.erb | 2 +- .../photo_imports/_selector.html.erb | 2 +- .../communication/websites/_sidebar.html.erb | 2 +- app/views/admin/layouts/application.html.erb | 2 +- app/views/admin/layouts/preview.html.erb | 5 ++ .../admin/research/journals/_sidebar.html.erb | 2 +- app/views/application/_bugsnag.html.erb | 2 +- .../extranet/layouts/application.html.erb | 4 + app/views/server/layouts/application.html.erb | 2 +- .../server/universities/_sso_mapping.html.erb | 2 +- .../initializers/content_security_policy.rb | 77 ++++++++++++++----- db/schema.rb | 75 +++++++++--------- package.json | 1 + yarn.lock | 5 ++ 19 files changed, 125 insertions(+), 72 deletions(-) create mode 100644 app/assets/javascripts/leaflet.js create mode 100644 app/assets/stylesheets/admin/commons/sidebar.sass create mode 100644 app/assets/stylesheets/leaflet.sass diff --git a/app/assets/javascripts/leaflet.js b/app/assets/javascripts/leaflet.js new file mode 100644 index 000000000..afba78aec --- /dev/null +++ b/app/assets/javascripts/leaflet.js @@ -0,0 +1 @@ +//= require leaflet/dist/leaflet.js \ No newline at end of file diff --git a/app/assets/stylesheets/admin/commons/sidebar.sass b/app/assets/stylesheets/admin/commons/sidebar.sass new file mode 100644 index 000000000..dd8be5699 --- /dev/null +++ b/app/assets/stylesheets/admin/commons/sidebar.sass @@ -0,0 +1,2 @@ +.sidebar-icon + min-width: 30px \ No newline at end of file diff --git a/app/assets/stylesheets/leaflet.sass b/app/assets/stylesheets/leaflet.sass new file mode 100644 index 000000000..95cd15cc0 --- /dev/null +++ b/app/assets/stylesheets/leaflet.sass @@ -0,0 +1 @@ +@import 'leaflet/dist/leaflet' \ No newline at end of file diff --git a/app/views/admin/communication/blocks/edit.html.erb b/app/views/admin/communication/blocks/edit.html.erb index 202ced7c8..c5c82ac02 100644 --- a/app/views/admin/communication/blocks/edit.html.erb +++ b/app/views/admin/communication/blocks/edit.html.erb @@ -43,7 +43,7 @@ <%# Include vue.js before call Vue.createApp %> <%= javascript_include_tag 'vue' %> - <% end %> <% block.template.elements.each do |element| %>
  • - + <%= object[:title].html_safe %>
  • diff --git a/app/views/admin/communication/photo_imports/_selector.html.erb b/app/views/admin/communication/photo_imports/_selector.html.erb index 318a89a28..71aaadff2 100644 --- a/app/views/admin/communication/photo_imports/_selector.html.erb +++ b/app/views/admin/communication/photo_imports/_selector.html.erb @@ -157,7 +157,7 @@ pexels_path = admin_communication_pexels_path(website_id: nil, extranet_id: nil, <%# Include vue.js before call Vue.createApp %> <%= javascript_include_tag 'vue' %> - <%= stylesheet_link_tag "admin/#{current_admin_theme}", media: 'all' %> diff --git a/app/views/admin/layouts/preview.html.erb b/app/views/admin/layouts/preview.html.erb index 0e4d2be82..b85a4e9f9 100644 --- a/app/views/admin/layouts/preview.html.erb +++ b/app/views/admin/layouts/preview.html.erb @@ -18,6 +18,10 @@ padding-top: 0; } + <% if content_for?(:leaflet_required) %> + <%= stylesheet_link_tag 'leaflet', media: 'all' %> + <%= javascript_include_tag 'leaflet' %>% + <% end %>
    @@ -40,4 +44,5 @@ + diff --git a/app/views/admin/research/journals/_sidebar.html.erb b/app/views/admin/research/journals/_sidebar.html.erb index 3c5e1f64e..39fff2df7 100644 --- a/app/views/admin/research/journals/_sidebar.html.erb +++ b/app/views/admin/research/journals/_sidebar.html.erb @@ -29,7 +29,7 @@ %>
  • - + <%= object[:title].html_safe %>
  • diff --git a/app/views/application/_bugsnag.html.erb b/app/views/application/_bugsnag.html.erb index 9847d93b6..b154798d2 100644 --- a/app/views/application/_bugsnag.html.erb +++ b/app/views/application/_bugsnag.html.erb @@ -1,6 +1,6 @@ <% unless Rails.env.development? %> - <%= stylesheet_link_tag 'admin/pure', media: 'all' %> diff --git a/app/views/server/universities/_sso_mapping.html.erb b/app/views/server/universities/_sso_mapping.html.erb index a353ec6e6..d9adb36d4 100644 --- a/app/views/server/universities/_sso_mapping.html.erb +++ b/app/views/server/universities/_sso_mapping.html.erb @@ -74,7 +74,7 @@ end - <%= stylesheet_link_tag "admin/#{current_admin_theme}", media: 'all' %> diff --git a/app/views/admin/layouts/preview.html.erb b/app/views/admin/layouts/preview.html.erb index b85a4e9f9..5c348032a 100644 --- a/app/views/admin/layouts/preview.html.erb +++ b/app/views/admin/layouts/preview.html.erb @@ -20,7 +20,7 @@ <% if content_for?(:leaflet_required) %> <%= stylesheet_link_tag 'leaflet', media: 'all' %> - <%= javascript_include_tag 'leaflet' %>% + <%= javascript_include_tag 'leaflet' %> <% end %> diff --git a/app/views/application/_bugsnag.html.erb b/app/views/application/_bugsnag.html.erb index b154798d2..435d2667b 100644 --- a/app/views/application/_bugsnag.html.erb +++ b/app/views/application/_bugsnag.html.erb @@ -1,6 +1,6 @@ <% unless Rails.env.development? %> - <%= stylesheet_link_tag 'admin/pure', media: 'all' %> diff --git a/app/views/server/universities/_sso_mapping.html.erb b/app/views/server/universities/_sso_mapping.html.erb index d9adb36d4..1c51ceb03 100644 --- a/app/views/server/universities/_sso_mapping.html.erb +++ b/app/views/server/universities/_sso_mapping.html.erb @@ -74,7 +74,7 @@ end -