oauth 1.1.5 → 1.1.6
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 +4 -4
- checksums.yaml.gz.sig +1 -4
- data/CHANGELOG.md +25 -1
- data/CITATION.cff +6 -6
- data/CODE_OF_CONDUCT.md +0 -0
- data/CONTRIBUTING.md +88 -34
- data/FUNDING.md +6 -9
- data/LICENSE.md +71 -0
- data/README.md +222 -166
- data/RUBOCOP.md +0 -0
- data/SECURITY.md +1 -4
- data/certs/pboling.pem +27 -0
- data/lib/oauth/auth_sanitizer.rb +0 -0
- data/lib/oauth/client/action_controller_request.rb +0 -0
- data/lib/oauth/client/em_http.rb +0 -0
- data/lib/oauth/client/helper.rb +0 -0
- data/lib/oauth/client/net_http.rb +0 -0
- data/lib/oauth/client.rb +0 -0
- data/lib/oauth/consumer.rb +68 -16
- data/lib/oauth/errors/error.rb +0 -0
- data/lib/oauth/errors/problem.rb +0 -0
- data/lib/oauth/errors/unauthorized.rb +0 -0
- data/lib/oauth/errors.rb +0 -0
- data/lib/oauth/helper.rb +0 -0
- data/lib/oauth/oauth.rb +0 -0
- data/lib/oauth/oauth_test_helper.rb +0 -0
- data/lib/oauth/optional.rb +0 -0
- data/lib/oauth/request_proxy/action_controller_request.rb +0 -0
- data/lib/oauth/request_proxy/action_dispatch_request.rb +0 -0
- data/lib/oauth/request_proxy/base.rb +0 -0
- data/lib/oauth/request_proxy/curb_request.rb +0 -0
- data/lib/oauth/request_proxy/em_http_request.rb +0 -0
- data/lib/oauth/request_proxy/jabber_request.rb +0 -0
- data/lib/oauth/request_proxy/mock_request.rb +0 -0
- data/lib/oauth/request_proxy/net_http.rb +0 -0
- data/lib/oauth/request_proxy/rack_request.rb +0 -0
- data/lib/oauth/request_proxy/rest_client_request.rb +0 -0
- data/lib/oauth/request_proxy/typhoeus_request.rb +0 -0
- data/lib/oauth/request_proxy.rb +0 -0
- data/lib/oauth/server.rb +0 -0
- data/lib/oauth/signature/base.rb +0 -0
- data/lib/oauth/signature/hmac/sha1.rb +0 -0
- data/lib/oauth/signature/hmac/sha256.rb +0 -0
- data/lib/oauth/signature/plaintext.rb +0 -0
- data/lib/oauth/signature/rsa/sha1.rb +0 -0
- data/lib/oauth/signature.rb +0 -0
- data/lib/oauth/token.rb +0 -0
- data/lib/oauth/tokens/access_token.rb +0 -0
- data/lib/oauth/tokens/consumer_token.rb +0 -0
- data/lib/oauth/tokens/request_token.rb +0 -0
- data/lib/oauth/tokens/server_token.rb +0 -0
- data/lib/oauth/tokens/token.rb +0 -0
- data/lib/oauth/version.rb +1 -1
- data/lib/oauth.rb +1 -0
- data/sig/oauth/consumer.rbs +0 -0
- data/sig/oauth/signature/base.rbs +0 -0
- data/sig/oauth/tokens/token.rbs +0 -0
- data/sig/oauth/version.rbs +6 -0
- data.tar.gz.sig +0 -0
- metadata +133 -108
- metadata.gz.sig +0 -0
- data/LICENSE.txt +0 -22
- data/REEK +0 -2
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
|
+
| 1.1.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
|
-
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
15
|
+
fzB9MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBQE8uWvNbPVNRXZ
|
|
16
|
+
HlgPbc2PCzC4bjAhBgNVHREEGjAYgRZwZXRlci5ib2xpbmdAZ21haWwuY29tMCEG
|
|
17
|
+
A1UdEgQaMBiBFnBldGVyLmJvbGluZ0BnbWFpbC5jb20wDQYJKoZIhvcNAQELBQAD
|
|
18
|
+
ggGBAJbnUwfJQFPkBgH9cL7hoBfRtmWiCvdqdjeTmi04u8zVNCUox0A4gT982DE9
|
|
19
|
+
wmuN12LpdajxZONqbXuzZvc+nb0StFwmFYZG6iDwaf4BPywm2e/Vmq0YG45vZXGR
|
|
20
|
+
L8yMDSK1cQXjmA+ZBKOHKWavxP6Vp7lWvjAhz8RFwqF9GuNIdhv9NpnCAWcMZtpm
|
|
21
|
+
GUPyIWw/Cw/2wZp74QzZj6Npx+LdXoLTF1HMSJXZ7/pkxLCsB8m4EFVdb/IrW/0k
|
|
22
|
+
kNSfjtAfBHO8nLGuqQZVH9IBD1i9K6aSs7pT6TW8itXUIlkIUI2tg5YzW6OFfPzq
|
|
23
|
+
QekSkX3lZfY+HTSp/o+YvKkqWLUV7PQ7xh1ZYDtocpaHwgxe/j3bBqHE+CUPH2vA
|
|
24
|
+
0V/FwdTRWcwsjVoOJTrYcff8pBZ8r2MvtAc54xfnnhGFzeRHfcltobgFxkAXdE6p
|
|
25
|
+
DVjBtqT23eugOqQ73umLcYDZkc36vnqGxUBSsXrzY9pzV5gGr2I8YUxMqf6ATrZt
|
|
26
|
+
L9nRqA==
|
|
27
|
+
-----END CERTIFICATE-----
|
data/lib/oauth/auth_sanitizer.rb
CHANGED
|
File without changes
|
|
File without changes
|
data/lib/oauth/client/em_http.rb
CHANGED
|
File without changes
|
data/lib/oauth/client/helper.rb
CHANGED
|
File without changes
|
|
File without changes
|
data/lib/oauth/client.rb
CHANGED
|
File without changes
|
data/lib/oauth/consumer.rb
CHANGED
|
@@ -89,6 +89,12 @@ module OAuth
|
|
|
89
89
|
body_hash_enabled: true,
|
|
90
90
|
|
|
91
91
|
oauth_version: "1.0",
|
|
92
|
+
|
|
93
|
+
# Token endpoint redirects are followed only within the same origin by
|
|
94
|
+
# default. Cross-origin redirects can re-sign token requests for an
|
|
95
|
+
# attacker-controlled endpoint, so they require explicit opt-in.
|
|
96
|
+
token_request_max_redirects: 10,
|
|
97
|
+
token_request_cross_origin_redirects: false,
|
|
92
98
|
},
|
|
93
99
|
)
|
|
94
100
|
|
|
@@ -294,14 +300,13 @@ module OAuth
|
|
|
294
300
|
end
|
|
295
301
|
|
|
296
302
|
# Creates a request and parses the result as url_encoded. This is used internally for the RequestToken and AccessToken requests.
|
|
297
|
-
def token_request(http_method, path, token = nil, request_options = {}, *arguments)
|
|
298
|
-
request_options
|
|
299
|
-
response = request(http_method, path, token, request_options, *arguments)
|
|
303
|
+
def token_request(http_method, path, token = nil, request_options = {}, *arguments, &block)
|
|
304
|
+
response = request(http_method, path, token, token_request_options(request_options), *arguments)
|
|
300
305
|
case response.code.to_i
|
|
301
306
|
|
|
302
307
|
when (200..299)
|
|
303
|
-
if
|
|
304
|
-
|
|
308
|
+
if block
|
|
309
|
+
block.call(response.body)
|
|
305
310
|
else
|
|
306
311
|
# symbolize keys
|
|
307
312
|
# TODO this could be considered unexpected behavior; symbols or not?
|
|
@@ -312,19 +317,17 @@ module OAuth
|
|
|
312
317
|
end
|
|
313
318
|
end
|
|
314
319
|
when (300..399)
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
# Guard against infinite redirects
|
|
320
|
-
response.error! if uri.path == path && our_uri.host == uri.host
|
|
320
|
+
current_uri = token_request_uri(path)
|
|
321
|
+
redirected_uri = token_request_redirect_uri(current_uri, response)
|
|
322
|
+
response.error! unless redirected_uri
|
|
321
323
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
324
|
+
redirect_count = request_options[:token_request_redirect_count].to_i + 1
|
|
325
|
+
response.error! if redirect_count > token_request_max_redirects(request_options)
|
|
326
|
+
response.error! if token_request_cross_origin?(current_uri, redirected_uri) &&
|
|
327
|
+
!token_request_cross_origin_redirects?(request_options)
|
|
326
328
|
|
|
327
|
-
|
|
329
|
+
redirect_options = request_options.merge(token_request_redirect_count: redirect_count)
|
|
330
|
+
token_request(http_method, token_request_redirect_path(current_uri, redirected_uri), token, redirect_options, *arguments, &block)
|
|
328
331
|
when (400..499)
|
|
329
332
|
raise OAuth::Unauthorized, response
|
|
330
333
|
else
|
|
@@ -332,6 +335,55 @@ module OAuth
|
|
|
332
335
|
end
|
|
333
336
|
end
|
|
334
337
|
|
|
338
|
+
def token_request_options(request_options)
|
|
339
|
+
request_options.merge(token_request: true).tap do |options|
|
|
340
|
+
options.delete(:token_request_redirect_count)
|
|
341
|
+
options.delete(:token_request_max_redirects)
|
|
342
|
+
options.delete(:token_request_cross_origin_redirects)
|
|
343
|
+
end
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
def token_request_uri(path)
|
|
347
|
+
uri = URI.parse(path)
|
|
348
|
+
return uri if uri.absolute?
|
|
349
|
+
|
|
350
|
+
URI.parse(site).merge(path)
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
def token_request_redirect_uri(current_uri, response)
|
|
354
|
+
location = response["location"]
|
|
355
|
+
return if location.nil? || location.to_s.empty?
|
|
356
|
+
|
|
357
|
+
current_uri.merge(location)
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
def token_request_redirect_path(current_uri, redirected_uri)
|
|
361
|
+
return redirected_uri.to_s if token_request_cross_origin?(current_uri, redirected_uri)
|
|
362
|
+
|
|
363
|
+
redirected_uri.request_uri
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
def token_request_max_redirects(request_options)
|
|
367
|
+
request_options[:token_request_max_redirects] || options[:token_request_max_redirects]
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
def token_request_cross_origin_redirects?(request_options)
|
|
371
|
+
request_options.fetch(:token_request_cross_origin_redirects, options[:token_request_cross_origin_redirects])
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
def token_request_cross_origin?(current_uri, redirected_uri)
|
|
375
|
+
current_uri.scheme.to_s.downcase != redirected_uri.scheme.to_s.downcase ||
|
|
376
|
+
current_uri.host.to_s.downcase != redirected_uri.host.to_s.downcase ||
|
|
377
|
+
token_request_effective_port(current_uri) != token_request_effective_port(redirected_uri)
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
def token_request_effective_port(uri)
|
|
381
|
+
return uri.port if uri.port
|
|
382
|
+
return 443 if uri.scheme == "https"
|
|
383
|
+
|
|
384
|
+
80 if uri.scheme == "http"
|
|
385
|
+
end
|
|
386
|
+
|
|
335
387
|
# Sign the Request object. Use this if you have an externally generated http request object you want to sign.
|
|
336
388
|
def sign!(request, token = nil, request_options = {})
|
|
337
389
|
request.oauth!(http, self, token, options.merge(request_options))
|
data/lib/oauth/errors/error.rb
CHANGED
|
File without changes
|
data/lib/oauth/errors/problem.rb
CHANGED
|
File without changes
|
|
File without changes
|
data/lib/oauth/errors.rb
CHANGED
|
File without changes
|
data/lib/oauth/helper.rb
CHANGED
|
File without changes
|
data/lib/oauth/oauth.rb
CHANGED
|
File without changes
|
|
File without changes
|
data/lib/oauth/optional.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/oauth/request_proxy.rb
CHANGED
|
File without changes
|
data/lib/oauth/server.rb
CHANGED
|
File without changes
|
data/lib/oauth/signature/base.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/oauth/signature.rb
CHANGED
|
File without changes
|
data/lib/oauth/token.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/oauth/tokens/token.rb
CHANGED
|
File without changes
|
data/lib/oauth/version.rb
CHANGED
data/lib/oauth.rb
CHANGED
data/sig/oauth/consumer.rbs
CHANGED
|
File without changes
|
|
File without changes
|
data/sig/oauth/tokens/token.rbs
CHANGED
|
File without changes
|
data.tar.gz.sig
CHANGED
|
Binary file
|