oauth 1.1.3 → 1.1.4

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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +19 -1
  4. data/CITATION.cff +0 -0
  5. data/CODE_OF_CONDUCT.md +0 -0
  6. data/CONTRIBUTING.md +0 -0
  7. data/FUNDING.md +0 -0
  8. data/LICENSE.txt +0 -0
  9. data/README.md +16 -38
  10. data/REEK +2 -0
  11. data/RUBOCOP.md +0 -0
  12. data/SECURITY.md +3 -0
  13. data/lib/oauth/client/action_controller_request.rb +8 -4
  14. data/lib/oauth/client/em_http.rb +0 -0
  15. data/lib/oauth/client/helper.rb +0 -0
  16. data/lib/oauth/client/net_http.rb +0 -0
  17. data/lib/oauth/client.rb +0 -0
  18. data/lib/oauth/consumer.rb +22 -6
  19. data/lib/oauth/errors/error.rb +0 -0
  20. data/lib/oauth/errors/problem.rb +0 -0
  21. data/lib/oauth/errors/unauthorized.rb +0 -0
  22. data/lib/oauth/errors.rb +0 -0
  23. data/lib/oauth/helper.rb +0 -0
  24. data/lib/oauth/oauth.rb +0 -0
  25. data/lib/oauth/oauth_test_helper.rb +0 -0
  26. data/lib/oauth/optional.rb +0 -0
  27. data/lib/oauth/request_proxy/action_controller_request.rb +0 -0
  28. data/lib/oauth/request_proxy/action_dispatch_request.rb +0 -0
  29. data/lib/oauth/request_proxy/base.rb +12 -15
  30. data/lib/oauth/request_proxy/curb_request.rb +0 -0
  31. data/lib/oauth/request_proxy/em_http_request.rb +0 -0
  32. data/lib/oauth/request_proxy/jabber_request.rb +0 -0
  33. data/lib/oauth/request_proxy/mock_request.rb +0 -0
  34. data/lib/oauth/request_proxy/net_http.rb +0 -0
  35. data/lib/oauth/request_proxy/rack_request.rb +0 -4
  36. data/lib/oauth/request_proxy/rest_client_request.rb +0 -0
  37. data/lib/oauth/request_proxy/typhoeus_request.rb +0 -0
  38. data/lib/oauth/request_proxy.rb +17 -13
  39. data/lib/oauth/server.rb +0 -0
  40. data/lib/oauth/signature/base.rb +14 -4
  41. data/lib/oauth/signature/hmac/sha1.rb +0 -0
  42. data/lib/oauth/signature/hmac/sha256.rb +0 -0
  43. data/lib/oauth/signature/plaintext.rb +0 -0
  44. data/lib/oauth/signature/rsa/sha1.rb +0 -0
  45. data/lib/oauth/signature.rb +43 -39
  46. data/lib/oauth/token.rb +0 -0
  47. data/lib/oauth/tokens/access_token.rb +0 -0
  48. data/lib/oauth/tokens/consumer_token.rb +6 -4
  49. data/lib/oauth/tokens/request_token.rb +0 -0
  50. data/lib/oauth/tokens/server_token.rb +0 -0
  51. data/lib/oauth/tokens/token.rb +13 -1
  52. data/lib/oauth/version.rb +2 -1
  53. data/lib/oauth.rb +1 -0
  54. data/sig/oauth/consumer.rbs +9 -0
  55. data/sig/oauth/signature/base.rbs +12 -0
  56. data/sig/oauth/tokens/token.rbs +8 -0
  57. data.tar.gz.sig +0 -0
  58. metadata +54 -11
  59. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d9cbc0395ced08584b17f1b6463567d585f3d762388af8afe825c90ca8fe530
4
- data.tar.gz: 56b7bb9bc6b6d3a4a3c605079e4e26051170e2ecb0082945ffbb54fd280ba168
3
+ metadata.gz: 970e94a923c444e964d51c9a0545b8118ad8bc7223bc2a630fa54d138ebc3a0f
4
+ data.tar.gz: ae599ec3b3d5c24d6b5ea1ac9d39c51699e47e1ef0cbfe5eb656888ef0e990a5
5
5
  SHA512:
6
- metadata.gz: f4857125480d5d1fb8f070b97df0b7d5e8685aca2ef5d6e108e3bdfb62942b273dfc0488898a02f68ebb774907607e6e30ebc226b78262adb8ef788f79cd26de
7
- data.tar.gz: 33593fbecfd9c7bbe83a7c694955e15123c0df401594d46ea781db0a45b2c291cd264df8cb3b9cb501689ceb1e5edcd449e9dd3e5f0e0ff8b66f836ed9b5a783
6
+ metadata.gz: 1a1c566f7179e6e2cdc2febc0b75622ca72b1c1a13b8ae951f91296687f2d4f98b4effbc7e366d3081b663dec8c0a582c5593d0f9a9e33d06ceacbb708cd97c2
7
+ data.tar.gz: 742b924b4c21702aefd77c70d40e5b7f30ddc4ea1363c41fef4dcd29c0316433859c304062d1bde91e1377e6dd3a21cf605deed694272b2f2b8ec0e5d91e51d4
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -30,6 +30,22 @@ Please file a bug if you notice a violation of semantic versioning.
30
30
 
