actionview 5.2.0.rc1 → 5.2.0.rc2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionview might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7546a7966a4112a3dc5a0145fd071e37c819723d2153c0fe153a6a50511ff5a7
4
- data.tar.gz: f92dc57125505c479d7107817ae59aedd14a37e28a4078777a78fb968c77a5ee
3
+ metadata.gz: 1de19c8d96db2fc6a2999f264678d34f5c0705ffdc4d26dce33b20213c081b48
4
+ data.tar.gz: 93b4c29e7bc979064ef651e8d472c430280868cc8593cafdab25755325e1ca02
5
5
  SHA512:
6
- metadata.gz: cc5caf199d1c8d187c3835ba18fe1d874d6dbbf537cc6046f52f7b7dc8c5407539450d6cae37cc352e580b261cded9c3c9695f79eff81a6190dd0c80cd99e570
7
- data.tar.gz: ea54f7079224d349df20dd66aa8de28e7c4af61059646ecc93d1c630ef53a678cc8e9ac650ab945049a6f3b856397008ad98defe51ed9c6d83d191595d7d8f62
6
+ metadata.gz: b4539104410cef4c14021f818e6ec147c5fc7704588e951fa9e3a145d6e4e79ac62124117412b21b9a4611382bd3beece39ee3a68835b3ad70de8adae3e69031
7
+ data.tar.gz: c0a7d7f51dafeeb49cf2a1f373e89e72a1f8bd45b167da622bfd3a5f61afc08949473e9503c922d40b560300795567325985e2af4abf07f8d7fb5ab42502e6c8
@@ -1,3 +1,12 @@
1
+ ## Rails 5.2.0.rc2 (March 20, 2018) ##
2
+
3
+ * Pass the `:skip_pipeline` option in `image_submit_tag` when calling `path_to_image`.
4
+
5
+ Fixes #32248.
6
+
7
+ *Andrew White*
8
+
9
+
1
10
  ## Rails 5.2.0.rc1 (January 30, 2018) ##
2
11
 
3
12
  * Allow the use of callable objects as group methods for grouped selects.
@@ -8,7 +17,7 @@
8
17
 
9
18
  *Jérémie Bonal*
10
19
 
11
- * Add `preload_link_tag` helper
20
+ * Add `preload_link_tag` helper.
12
21
 
13
22
  This helper that allows to the browser to initiate early fetch of resources
14
23
  (different to the specified in `javascript_include_tag` and `stylesheet_link_tag`).
@@ -68,7 +77,7 @@
68
77
 
69
78
  *Yuji Yaginuma*
70
79
 
