coalescing_panda 4.6.1 → 4.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8efea91014e88f07f7bd39860db6072161db84af
4
- data.tar.gz: 88cad27a86b4a93c67fdb4ff7302214d0dde080c
3
+ metadata.gz: 943b18616d0a5e87a50358017ce3faf8e27fb7ff
4
+ data.tar.gz: 10539ffb27a3ae9709b58e9f08b3e1bd57e4f295
5
5
  SHA512:
6
- metadata.gz: 5af45f9fb9b3b3fa3765dd3236ce47eacf5b1cba2e5b4e38d3b6a63dd8e35c3d30d98f117c4511ffd16b291943fbe598a69618a461eb04c3c7fbca6cd7cae1c7
7
- data.tar.gz: 981e1e48035e68adb3680859f591f91e9ab759ff1c92198a370af467942e3a8f75d7ea57200e9f4cd42b9054aa9b14244e16438c054a080010b435a2af9f89e3
6
+ metadata.gz: 5a2df63567b03a1b07d05efa93676139f470b1cc625cdd2887ccd38df80f0f08f0b04eb0cf676ae7ad2cb7b515477f069c9bdb748810ebede82f6a14203227b6
7
+ data.tar.gz: 414e8d88d43b97ed4564d6ca67bc60e4c38b0638e01fc8f4a316a26b586009ce4f7136080a07319948f9835456c7642db675ee2c70e21f74fb96b909dcd1f990
@@ -1,3 +1,5 @@
1
+ require 'secure_headers'
2
+
1
3
  module CoalescingPanda
2
4
  class Engine < ::Rails::Engine
3
5
  config.autoload_once_paths += Dir["#{config.root}/lib/**/"]
@@ -35,5 +37,50 @@ module CoalescingPanda
35
37
  end
36
38
  end
37
39
 
40
+ initializer :secure_headers do |app|
41
+ connect_src = %w('self')
42
+ script_src = %w('self')
43
+
44
+ if Rails.env.development?
45
+ # Allow webpack-dev-server to work
46
+ connect_src << "http://localhost:3035"
47
+ connect_src << "ws://localhost:3035"
48
+
49
+ # Allow stuff like rack-mini-profiler to work in development:
50
+ # https://github.com/MiniProfiler/rack-mini-profiler/issues/327
51
+ # DON'T ENABLE THIS FOR PRODUCTION!
52
+ script_src << "'unsafe-eval'"
53
+ end
54
+
55
+ SecureHeaders::Configuration.default do |config|
56
+ # The default cookie headers aren't compatible with PandaPal cookies currently
57
+ config.cookies = { samesite: { none: true } }
58
+
59
+ if Rails.env.production?
60
+ config.cookies[:secure] = true
61
+ end
62
+
63
+ # Need to allow LTI iframes
64
+ config.x_frame_options = "ALLOWALL"
65
+
66
+ config.x_content_type_options = "nosniff"
67
+ config.x_xss_protection = "1; mode=block"
68
+ config.referrer_policy = %w(origin-when-cross-origin strict-origin-when-cross-origin)
69
+
70
+ config.csp = {
71
+ default_src: %w('self'),
72
+ script_src: script_src,
73
+ # Certain CSS-in-JS libraries inline the CSS, so we need to use unsafe-inline for them
74
+ style_src: %w('self' 'unsafe-inline' blob: https://fonts.googleapis.com),
75
+ font_src: %w('self' data: https://fonts.gstatic.com),
76
+ connect_src: connect_src,
77
+ }
78
+ end
79
+
80
+ SecureHeaders::Configuration.override(:safari_override) do |config|
81
+ config.cookies = SecureHeaders::OPT_OUT
82
+ end
83
+ end
84
+
38
85
  end
39
86
  end
@@ -1,3 +1,3 @@
1
1
  module CoalescingPanda
2
- VERSION = '4.6.1'
2
+ VERSION = '4.7.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coalescing_panda
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.6.1
4
+ version: 4.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Mills
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-02-19 00:00:00.000000000 Z
13
+ date: 2020-03-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -208,6 +208,20 @@ dependencies:
208
208
  - - '>='
209
209
  - !ruby/object:Gem::Version
210
210
  version: 1.0.0
211
+ - !ruby/object:Gem::Dependency
212
+ name: secure_headers
213
+ requirement: !ruby/object:Gem::Requirement
214
+ requirements:
215
+ - - ~>
216
+ - !ruby/object:Gem::Version
217
+ version: '6.3'
218
+ type: :runtime
219
+ prerelease: false
220
+ version_requirements: !ruby/object:Gem::Requirement
221
+ requirements:
222
+ - - ~>
223
+ - !ruby/object:Gem::Version
224
+ version: '6.3'
211
225
  - !ruby/object:Gem::Dependency
212
226
  name: zip-zip
213
227
  requirement: !ruby/object:Gem::Requirement