31
31
  ### Security
32
32
 
33
+ ## [1.1.4] - 2026-05-16
34
+
35
+ - TAG: [v1.1.4][1.1.4t]
36
+ - COVERAGE: 84.64% -- 854/1009 lines in 36 files
37
+ - BRANCH COVERAGE: 54.91% -- 151/275 branches in 36 files
38
+ - 40.78% documented
39
+
40
+ ### Added
41
+
42
+ - Add `auth-sanitizer` integration for inspect-time secret redaction in core OAuth objects.
43
+ - Traditional OAuth::VERSION constant
44
+
45
+ ### Changed
46
+
47
+ - Redact sensitive values from `#inspect` in `OAuth::Consumer`, `OAuth::Token`, and `OAuth::Signature::Base`.
48
+
33
49
  ## [1.1.3] - 2025-11-06
34
50
 
35
51
  - TAG: [v1.1.3][1.1.3t]
@@ -733,7 +749,9 @@ All together now release
733
749
  - Moved all non-Rails functionality from the Rails plugin:
734
750
  http://code.google.com/p/oauth-plugin/
735
751
 
736
- [Unreleased]: https://github.com/ruby-oauth/oauth/compare/v1.1.3...HEAD
752
+ [Unreleased]: https://github.com/ruby-oauth/oauth/compare/v1.1.4...HEAD
753
+ [1.1.4]: https://github.com/ruby-oauth/oauth/compare/v1.1.3...v1.1.4
754
+ [1.1.4t]: https://github.com/ruby-oauth/oauth/releases/tag/v1.1.4
737
755
  [1.1.3]: https://github.com/ruby-oauth/oauth/compare/v1.1.2...v1.1.3
738
756
  [1.1.3t]: https://github.com/ruby-oauth/oauth/releases/tag/v1.1.3
739
757
  [1.1.2]: https://github.com/ruby-oauth/oauth/compare/v1.1.1...v1.1.2
data/CITATION.cff CHANGED
File without changes
data/CODE_OF_CONDUCT.md CHANGED
File without changes
data/CONTRIBUTING.md CHANGED
File without changes
data/FUNDING.md CHANGED
File without changes
data/LICENSE.txt CHANGED
File without changes
data/README.md CHANGED
@@ -1,32 +1,3 @@
1
- | 📍 NOTE |
2
- |-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
3
- | RubyGems (the [GitHub org][rubygems-org], not the website) [suffered][draper-security] a [hostile takeover][ellen-takeover] in September 2025. |
4
- | Ultimately [4 maintainers][simi-removed] were [hard removed][martin-removed] and a reason has been given for only 1 of those, while 2 others resigned in protest. |
5
- | It is a [complicated story][draper-takeover] which is difficult to [parse quickly][draper-lies]. |
6
- | I'm adding notes like this to gems because I [don't condone theft][draper-theft] of repositories or gems from their rightful owners. |
7
- | If a similar theft happened with my repos/gems, I'd hope some would stand up for me. |
8
- | Disenfranchised former-maintainers have started [gem.coop][gem-coop]. |
9
- | Once available I will publish there exclusively; unless RubyCentral makes amends with the community. |
10
- | The ["Technology for Humans: Joel Draper"][reinteractive-podcast] podcast episode by [reinteractive][reinteractive] is the most cogent summary I'm aware of. |
11
- | See [here][gem-naming], [here][gem-coop] and [here][martin-ann] for more info on what comes next. |
12
- | What I'm doing: A (WIP) proposal for [bundler/gem scopes][gem-scopes], and a (WIP) proposal for a federated [gem server][gem-server]. |
13
-
14
- [rubygems-org]: https://github.com/rubygems/
15
- [draper-security]: https://joel.drapper.me/p/ruby-central-security-measures/
16
- [draper-takeover]: https://joel.drapper.me/p/ruby-central-takeover/
17
- [ellen-takeover]: https://pup-e.com/blog/goodbye-rubygems/
18
- [simi-removed]: https://www.reddit.com/r/ruby/s/gOk42POCaV
19
- [martin-removed]: https://bsky.app/profile/martinemde.com/post/3m3occezxxs2q
20
- [draper-lies]: https://joel.drapper.me/p/ruby-central-fact-check/
21
- [draper-theft]: https://joel.drapper.me/p/ruby-central/
22
- [reinteractive]: https://reinteractive.com/ruby-on-rails
23
- [gem-coop]: https://gem.coop
24
- [gem-naming]: https://github.com/gem-coop/gem.coop/issues/12
25
- [martin-ann]: https://martinemde.com/2025/10/05/announcing-gem-coop.html
26
- [gem-scopes]: https://github.com/galtzo-floss/bundle-namespace
27
- [gem-server]: https://github.com/galtzo-floss/gem-server
28
- [reinteractive-podcast]: https://youtu.be/_H4qbtC5qzU?si=BvuBU90R2wAqD2E6
29
-
30
1
  [![Galtzo FLOSS Logo by Aboling0, CC BY-SA 4.0][🖼️galtzo-i]][🖼️galtzo-discord] [![ruby-lang Logo, Yukihiro Matsumoto, Ruby Visual Identity Team, CC BY-SA 2.5][🖼️ruby-lang-i]][🖼️ruby-lang] [![oauth Logo by Chris Messina, CC BY-SA 3.0][🖼️oauth-i]][🖼️oauth]
