actionpack 7.1.4.1 → 7.1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d6c0075e31a2470da87034e8352742903c176696808a902d17a33b8db79c0cd
4
- data.tar.gz: a6c9e27f6650d1356b68de05dd835f7aa663d131410d188034d25c5f745f3a5e
3
+ metadata.gz: e2aff0dde19af40e507e288105ed67055af0847d0c37ad34de7cc6b3a630df02
4
+ data.tar.gz: 6718ca936b16397966ca7fbf39d6f9586313074d4255804532615d04f9c86a6d
5
5
  SHA512:
6
- metadata.gz: e26080c351f2d9d2218a77a7a4583473eb6ecbec52f8eb5fd2879393f4037459acfaed714c0db8ead7905aa8234b48480d1ab313eb281eda1e9a7c8bb5f2cefe
7
- data.tar.gz: bd2fa076443257da863689d42f1ca5e076a91282f374c8389452ec8604fe5e528830cdb5cd7763c79bd4194e1c3345221f2a409e80ae24dc625bba4d08a2d0d1
6
+ metadata.gz: 0a7c6df6a5e8d50ea2d2d18aea80e255c270ffb51163a6291ca72e05740cbbaae83621b6c054939cfaf3042f281a7760dcc7bb717c2da525557a87c05205f6ed
7
+ data.tar.gz: 830503286b4ec58e7b1dc45e7d51c7cfa81c5b92d6d13f7021320991870abeb353888084c2d4140019c07c3c40060a4ce3cee82548ac9f3e08abe7faaaeb20e4
data/CHANGELOG.md CHANGED
@@ -1,13 +1,37 @@
1
+ ## Rails 7.1.5.1 (December 10, 2024) ##
2
+
3
+ * Add validation to content security policies to disallow spaces and semicolons.
4
+ Developers should use multiple arguments, and different directive methods instead.
5
+
6
+ [CVE-2024-54133]
7
+
8
+ *Gannon McGibbon*
9
+
10
+
11
+ ## Rails 7.1.5 (October 30, 2024) ##
12
+
13
+ * No changes.
14
+
15
+
16
+ ## Rails 7.1.4.2 (October 23, 2024) ##
17
+
18
+ * No changes.
19
+
20
+
1
21
  ## Rails 7.1.4.1 (October 15, 2024) ##
2
22
 
3
23
  * Avoid regex backtracking in HTTP Token authentication
4
24
 
5
25
  [CVE-2024-47887]
6
26
 
27
+ *John Hawthorn*
28
+
7
29
  * Avoid regex backtracking in query parameter filtering
8
30
 
9
31
  [CVE-2024-41128]
10
32
 
33
+ *John Hawthorn*
34
+
11
35
  ## Rails 7.1.4 (August 22, 2024) ##
12
36
 
13
37
  * Resolve deprecation warning in latest `selenium-webdriver`.
@@ -207,7 +207,7 @@ module ActionController
207
207
  end
208
208
  end
209
209
 
210
- # Returns false on a valid response, true otherwise.
210
+ # Returns true on a valid response, false otherwise.
211
211
  def authenticate(request, realm, &password_procedure)
212
212
  request.authorization && validate_digest_response(request, realm, &password_procedure)
213
213
  end
@@ -425,7 +425,7 @@ module ActionController
425
425
  module ControllerMethods
426
426
  # Authenticate using an HTTP Bearer token, or otherwise render an HTTP
427
427
  # header requesting the client to send a Bearer token. For the authentication
428
- # to be considered successful, +login_procedure+ should return a non-nil
428
+ # to be considered successful, +login_procedure+ must not return a false
429
429
  # value. Typically, the authenticated user is returned.
430
430
  #
431
431
  # See ActionController::HttpAuthentication::Token for example usage.
@@ -24,6 +24,9 @@ module ActionDispatch # :nodoc:
24
24
  # policy.report_uri "/csp-violation-report-endpoint"
25
25
  # end
26
26
  class ContentSecurityPolicy
27
+ class InvalidDirectiveError < StandardError
28
+ end
29
+
27
30
  class Middleware
28
31
  def initialize(app)
29
32
  @app = app
@@ -317,9 +320,9 @@ module ActionDispatch # :nodoc:
317
320
  @directives.map do |directive, sources|
318
321
  if sources.is_a?(Array)
319
322
  if nonce && nonce_directive?(directive, nonce_directives)
320
- "#{directive} #{build_directive(sources, context).join(' ')} 'nonce-#{nonce}'"
323
+ "#{directive} #{build_directive(directive, sources, context).join(' ')} 'nonce-#{nonce}'"
321
324
  else
322
- "#{directive} #{build_directive(sources, context).join(' ')}"
325
+ "#{directive} #{build_directive(directive, sources, context).join(' ')}"
323
326
  end
324
327
  elsif sources
325
328
  directive
@@ -329,8 +332,22 @@ module ActionDispatch # :nodoc:
329
332
  end
330
333
  end
331
334
 
332
- def build_directive(sources, context)
333
- sources.map { |source| resolve_source(source, context) }
335
+ def validate(directive, sources)
336
+ sources.flatten.each do |source|
337
+ if source.include?(";") || source != source.gsub(/[[:space:]]/, "")
338
+ raise InvalidDirectiveError, <<~MSG.squish
339
+ Invalid Content Security Policy #{directive}: "#{source}".
340
+ Directive values must not contain whitespace or semicolons.
341
+ Please use multiple arguments or other directive methods instead.
342
+ MSG
343
+ end
344
+ end
345
+ end
346
+
347
+ def build_directive(directive, sources, context)
348
+ resolved_sources = sources.map { |source| resolve_source(source, context) }
349
+
350
+ validate(directive, resolved_sources)
334
351
  end
