oauth2 2.0.20 → 2.0.22

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.
data/RUBOCOP.md CHANGED
File without changes
data/SECURITY.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  | Version | Supported |
6
6
  |----------|-----------|
7
- | 1.latest | ✅ |
7
+ | 2.0.latest | ✅ |
8
8
 
9
9
  ## Security contact information
10
10
 
@@ -12,8 +12,6 @@ To report a security vulnerability, please use the
12
12
  [Tidelift security contact](https://tidelift.com/security).
13
13
  Tidelift will coordinate the fix and disclosure.
14
14
 
15
- More detailed explanation of the process is in [IRP.md][IRP].
16
-
17
15
  ## Additional Support
18
16
 
19
17
  If you are interested in support for versions older than the latest release,
@@ -21,4 +19,3 @@ please consider sponsoring the project / maintainer @ https://liberapay.com/pbol
21
19
  or find other sponsorship links in the [README].
22
20
 
23
21
  [README]: README.md
24
- [IRP]: IRP.md
data/certs/pboling.pem ADDED
@@ -0,0 +1,27 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIEgDCCAuigAwIBAgIBATANBgkqhkiG9w0BAQsFADBDMRUwEwYDVQQDDAxwZXRl
3
+ ci5ib2xpbmcxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkW
4
+ A2NvbTAeFw0yNTA1MDQxNTMzMDlaFw00NTA0MjkxNTMzMDlaMEMxFTATBgNVBAMM
5
+ DHBldGVyLmJvbGluZzEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPy
6
+ LGQBGRYDY29tMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAruUoo0WA
7
+ uoNuq6puKWYeRYiZekz/nsDeK5x/0IEirzcCEvaHr3Bmz7rjo1I6On3gGKmiZs61
8
+ LRmQ3oxy77ydmkGTXBjruJB+pQEn7UfLSgQ0xa1/X3kdBZt6RmabFlBxnHkoaGY5
9
+ mZuZ5+Z7walm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8pBZ8r2MvtAc54xfnnhGFzeRHfcltobgFxkAXdE6p
25
+ DVjBtqT23eugOqQ73umLcYDZkc36vnqGxUBSsXrzY9pzV5gGr2I8YUxMqf6ATrZt
26
+ L9nRqA==
27
+ -----END CERTIFICATE-----
File without changes
@@ -2,7 +2,7 @@
2
2
 
3
3
  module OAuth2
4
4
  AUTH_SANITIZER = begin
5
- auth_sanitizer_requirement = Gem::Requirement.new("~> 0.1", ">= 0.1.3")
5
+ auth_sanitizer_requirement = Gem::Requirement.new("~> 0.2", ">= 0.2.1")
6
6
  auth_sanitizer_spec = Gem.loaded_specs["auth-sanitizer"]
7
7
  unless auth_sanitizer_spec && auth_sanitizer_requirement.satisfied_by?(auth_sanitizer_spec.version)
8
8
  # :nocov:
@@ -12,7 +12,7 @@ module OAuth2
12
12
 
13
13
  auth_sanitizer_loader_path = File.join(
14
14
  auth_sanitizer_spec.full_gem_path,
15
- "lib/auth_sanitizer/loader.rb",
15
+ "lib/auth_sanitizer/loader.rb"
16
16
  )
17
17
  unless File.file?(auth_sanitizer_loader_path)
18
18
  # :nocov:
@@ -25,7 +25,7 @@ module OAuth2
25
25
  auth_sanitizer_loader_namespace.module_eval(
26
26
  File.read(auth_sanitizer_loader_path),
27
27
  auth_sanitizer_loader_path,
28
- 1,
28
+ 1
29
29
  )
30
30
 
31
31
  auth_sanitizer_loader_namespace.
File without changes
data/lib/oauth2/client.rb CHANGED
@@ -159,8 +159,9 @@ module OAuth2
159
159
  end
160
160
  location = response.headers["location"]
161
161
  if location
162
- full_location = response.response.env.url.merge(location)
163
- request(verb, full_location, req_opts)
162
+ current_location = response.response.env.url
163
+ full_location = resolve_redirect_location(current_location, location)
164
+ request(verb, full_location, sanitize_redirect_options(req_opts, current_location, full_location))
164
165
  else
165
166
  error = Error.new(response)
166
167
  raise(error, "Got #{status} status code, but no Location header was present")
@@ -446,7 +447,7 @@ module OAuth2
446
447
  # See: Hash#partition https://bugs.ruby-lang.org/issues/16252
447
448
  req_opts, oauth_opts = opts.
448
449
  partition { |k, _v| RESERVED_REQ_KEYS.include?(k.to_s) }.
449
- map { |p| Hash[p] }
450
+ map(&:to_h)
450
451
 
451
452
  begin
452
453
  response = connection.run_request(verb, url, req_opts[:body], req_opts[:headers]) do |req|
@@ -465,6 +466,36 @@ module OAuth2
465
466
  Response.new(response, parse: parse, snaky: snaky)
466
467
  end
467
468
 
469
+ def resolve_redirect_location(current_location, location)
470
+ safe_location =
471
+ if location.respond_to?(:start_with?) && location.start_with?("//")
472
+ "./#{location}"
473
+ else
474
+ location
475
+ end
476
+
477
+ current_location.merge(safe_location)
478
+ end
479
+
480
+ def sanitize_redirect_options(req_opts, current_location, next_location)
481
+ return req_opts unless cross_origin_redirect?(current_location, next_location)
482
+
483
+ headers = req_opts[:headers]
484
+ return req_opts unless headers && headers.any? { |key, _value| key.to_s.casecmp("Authorization").zero? }
485
+
486
+ safe_opts = req_opts.dup
487
+ safe_headers = headers.dup
488
+ safe_headers.delete_if { |key, _value| key.to_s.casecmp("Authorization").zero? }
489
+ safe_opts[:headers] = safe_headers
490
+ safe_opts
491
+ end
492
+
493
+ def cross_origin_redirect?(current_location, next_location)
494
+ current_location.scheme != next_location.scheme ||
495
+ current_location.host != next_location.host ||
496
+ current_location.port != next_location.port
497
+ end
498
+
468
499
  # Returns the authenticator object
469
500
  #
470
501
  # @return [Authenticator] the initialized Authenticator
@@ -563,15 +594,17 @@ module OAuth2
563
594
  end
564
595
 
565
596
  def oauth_debug_logging(builder)
566
- builder.response(
567
- :logger,
568
- OAuth2::AUTH_SANITIZER::SanitizedLogger.new(
569
- options[:logger],
570
- filtered_keys: OAuth2.config[:filtered_debug_keys],
571
- label: OAuth2.config[:filtered_label],
572
- ),
573
- bodies: true,
574
- ) if OAuth2::OAUTH_DEBUG
597
+ if OAuth2::OAUTH_DEBUG
598
+ builder.response(
599
+ :logger,
600
+ OAuth2::AUTH_SANITIZER::SanitizedLogger.new(
601
+ options[:logger],
602
+ filtered_keys: OAuth2.config[:filtered_debug_keys],
603
+ label: OAuth2.config[:filtered_label]
604
+ ),
605
+ bodies: true
606
+ )
607
+ end
575
608
  end
576
609
  end
577
610
  end
data/lib/oauth2/error.rb CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -2,7 +2,7 @@
2
2
 
3
3
  module OAuth2
4
4
  module Version
5
- VERSION = "2.0.20"
5
+ VERSION = "2.0.22"
6
6
  end
7
7
  VERSION = Version::VERSION # Traditional Constant Location
8
8
  end
data/lib/oauth2.rb CHANGED
@@ -67,7 +67,7 @@ module OAuth2
67
67
  assertion
68
68
  code_verifier
69
69
  token
70
- ],
70
+ ]
71
71
  )
72
72
 
73
73
  # The current runtime configuration for the library.
File without changes
File without changes
File without changes
data/sig/oauth2/error.rbs CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -2,4 +2,5 @@ module OAuth2
2
2
  module Version
3
3
  VERSION: String
4
4
  end
5
+ VERSION: String
5
6
  end
data/sig/oauth2.rbs CHANGED
File without changes
data.tar.gz.sig CHANGED
Binary file