31
2
 
32
3
  [🖼️galtzo-i]: https://logos.galtzo.com/assets/images/galtzo-floss/avatar-192px.svg
@@ -38,7 +9,7 @@
38
9
 
39
10
  # 🔑 Ruby OAuth 1.0 / 1.0a
40
11
 
41
- [![Version][👽versioni]][👽version] [![GitHub tag (latest SemVer)][⛳️tag-img]][⛳️tag] [![License: MIT][📄license-img]][📄license-ref] [![Downloads Rank][👽dl-ranki]][👽dl-rank] [![Open Source Helpers][👽oss-helpi]][👽oss-help] [![CodeCov Test Coverage][🏀codecovi]][🏀codecov] [![Coveralls Test Coverage][🏀coveralls-img]][🏀coveralls] [![QLTY Test Coverage][🏀qlty-covi]][🏀qlty-cov] [![QLTY Maintainability][🏀qlty-mnti]][🏀qlty-mnt] [![CI Heads][🚎3-hd-wfi]][🚎3-hd-wf] [![CI Runtime Dependencies @ HEAD][🚎12-crh-wfi]][🚎12-crh-wf] [![CI Current][🚎11-c-wfi]][🚎11-c-wf] [![CI Truffle Ruby][🚎9-t-wfi]][🚎9-t-wf] [![CI JRuby][🚎10-j-wfi]][🚎10-j-wf] [![Deps Locked][🚎13-🔒️-wfi]][🚎13-🔒️-wf] [![Deps Unlocked][🚎14-🔓️-wfi]][🚎14-🔓️-wf] [![CI Supported][🚎6-s-wfi]][🚎6-s-wf] [![CI Legacy][🚎4-lg-wfi]][🚎4-lg-wf] [![CI Unsupported][🚎7-us-wfi]][🚎7-us-wf] [![CI Ancient][🚎1-an-wfi]][🚎1-an-wf] [![CI Test Coverage][🚎2-cov-wfi]][🚎2-cov-wf] [![CI Style][🚎5-st-wfi]][🚎5-st-wf] [![CodeQL][🖐codeQL-img]][🖐codeQL] [![Apache SkyWalking Eyes License Compatibility Check][🚎15-🪪-wfi]][🚎15-🪪-wf]
12
+ [![Version][👽versioni]][👽version] [![GitHub tag (latest SemVer)][⛳️tag-img]][⛳️tag] [![License: MIT][📄license-img]][📄license-ref] [![Downloads Rank][👽dl-ranki]][👽dl-rank] [![CodeCov Test Coverage][🏀codecovi]][🏀codecov] [![Coveralls Test Coverage][🏀coveralls-img]][🏀coveralls] [![QLTY Test Coverage][🏀qlty-covi]][🏀qlty-cov] [![QLTY Maintainability][🏀qlty-mnti]][🏀qlty-mnt] [![CI Heads][🚎3-hd-wfi]][🚎3-hd-wf] [![CI Runtime Dependencies @ HEAD][🚎12-crh-wfi]][🚎12-crh-wf] [![CI Current][🚎11-c-wfi]][🚎11-c-wf] [![CI Truffle Ruby][🚎9-t-wfi]][🚎9-t-wf] [![CI JRuby][🚎10-j-wfi]][🚎10-j-wf] [![Deps Locked][🚎13-🔒️-wfi]][🚎13-🔒️-wf] [![Deps Unlocked][🚎14-🔓️-wfi]][🚎14-🔓️-wf] [![CI Supported][🚎6-s-wfi]][🚎6-s-wf] [![CI Legacy][🚎4-lg-wfi]][🚎4-lg-wf] [![CI Unsupported][🚎7-us-wfi]][🚎7-us-wf] [![CI Ancient][🚎1-an-wfi]][🚎1-an-wf] [![CI Test Coverage][🚎2-cov-wfi]][🚎2-cov-wf] [![CI Style][🚎5-st-wfi]][🚎5-st-wf] [![CodeQL][🖐codeQL-img]][🖐codeQL] [![Apache SkyWalking Eyes License Compatibility Check][🚎15-🪪-wfi]][🚎15-🪪-wf]
42
13
 
43
14
  `if ci_badges.map(&:color).detect { it != "green"}` ☝️ [let me know][🖼️galtzo-discord], as I may have missed the [discord notification][🖼️galtzo-discord].
44
15
 
@@ -48,6 +19,13 @@
48
19
 