335
352
 
336
353
  def resolve_source(source, context)
@@ -99,7 +99,7 @@ module ActionDispatch
99
99
  { controller: /#{filter[:controller].underscore.sub(/_?controller\z/, "")}/ }
100
100
  elsif filter[:grep]
101
101
  grep_pattern = Regexp.new(filter[:grep])
102
- path = URI::DEFAULT_PARSER.escape(filter[:grep])
102
+ path = RFC2396_PARSER.escape(filter[:grep])
103
103
  normalized_path = ("/" + path).squeeze("/")
104
104
 
105
105
  {
@@ -2026,7 +2026,7 @@ module ActionDispatch
2026
2026
  name_for_action(options.delete(:as), action)
2027
2027
  end
2028
2028
 
2029
- path = Mapping.normalize_path URI::DEFAULT_PARSER.escape(path), formatted
2029
+ path = Mapping.normalize_path RFC2396_PARSER.escape(path), formatted
2030
2030
  ast = Journey::Parser.parse path
2031
2031
 
2032
2032
  mapping = Mapping.build(@scope, @set, ast, controller, default_action, to, via, formatted, options_constraints, anchor, options)
@@ -903,7 +903,7 @@ module ActionDispatch
903
903
  params.each do |key, value|
904
904
  if value.is_a?(String)
905
905
  value = value.dup.force_encoding(Encoding::BINARY)
906
- params[key] = URI::DEFAULT_PARSER.unescape(value)
906
+ params[key] = RFC2396_PARSER.unescape(value)
907
907
  end
908
908
  end
909
909
  req.path_parameters = params
@@ -29,6 +29,7 @@ require "active_support/core_ext/module/attribute_accessors"
29
29
 
30
30
  require "action_pack"
31
31
  require "rack"
32
+ require "uri"
32
33
  require "action_dispatch/deprecator"
33
34
 
34
35
  module Rack # :nodoc:
@@ -53,6 +54,9 @@ module ActionDispatch
53
54
  message: "ActionDispatch::IllegalStateError is deprecated without replacement.",
54
55
  deprecator: ActionDispatch.deprecator
55
56
 
57
+ RFC2396_PARSER = defined?(URI::RFC2396_PARSER) ? URI::RFC2396_PARSER : URI::RFC2396_Parser.new
58
+ private_constant :RFC2396_PARSER
59
+
56
60
  class MissingController < NameError
57
61
  end
58
62
 
@@ -9,7 +9,7 @@ module ActionPack
9
9
  module VERSION
10
10
  MAJOR = 7
11
11
  MINOR = 1
12
- TINY = 4
12
+ TINY = 5
13
13
  PRE = "1"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.4.1
4
+ version: 7.1.5.1
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: 2024-10-15 00:00:00.000000000 Z
11
+ date: 2024-12-10 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: 7.1.4.1
19
+ version: 7.1.5.1
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: 7.1.4.1
26
+ version: 7.1.5.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: nokogiri
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -128,28 +128,28 @@ dependencies:
128
128
  requirements:
129
129
  - - '='
130
130
  - !ruby/object:Gem::Version
131
- version: 7.1.4.1
131
+ version: 7.1.5.1
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - '='
137
137
  - !ruby/object:Gem::Version
138
- version: 7.1.4.1
138
+ version: 7.1.5.1
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: activemodel
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - '='
144
144
  - !ruby/object:Gem::Version
145
- version: 7.1.4.1
145
+ version: 7.1.5.1
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - '='
151
151
  - !ruby/object:Gem::Version
152
- version: 7.1.4.1
152
+ version: 7.1.5.1
153
153
  description: Web apps on Rails. Simple, battle-tested conventions for building and
154
154
  testing MVC web applications. Works with any Rack-compatible server.
155
155
  email: david@loudthinking.com
@@ -346,10 +346,10 @@ licenses:
346
346
  - MIT
347
347
  metadata:
348
348
  bug_tracker_uri: https://github.com/rails/rails/issues
349
- changelog_uri: https://github.com/rails/rails/blob/v7.1.4.1/actionpack/CHANGELOG.md
350
- documentation_uri: https://api.rubyonrails.org/v7.1.4.1/
349
+ changelog_uri: https://github.com/rails/rails/blob/v7.1.5.1/actionpack/CHANGELOG.md
350
+ documentation_uri: https://api.rubyonrails.org/v7.1.5.1/
351
351
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
352
- source_code_uri: https://github.com/rails/rails/tree/v7.1.4.1/actionpack
352
+ source_code_uri: https://github.com/rails/rails/tree/v7.1.5.1/actionpack
353
353
  rubygems_mfa_required: 'true'
354
354
  post_install_message:
355
355
  rdoc_options: []
@@ -367,7 +367,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
367
367
  version: '0'
368
368
  requirements:
369
369
  - none
370
- rubygems_version: 3.5.16
370
+ rubygems_version: 3.5.22
371
371
  signing_key:
372
372
  specification_version: 4
373
373
  summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).