71
- * Add `:json` type to `auto_discovery_link_tag` to support [JSON Feeds](https://jsonfeed.org/version/1)
80
+ * Add `:json` type to `auto_discovery_link_tag` to support [JSON Feeds](https://jsonfeed.org/version/1).
72
81
 
73
82
  *Mike Gunderloy*
74
83
 
@@ -13,7 +13,7 @@ The latest version of Action View can be installed with RubyGems:
13
13
 
14
14
  Source code can be downloaded as part of the Rails project on GitHub:
15
15
 
16
- * https://github.com/rails/rails/tree/master/actionview
16
+ * https://github.com/rails/rails/tree/5-2-stable/actionview
17
17
 
18
18
 
19
19
  == License
@@ -45,11 +45,9 @@ module ActionView
45
45
  # Create a dependency tree for template named +name+.
46
46
  def tree(name, finder, partial = false, seen = {})
47
47
  logical_name = name.gsub(%r|/_|, "/")
48
+ finder.formats = [finder.rendered_format] if finder.rendered_format
48
49
 
49
- options = {}
50
- options[:formats] = [finder.rendered_format] if finder.rendered_format
51
-
52
- if template = finder.disable_cache { finder.find_all(logical_name, [], partial, [], options).first }
50
+ if template = finder.disable_cache { finder.find_all(logical_name, [], partial, []).first }
53
51
  finder.rendered_format ||= template.formats.first
54
52
 
55
53
  if node = seen[template.identifier] # handle cycles in the tree
@@ -10,7 +10,7 @@ module ActionView
10
10
  MAJOR = 5
11
11
  MINOR = 2
12
12
  TINY = 0
13
- PRE = "rc1"
13
+ PRE = "rc2"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -13,6 +13,7 @@ module ActionView #:nodoc:
13
13
  autoload :CacheHelper
14
14
  autoload :CaptureHelper
15
15
  autoload :ControllerHelper
16
+ autoload :CspHelper
16
17
  autoload :CsrfHelper
17
18
  autoload :DateHelper
18
19
  autoload :DebugHelper
@@ -46,6 +47,7 @@ module ActionView #:nodoc:
46
47
  include CacheHelper
47
48
  include CaptureHelper
48
49
  include ControllerHelper
50
+ include CspHelper
49
51
  include CsrfHelper
50
52
  include DateHelper
51
53
  include DebugHelper
@@ -133,7 +133,7 @@ module ActionView
133
133
 
134
134
  sources_tags = sources.uniq.map { |source|
135
135
  href = path_to_stylesheet(source, path_options)
136
- early_hints_links << "<#{href}>; rel=preload; as=stylesheet"
136
+ early_hints_links << "<#{href}>; rel=preload; as=style"
137
137
  tag_options = {
138
138
  "rel" => "stylesheet",
139
139
  "media" => "screen",
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActionView
4
+ # = Action View CSP Helper
5
+ module Helpers #:nodoc:
6
+ module CspHelper
7
+ # Returns a meta tag "csp-nonce" with the per-session nonce value
8
+ # for allowing inline <script> tags.
9
+ #
10
+ # <head>
11
+ # <%= csp_meta_tag %>
12
+ # </head>
13
+ #
14
+ # This is used by the Rails UJS helper to create dynamically
15
+ # loaded inline <script> elements.
16
+ #
17
+ def csp_meta_tag
18
+ if content_security_policy?
19
+ tag("meta", name: "csp-nonce", content: content_security_policy_nonce)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -24,7 +24,7 @@ module ActionView
24
24
  # created_at:
25
25
  # </pre>
26
26
  def debug(object)
27
- Marshal::dump(object)
27
+ Marshal.dump(object)
28
28
  object = ERB::Util.html_escape(object.to_yaml)
29
29
  content_tag(:pre, object, class: "debug_dump")
30
30
  rescue # errors from Marshal or YAML
@@ -549,7 +549,8 @@ module ActionView
549
549
  # # => <input src="/assets/save.png" data-confirm="Are you sure?" type="image" />
550
550
  def image_submit_tag(source, options = {})
551
551
  options = options.stringify_keys
552
- tag :input, { "type" => "image", "src" => path_to_image(source) }.update(options)
552
+ src = path_to_image(source, skip_pipeline: options.delete("skip_pipeline"))
553
+ tag :input, { "type" => "image", "src" => src }.update(options)
553
554
  end
554
555
 
555
556
  # Creates a field set for grouping HTML form elements.
@@ -63,6 +63,13 @@ module ActionView
63
63
  # <%= javascript_tag defer: 'defer' do -%>
64
64
  # alert('All is good')
65
65
  # <% end -%>
66
+ #
67
+ # If you have a content security policy enabled then you can add an automatic
68
+ # nonce value by passing +nonce: true+ as part of +html_options+. Example:
69
+ #
70
+ # <%= javascript_tag nonce: true do -%>
71
+ # alert('All is good')
72
+ # <% end -%>
66
73
  def javascript_tag(content_or_options_with_block = nil, html_options = {}, &block)
67
74
  content =
68
75
  if block_given?
@@ -72,6 +79,10 @@ module ActionView
72
79
  content_or_options_with_block
73
80
  end
74
81
 
82
+ if html_options[:nonce] == true
83
+ html_options[:nonce] = content_security_policy_nonce
84
+ end
85
+
75
86
  content_tag("script".freeze, javascript_cdata_section(content), html_options)
76
87
  end
77
88
 
@@ -31,6 +31,16 @@ Released under the MIT license
31
31
  var Rails = context.Rails;
32
32
 
33
33
  (function() {
34
+ (function() {
35
+ var cspNonce;
36
+
37
+ cspNonce = Rails.cspNonce = function() {
38
+ var meta;
39
+ meta = document.querySelector('meta[name=csp-nonce]');
40
+ return meta && meta.content;
41
+ };
42
+
43
+ }).call(this);
34
44
  (function() {
35
45
  var expando, m;
36
46
 
@@ -164,9 +174,9 @@ Released under the MIT license
164
174
 
165
175
  }).call(this);
166
176
  (function() {
167
- var AcceptHeaders, CSRFProtection, createXHR, fire, prepareOptions, processResponse;
177
+ var AcceptHeaders, CSRFProtection, createXHR, cspNonce, fire, prepareOptions, processResponse;
168
178
 
169
- CSRFProtection = Rails.CSRFProtection, fire = Rails.fire;
179
+ cspNonce = Rails.cspNonce, CSRFProtection = Rails.CSRFProtection, fire = Rails.fire;
170
180
 
171
181
  AcceptHeaders = {
172
182
  '*': '*/*',
@@ -252,6 +262,7 @@ Released under the MIT license
252
262
  } catch (error) {}
253
263
  } else if (type.match(/\b(?:java|ecma)script\b/)) {
254
264
  script = document.createElement('script');
265
+ script.nonce = cspNonce();
255
266
  script.text = response;
256
267
  document.head.appendChild(script).parentNode.removeChild(script);
257
268
  } else if (type.match(/\b(xml|html|svg)\b/)) {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionview
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.0.rc1
4
+ version: 5.2.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-30 00:00:00.000000000 Z
11
+ date: 2018-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 5.2.0.rc1
19
+ version: 5.2.0.rc2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 5.2.0.rc1
26
+ version: 5.2.0.rc2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: builder
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -92,28 +92,28 @@ dependencies:
92
92
  requirements:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 5.2.0.rc1
95
+ version: 5.2.0.rc2
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - '='
101
101
  - !ruby/object:Gem::Version
102
- version: 5.2.0.rc1
102
+ version: 5.2.0.rc2
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: activemodel
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - '='
108
108
  - !ruby/object:Gem::Version
109
- version: 5.2.0.rc1
109
+ version: 5.2.0.rc2
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - '='
115
115
  - !ruby/object:Gem::Version
116
- version: 5.2.0.rc1
116
+ version: 5.2.0.rc2
117
117
  description: Simple, battle-tested conventions and helpers for building web pages.
118
118
  email: david@loudthinking.com
119
119
  executables: []
@@ -139,6 +139,7 @@ files:
139
139
  - lib/action_view/helpers/cache_helper.rb
140
140
  - lib/action_view/helpers/capture_helper.rb
141
141
  - lib/action_view/helpers/controller_helper.rb
142
+ - lib/action_view/helpers/csp_helper.rb
142
143
  - lib/action_view/helpers/csrf_helper.rb
143
144
  - lib/action_view/helpers/date_helper.rb
144
145
  - lib/action_view/helpers/debug_helper.rb
@@ -229,8 +230,8 @@ homepage: http://rubyonrails.org
229
230
  licenses:
230
231
  - MIT
231
232
  metadata:
232
- source_code_uri: https://github.com/rails/rails/tree/v5.2.0.rc1/actionview
233
- changelog_uri: https://github.com/rails/rails/blob/v5.2.0.rc1/actionview/CHANGELOG.md
233
+ source_code_uri: https://github.com/rails/rails/tree/v5.2.0.rc2/actionview
234
+ changelog_uri: https://github.com/rails/rails/blob/v5.2.0.rc2/actionview/CHANGELOG.md
234
235
  post_install_message:
235
236
  rdoc_options: []
236
237
  require_paths:
@@ -248,7 +249,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
249
  requirements:
249
250
  - none
250
251
  rubyforge_project:
251
- rubygems_version: 2.7.3
252
+ rubygems_version: 2.7.6
252
253
  signing_key:
253
254
  specification_version: 4
254
255
  summary: Rendering framework putting the V in MVC (part of Rails).