49
20
  [![OpenCollective Backers][🖇osc-backers-i]][🖇osc-backers] [![OpenCollective Sponsors][🖇osc-sponsors-i]][🖇osc-sponsors] [![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor] [![Liberapay Goal Progress][⛳liberapay-img]][⛳liberapay] [![Donate on PayPal][🖇paypal-img]][🖇paypal] [![Buy me a coffee][🖇buyme-small-img]][🖇buyme] [![Donate on Polar][🖇polar-img]][🖇polar] [![Donate at ko-fi.com][🖇kofi-img]][🖇kofi]
50
21
 
22
+ <details>
23
+ <summary>👣 How will this project approach the September 2025 hostile takeover of RubyGems? 🚑️</summary>
24
+
25
+ I've summarized my thoughts in [this blog post](https://dev.to/galtzo/hostile-takeover-of-rubygems-my-thoughts-5hlo).
26
+
27
+ </details>
28
+
51
29
  ## 🌻 Synopsis
52
30
 
53
31
  OAuth 1.0a is an industry-standard protocol for authorization.
@@ -92,7 +70,7 @@ References: [RFC 5849 (OAuth 1.0)](https://datatracker.ietf.org/doc/html/rfc5849
92
70
 
93
71
  Ruby OAuth has been maintained by a large number of talented
94
72
  individuals over the years.
95
- The primary maintainer since 2020 is Peter Boling (@pboling).
73
+ The primary maintainer since 2020 is Peter Boling ([@pboling](https://github.com/pboling)).
96
74
 
97
75
  ## 💡 Info you can shake a stick at
98
76
 
@@ -131,6 +109,8 @@ Compatible with MRI Ruby 2.3+, and concordant releases of JRuby, and TruffleRuby
131
109
  | 🤼 [OAuth Ruby Google Group][⛳gg-discussions] | "Active" | ➖ | ➖ | ➖ | ➖ | [💚][⛳gg-discussions] |
132
110
  | 🎮️ [Discord Server][✉️discord-invite] | [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite] | [Let's][✉️discord-invite] | [talk][✉️discord-invite] | [about][✉️discord-invite] | [this][✉️discord-invite] | [library!][✉️discord-invite] |
133
111
 
112
+ [⛳gg-discussions]: https://groups.google.com/g/oauth-ruby
113
+ [⛳gg-discussions-img]: https://img.shields.io/badge/google-group-0093D0.svg?style=for-the-badge&logo=google&logoColor=orange
134
114
  </details>
135
115
 
136
116
  [gh-discussions]: https://github.com/ruby-oauth/oauth/discussions
@@ -280,10 +260,10 @@ hydra.run
280
260
 
281
261
  ### More Information
282
262
 
283
- * RubyDoc Documentation: [![RubyDoc.info][🚎yard-img]][🚎yard]
284
- * Mailing List/Google Group: [![Mailing List][⛳mail-list-img]][⛳mail-list]
285
- * Live Chat on Gitter: [![Join the chat at https://gitter.im/ruby-oauth/oauth-ruby][🏘chat-img]][🏘chat]
286
- * Maintainer's Blog: [![Blog][🚎blog-img]][🚎blog]
263
+ * RubyDoc Documentation: [![Current release on RubyDoc.info][📜docs-cr-rd-img]][🚎yard-current] [![YARD on Galtzo.com][📜docs-head-rd-img]][🚎yard-head]
264
+ * Mailing List/Google Group: [![OAuth Ruby Google Group][⛳gg-discussions-img]][⛳gg-discussions]
265
+ * Maintainer Blog: [![Maintainer Blog][🚂maint-blog-img]][🚂maint-blog]
266
+ * Live ruby-oauth Chat: [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite]
287
267
 
288
268
  ## 🦷 FLOSS Funding
289
269
 
@@ -570,8 +550,6 @@ Thanks for RTFM. ☺️
570
550
  [📜gh-wiki-img]: https://img.shields.io/badge/wiki-examples-943CD2.svg?style=for-the-badge&logo=github&logoColor=white
571
551
  [👽dl-rank]: https://bestgems.org/gems/oauth
572
552
  [👽dl-ranki]: https://img.shields.io/gem/rd/oauth.svg
573
- [👽oss-help]: https://www.codetriage.com/ruby-oauth/oauth
574
- [👽oss-helpi]: https://www.codetriage.com/ruby-oauth/oauth/badges/users.svg
575
553
  [👽version]: https://bestgems.org/gems/oauth
576
554
  [👽versioni]: https://img.shields.io/gem/v/oauth.svg
577
555
  [🏀qlty-mnt]: https://qlty.sh/gh/ruby-oauth/projects/oauth
@@ -662,7 +640,7 @@ Thanks for RTFM. ☺️
662
640
  [📌gitmoji]: https://gitmoji.dev
663
641
  [📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
664
642
  [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
665
- [🧮kloc-img]: https://img.shields.io/badge/KLOC-1.000-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
643
+ [🧮kloc-img]: https://img.shields.io/badge/KLOC-1.009-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
666
644
  [🔐security]: SECURITY.md
667
645
  [🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
668
646
  [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
data/REEK CHANGED
@@ -0,0 +1,2 @@
1
+ Error: No such file - is
2
+ Error: No such file - empty
data/RUBOCOP.md CHANGED
File without changes
data/SECURITY.md CHANGED
@@ -12,6 +12,8 @@ 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
+
15
17
  ## Additional Support
16
18
 
17
19
  If you are interested in support for versions older than the latest release,
@@ -19,3 +21,4 @@ please consider sponsoring the project / maintainer @ https://liberapay.com/pbol
19
21
  or find other sponsorship links in the [README].
20
22
 
21
23
  [README]: README.md
24
+ [IRP]: IRP.md
@@ -26,12 +26,16 @@ module ActionController
26
26
  end
27
27
 
28
28
  class TestRequest
29
+ OAUTH_ENABLED_KEY = :oauth_action_controller_test_request_use_oauth
30
+
29
31
  class << self
30
- attr_writer :use_oauth
31
- end
32
+ def use_oauth=(value)
33
+ Thread.current[OAUTH_ENABLED_KEY] = value
34
+ end
32
35
 
33
- def self.use_oauth?
34
- @use_oauth
36
+ def use_oauth?
37
+ Thread.current[OAUTH_ENABLED_KEY]
38
+ end
35
39
  end
36
40
 
37
41
  def configure_oauth(consumer = nil, token = nil, options = {})
File without changes
File without changes
File without changes
data/lib/oauth/client.rb CHANGED
File without changes
@@ -8,7 +8,22 @@ require "oauth/errors"
8
8
  require "cgi"
9
9
 
10
10
  module OAuth
11
+ # Consumer credentials and request configuration for OAuth 1.0 / 1.0a flows.
12
+ #
13
+ # Includes {Auth::Sanitizer::FilteredAttributes} so inspect output redacts the
14
+ # consumer secret while leaving non-sensitive configuration visible.
11
15
  class Consumer
16
+ include Auth::Sanitizer::FilteredAttributes
17
+
18
+ # Instance attributes exposed by the consumer.
19
+ #
20
+ # @!attribute [rw] options
21
+ # @return [Hash] Consumer configuration options
22
+ # @!attribute [rw] key
23
+ # @return [String] OAuth consumer key
24
+ # @!attribute [rw] secret
25
+ # @return [String] OAuth consumer secret (redacted in `#inspect`)
26
+
12
27
  # determine the certificate authority path to verify SSL certs
13
28
  if ENV["SSL_CERT_FILE"]
14
29
  if File.exist?(ENV["SSL_CERT_FILE"])
@@ -78,6 +93,7 @@ module OAuth
78
93
  )
79
94
 
80
95
  attr_accessor :options, :key, :secret
96
+ filtered_attributes :secret
81
97
  attr_writer :site, :http
82
98
 
83
99
  # Create a new consumer instance by passing it a configuration hash:
@@ -238,8 +254,8 @@ module OAuth
238
254
  def request(http_method, path, token = nil, request_options = {}, *arguments)
239
255
  unless %r{^/} =~ path
240
256
  @http = create_http(path)
241
- _uri = URI.parse(path)
242
- path = "#{_uri.path}#{"?#{_uri.query}" if _uri.query}"
257
+ uri = URI.parse(path)
258
+ path = "#{uri.path}#{"?#{uri.query}" if uri.query}"
243
259
  end
244
260
 
245
261
  # override the request with your own, this is useful for file uploads which Net::HTTP does not do
@@ -396,13 +412,13 @@ module OAuth
396
412
  protected
397
413
 
398
414
  # Instantiates the http object
399
- def create_http(_url = nil)
400
- _url = request_endpoint unless request_endpoint.nil?
415
+ def create_http(url = nil)
416
+ url = request_endpoint unless request_endpoint.nil?
401
417
 
402
- our_uri = if _url.nil? || _url[0] =~ %r{^/}
418
+ our_uri = if url.nil? || url[0] =~ %r{^/}
403
419
  URI.parse(site)
404
420
  else
405
- your_uri = URI.parse(_url)
421
+ your_uri = URI.parse(url)
406
422
  if your_uri.host.nil?
407
423
  # If the _url is a path, missing the leading slash, then it won't have a host,
408
424
  # and our_uri *must* have a host, so we parse site instead.
File without changes
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
File without changes
File without changes
File without changes
@@ -8,8 +8,10 @@ module OAuth
8
8
  class Base
9
9
  include OAuth::Helper
10
10
 
11
- def self.proxies(klass)
12
- OAuth::RequestProxy.available_proxies[klass] = self
11
+ class << self
12
+ def proxies(klass)
13
+ OAuth::RequestProxy.available_proxies[klass] = self
14
+ end
13
15
  end
14
16
 
15
17
  attr_accessor :request, :options, :unsigned_parameters
@@ -23,15 +25,15 @@ module OAuth
23
25
  ## OAuth parameters
24
26
 
25
27
  def oauth_callback
26
- parameters["oauth_callback"]
28
+ [parameters["oauth_callback"]].flatten.first
27
29
  end
28
30
 
29
31
  def oauth_consumer_key
30
- parameters["oauth_consumer_key"]
32
+ [parameters["oauth_consumer_key"]].flatten.first
31
33
  end
32
34
 
33
35
  def oauth_nonce
34
- parameters["oauth_nonce"]
36
+ [parameters["oauth_nonce"]].flatten.first
35
37
  end
36
38
 
37
39
  def oauth_signature
@@ -40,31 +42,26 @@ module OAuth
40
42
  end
41
43
 
42
44
  def oauth_signature_method
43
- case parameters["oauth_signature_method"]
44
- when Array
45
- parameters["oauth_signature_method"].first
46
- else
47
- parameters["oauth_signature_method"]
48
- end
45
+ [parameters["oauth_signature_method"]].flatten.first
49
46
  end
50
47
 
51
48
  def oauth_timestamp
52
- parameters["oauth_timestamp"]
49
+ [parameters["oauth_timestamp"]].flatten.first
53
50
  end
54
51
 
55
52
  def oauth_token
56
- parameters["oauth_token"]
53
+ [parameters["oauth_token"]].flatten.first
57
54
  end
58
55
 
59
56
  # OAuth 1.0a only: value returned to the Consumer after user authorization
60
57
  # and required when exchanging a Request Token for an Access Token.
61
58
  # Not present in OAuth 1.0 flows.
62
59
  def oauth_verifier
63
- parameters["oauth_verifier"]
60
+ [parameters["oauth_verifier"]].flatten.first
64
61
  end
65
62
 
66
63
  def oauth_version
67
- parameters["oauth_version"]
64
+ [parameters["oauth_version"]].flatten.first
68
65
  end
69
66
 
70
67
  # TODO: deprecate these
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -26,10 +26,6 @@ module OAuth
26
26
  end
27
27
  end
28
28
 
29
- def signature
30
- parameters["oauth_signature"]
31
- end
32
-
33
29
  protected
34
30
 
35
31
  def query_params
File without changes
File without changes
@@ -2,24 +2,28 @@
2
2
 
3
3
  module OAuth
4
4
  module RequestProxy
5
- def self.available_proxies # :nodoc:
6
- @available_proxies ||= {}
7
- end
5
+ AVAILABLE_PROXIES = {}
8
6
 
9
- def self.proxy(request, options = {})
10
- return request if request.is_a?(OAuth::RequestProxy::Base)
7
+ class << self
8
+ def available_proxies # :nodoc:
9
+ AVAILABLE_PROXIES
10
+ end
11
11
 
12
- klass = available_proxies[request.class]
12
+ def proxy(request, options = {})
13
+ return request if request.is_a?(OAuth::RequestProxy::Base)
13
14
 
14
- # Search for possible superclass matches.
15
- if klass.nil?
16
- request_parent = available_proxies.keys.find { |rc| request.is_a?(rc) }
17
- klass = available_proxies[request_parent]
18
- end
15
+ klass = available_proxies[request.class]
19
16
 
20
- raise UnknownRequestType, request.class.to_s unless klass
17
+ # Search for possible superclass matches.
18
+ if klass.nil?
19
+ request_parent = available_proxies.keys.find { |rc| request.is_a?(rc) }
20
+ klass = available_proxies[request_parent]
21
+ end
21
22
 
22
- klass.new(request, options)
23
+ raise UnknownRequestType, request.class.to_s unless klass
24
+
25
+ klass.new(request, options)
26
+ end
23
27
  end
24
28
 
25
29
  class UnknownRequestType < RuntimeError; end
data/lib/oauth/server.rb CHANGED
File without changes
@@ -7,17 +7,27 @@ require "base64"
7
7
 
8
8
  module OAuth
9
9
  module Signature
10
+ # Base class for OAuth signature implementations.
11
+ #
12
+ # Includes {Auth::Sanitizer::FilteredAttributes} so inspect output redacts
13
+ # secret-bearing fields captured during signature construction.
10
14
  class Base
11
15
  include OAuth::Helper
16
+ include Auth::Sanitizer::FilteredAttributes
12
17
 
18
+ # Signature construction options.
19
+ #
20
+ # @return [Hash]
13
21
  attr_accessor :options
14
22
  attr_reader :token_secret, :consumer_secret, :request
23
+ filtered_attributes :options, :consumer_secret, :token_secret
15
24
 
16
- def self.implements(signature_method = nil)
17
- return @implements if signature_method.nil?
25
+ class << self
26
+ def implements(signature_method = nil)
27
+ return OAuth::Signature.available_methods.key(self) if signature_method.nil?
18
28
 
19
- @implements = signature_method
20
- OAuth::Signature.available_methods[@implements] = self
29
+ OAuth::Signature.available_methods[signature_method] = self
30
+ end
21
31
  end
22
32
 
23
33
  def initialize(request, options = {}, &block)
File without changes
File without changes
File without changes
File without changes
@@ -2,45 +2,49 @@
2
2
 
3
3
  module OAuth
4
4
  module Signature
5
- # Returns a list of available signature methods
6
- def self.available_methods
7
- @available_methods ||= {}
8
- end
9
-
10
- # Build a signature from a +request+.
11
- #
12
- # Raises UnknownSignatureMethod exception if the signature method is unknown.
13
- def self.build(request, options = {}, &block)
14
- request = OAuth::RequestProxy.proxy(request, options)
15
- klass = available_methods[
16
- (request.signature_method ||
17
- ((c = request.options[:consumer]) && c.options[:signature_method]) ||
18
- "").downcase]
19
- raise UnknownSignatureMethod, request.signature_method unless klass
20
-
21
- klass.new(request, options, &block)
22
- end
23
-
24
- # Sign a +request+
25
- def self.sign(request, options = {}, &block)
26
- build(request, options, &block).signature
27
- end
28
-
29
- # Verify the signature of +request+
30
- def self.verify(request, options = {}, &block)
31
- build(request, options, &block).verify
32
- end
33
-
34
- # Create the signature base string for +request+. This string is the normalized parameter information.
35
- #
36
- # See Also: {OAuth core spec version 1.0, section 9.1.1}[http://oauth.net/core/1.0#rfc.section.9.1.1]
37
- def self.signature_base_string(request, options = {}, &block)
38
- build(request, options, &block).signature_base_string
39
- end
40
-
41
- # Create the body hash for a request
42
- def self.body_hash(request, options = {}, &block)
43
- build(request, options, &block).body_hash
5
+ AVAILABLE_METHODS = {}
6
+
7
+ class << self
8
+ # Returns a list of available signature methods
9
+ def available_methods
10
+ AVAILABLE_METHODS
11
+ end
12
+
13
+ # Build a signature from a +request+.
14
+ #
15
+ # Raises UnknownSignatureMethod exception if the signature method is unknown.
16
+ def build(request, options = {}, &block)
17
+ request = OAuth::RequestProxy.proxy(request, options)
18
+ klass = available_methods[
19
+ (request.signature_method ||
20
+ ((c = request.options[:consumer]) && c.options[:signature_method]) ||
21
+ "").downcase]
22
+ raise UnknownSignatureMethod, request.signature_method unless klass
23
+
24
+ klass.new(request, options, &block)
25
+ end
26
+
27
+ # Sign a +request+
28
+ def sign(request, options = {}, &block)
29
+ build(request, options, &block).signature
30
+ end
31
+
32
+ # Verify the signature of +request+
33
+ def verify(request, options = {}, &block)
34
+ build(request, options, &block).verify
35
+ end
36
+
37
+ # Create the signature base string for +request+. This string is the normalized parameter information.
38
+ #
39
+ # See Also: {OAuth core spec version 1.0, section 9.1.1}[http://oauth.net/core/1.0#rfc.section.9.1.1]
40
+ def signature_base_string(request, options = {}, &block)
41
+ build(request, options, &block).signature_base_string
42
+ end
43
+
44
+ # Create the body hash for a request
45
+ def body_hash(request, options = {}, &block)
46
+ build(request, options, &block).body_hash
47
+ end
44
48
  end
45
49
 
46
50
  class UnknownSignatureMethod < RuntimeError; end
data/lib/oauth/token.rb CHANGED
File without changes
File without changes
@@ -6,10 +6,12 @@ module OAuth
6
6
  attr_accessor :consumer, :params
7
7
  attr_reader :response
8
8
 
9
- def self.from_hash(consumer, hash)
10
- token = new(consumer, hash[:oauth_token], hash[:oauth_token_secret])
11
- token.params = hash
12
- token
9
+ class << self
10
+ def from_hash(consumer, hash)
11
+ token = new(consumer, hash[:oauth_token], hash[:oauth_token_secret])
12
+ token.params = hash
13
+ token
14
+ end
13
15
  end
14
16
 
15
17
  def initialize(consumer, token = "", secret = "")
File without changes
File without changes
@@ -1,11 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OAuth
4
- # Superclass for the various tokens used by OAuth
4
+ # Superclass for the various tokens used by OAuth.
5
+ #
6
+ # Includes {Auth::Sanitizer::FilteredAttributes} so inspect output redacts the
7
+ # token value and token secret while leaving object identity and non-sensitive
8
+ # fields visible.
5
9
  class Token
6
10
  include OAuth::Helper
11
+ include Auth::Sanitizer::FilteredAttributes
7
12
 
13
+ # Token attributes.
14
+ #
15
+ # @!attribute [rw] token
16
+ # @return [String] OAuth token value (redacted in `#inspect`)
17
+ # @!attribute [rw] secret
18
+ # @return [String] OAuth token secret (redacted in `#inspect`)
8
19
  attr_accessor :token, :secret
20
+ filtered_attributes :token, :secret
9
21
 
10
22
  def initialize(token, secret)
11
23
  @token = token
data/lib/oauth/version.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  module OAuth
4
4
  module Version
5
- VERSION = "1.1.3"
5
+ VERSION = "1.1.4"
6
6
  end
7
+ VERSION = Version::VERSION # Traditional Constant Location
7
8
  end
data/lib/oauth.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # third party gems
4
+ require "auth/sanitizer"
4
5
  require "snaky_hash"
5
6
  require "version_gem"
6
7
 
@@ -0,0 +1,9 @@
1
+ module OAuth
2
+ class Consumer
3
+ include Auth::Sanitizer::FilteredAttributes
4
+
5
+ attr_accessor options: untyped
6
+ attr_accessor key: untyped
7
+ attr_accessor secret: untyped
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ module OAuth
2
+ module Signature
3
+ class Base
4
+ include Auth::Sanitizer::FilteredAttributes
5
+
6
+ attr_accessor options: untyped
7
+ attr_reader token_secret: untyped
8
+ attr_reader consumer_secret: untyped
9
+ attr_reader request: untyped
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,8 @@
1
+ module OAuth
2
+ class Token
3
+ include Auth::Sanitizer::FilteredAttributes
4
+
5
+ attr_accessor token: untyped
6
+ attr_accessor secret: untyped
7
+ end
8
+ end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pelle Braendgaard
@@ -45,6 +45,26 @@ cert_chain:
45
45
  -----END CERTIFICATE-----
46
46
  date: 1980-01-02 00:00:00.000000000 Z
47
47
  dependencies:
48
+ - !ruby/object:Gem::Dependency
49
+ name: auth-sanitizer
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.1'
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: 0.1.2
58
+ type: :runtime
59
+ prerelease: false
60
+ version_requirements: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - "~>"
63
+ - !ruby/object:Gem::Version
64
+ version: '0.1'
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: 0.1.2
48
68
  - !ruby/object:Gem::Dependency
49
69
  name: oauth-tty
50
70
  requirement: !ruby/object:Gem::Requirement
@@ -54,7 +74,7 @@ dependencies:
54
74
  version: '1.0'
55
75
  - - ">="
56
76
  - !ruby/object:Gem::Version
57
- version: 1.0.6
77
+ version: 1.0.7
58
78
  type: :runtime
59
79
  prerelease: false
60
80
  version_requirements: !ruby/object:Gem::Requirement
@@ -64,7 +84,7 @@ dependencies:
64
84
  version: '1.0'
65
85
  - - ">="
66
86
  - !ruby/object:Gem::Version
67
- version: 1.0.6
87
+ version: 1.0.7
68
88
  - !ruby/object:Gem::Dependency
69
89
  name: snaky_hash
70
90
  requirement: !ruby/object:Gem::Requirement
@@ -72,6 +92,9 @@ dependencies:
72
92
  - - "~>"
73
93
  - !ruby/object:Gem::Version
74
94
  version: '2.0'
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: 2.0.4
75
98
  type: :runtime
76
99
  prerelease: false
77
100
  version_requirements: !ruby/object:Gem::Requirement
@@ -79,6 +102,9 @@ dependencies:
79
102
  - - "~>"
80
103
  - !ruby/object:Gem::Version
81
104
  version: '2.0'
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: 2.0.4
82
108
  - !ruby/object:Gem::Dependency
83
109
  name: base64
84
110
  requirement: !ruby/object:Gem::Requirement
@@ -93,6 +119,20 @@ dependencies:
93
119
  - - "~>"
94
120
  - !ruby/object:Gem::Version
95
121
  version: '0.1'
122
+ - !ruby/object:Gem::Dependency
123
+ name: cgi
124
+ requirement: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ type: :runtime
130
+ prerelease: false
131
+ version_requirements: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
96
136
  - !ruby/object:Gem::Dependency
97
137
  name: version_gem
98
138
  requirement: !ruby/object:Gem::Requirement
@@ -189,28 +229,28 @@ dependencies:
189
229
  requirements:
190
230
  - - "~>"
191
231
  - !ruby/object:Gem::Version
192
- version: '1.1'
232
+ version: '2.0'
193
233
  type: :development
194
234
  prerelease: false
195
235
  version_requirements: !ruby/object:Gem::Requirement
196
236
  requirements:
197
237
  - - "~>"
198
238
  - !ruby/object:Gem::Version
199
- version: '1.1'
239
+ version: '2.0'
200
240
  - !ruby/object:Gem::Dependency
201
241
  name: bundler-audit
202
242
  requirement: !ruby/object:Gem::Requirement
203
243
  requirements:
204
244
  - - "~>"
205
245
  - !ruby/object:Gem::Version
206
- version: 0.9.2
246
+ version: 0.9.3
207
247
  type: :development
208
248
  prerelease: false
209
249
  version_requirements: !ruby/object:Gem::Requirement
210
250
  requirements:
211
251
  - - "~>"
212
252
  - !ruby/object:Gem::Version
213
- version: 0.9.2
253
+ version: 0.9.3
214
254
  - !ruby/object:Gem::Dependency
215
255
  name: rake
216
256
  requirement: !ruby/object:Gem::Requirement
@@ -450,15 +490,18 @@ files:
450
490
  - lib/oauth/tokens/server_token.rb
451
491
  - lib/oauth/tokens/token.rb
452
492
  - lib/oauth/version.rb
493
+ - sig/oauth/consumer.rbs
494
+ - sig/oauth/signature/base.rbs
495
+ - sig/oauth/tokens/token.rbs
453
496
  homepage: https://github.com/ruby-oauth/oauth
454
497
  licenses:
455
498
  - MIT
456
499
  metadata:
457
500
  homepage_uri: https://oauth.galtzo.com/
458
- source_code_uri: https://github.com/ruby-oauth/oauth/tree/v1.1.3
459
- changelog_uri: https://github.com/ruby-oauth/oauth/blob/v1.1.3/CHANGELOG.md
501
+ source_code_uri: https://github.com/ruby-oauth/oauth/tree/v1.1.4
502
+ changelog_uri: https://github.com/ruby-oauth/oauth/blob/v1.1.4/CHANGELOG.md
460
503
  bug_tracker_uri: https://github.com/ruby-oauth/oauth/issues
461
- documentation_uri: https://www.rubydoc.info/gems/oauth/1.1.3
504
+ documentation_uri: https://www.rubydoc.info/gems/oauth/1.1.4
462
505
  mailing_list_uri: https://groups.google.com/g/oauth-ruby
463
506
  funding_uri: https://github.com/sponsors/pboling
464
507
  wiki_uri: https://gitlab.com/ruby-oauth/oauth/-/wiki
@@ -488,7 +531,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
488
531
  - !ruby/object:Gem::Version
489
532
  version: '0'
490
533
  requirements: []
491
- rubygems_version: 3.7.2
534
+ rubygems_version: 4.0.11
492
535
  specification_version: 4
493
536
  summary: "\U0001F511 OAuth 1.0 / 1.0a Core Ruby implementation"
494
537
  test_files: []
metadata.gz.sig CHANGED
Binary file