ruby-openid 2.6.0 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ruby-openid might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/openid/association.rb +1 -1
- data/lib/openid/cryptutil.rb +5 -5
- data/lib/openid/message.rb +1 -1
- data/lib/openid/trustroot.rb +2 -2
- data/lib/openid/urinorm.rb +4 -6
- data/lib/openid/util.rb +0 -2
- data/lib/openid/version.rb +1 -1
- data/test/discoverdata.rb +1 -2
- data/test/test_accept.rb +4 -5
- data/test/test_association.rb +4 -3
- data/test/test_associationmanager.rb +22 -24
- data/test/test_ax.rb +9 -9
- data/test/test_checkid_request.rb +6 -8
- data/test/test_consumer.rb +5 -5
- data/test/test_cryptutil.rb +5 -5
- data/test/test_dh.rb +2 -2
- data/test/test_discover.rb +19 -23
- data/test/test_discovery_manager.rb +6 -7
- data/test/test_extension.rb +2 -2
- data/test/test_fetchers.rb +16 -16
- data/test/test_filters.rb +7 -7
- data/test/test_idres.rb +25 -40
- data/test/test_kvform.rb +5 -5
- data/test/test_kvpost.rb +2 -2
- data/test/test_linkparse.rb +3 -5
- data/test/test_message.rb +19 -19
- data/test/test_nonce.rb +2 -2
- data/test/test_oauth.rb +3 -3
- data/test/test_openid_yadis.rb +2 -2
- data/test/test_pape.rb +4 -4
- data/test/test_parsehtml.rb +3 -3
- data/test/test_responses.rb +2 -2
- data/test/test_server.rb +53 -53
- data/test/test_sreg.rb +6 -6
- data/test/test_stores.rb +12 -12
- data/test/test_trustroot.rb +2 -2
- data/test/test_ui.rb +2 -2
- data/test/test_urinorm.rb +2 -2
- data/test/test_util.rb +2 -2
- data/test/test_xrds.rb +15 -15
- data/test/test_xri.rb +4 -4
- data/test/test_xrires.rb +2 -2
- data/test/test_yadis_discovery.rb +5 -5
- data/test/testutil.rb +8 -1
- metadata +18 -7
- data/lib/openid/extras.rb +0 -13
- data/test/test_extras.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a42bebb6d79a5270a97ab8a8f7e408a2c606f19e
|
4
|
+
data.tar.gz: 37f0f842916738b876794d2836d6bf27a502a659
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca1ee03431ac62f5ce84956a9cd522001fe44a9b1afe200ceca4d03060bb0a1c822955c96381fb25e6bdc876c6e20043574c407cf19be146a85349e1702a56b1
|
7
|
+
data.tar.gz: 10c21a26954a56214f1679af6beec7640ef13b66c1cd28fe308e235d2fcd6dd7e1ab9cc25004891e7792a786858f1e334327441d8cdd927b518878d900faa06a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 2.7.0
|
4
|
+
|
5
|
+
* Use RFC 2396 compatible URI parser for trustroot - 7c84ec9ced3ccbdad575e02dbfa81e53b52f909e
|
6
|
+
See https://github.com/openid/ruby-openid/pull/85
|
7
|
+
* Use HMAC from OpenSSL rather than Digest - ce2e30d7ff3308f17ef7d8c19d6f4752f76c9c40
|
8
|
+
See https://github.com/openid/ruby-openid/pull/84
|
9
|
+
* Check if OpenSSL is loaded - 751e55820d958ee781f5abb466a576d83ddde6fd
|
10
|
+
|
3
11
|
## 2.6.0
|
4
12
|
|
5
13
|
* More safely build filenames - 1c4a90630b183e7572b8ab5f2e3a3e0c0fecd2c7
|
data/lib/openid/association.rb
CHANGED
data/lib/openid/cryptutil.rb
CHANGED
@@ -2,7 +2,7 @@ require "openid/util"
|
|
2
2
|
require "digest/sha1"
|
3
3
|
require "digest/sha2"
|
4
4
|
begin
|
5
|
-
require "
|
5
|
+
require "openssl"
|
6
6
|
rescue LoadError
|
7
7
|
begin
|
8
8
|
# Try loading the ruby-hmac files if they exist
|
@@ -37,8 +37,8 @@ module OpenID
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def CryptUtil.hmac_sha1(key, text)
|
40
|
-
if
|
41
|
-
|
40
|
+
if defined? OpenSSL
|
41
|
+
OpenSSL::HMAC.digest(OpenSSL::Digest::SHA1.new, key, text)
|
42
42
|
else
|
43
43
|
return HMAC::SHA1.digest(key, text)
|
44
44
|
end
|
@@ -49,8 +49,8 @@ module OpenID
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def CryptUtil.hmac_sha256(key, text)
|
52
|
-
if
|
53
|
-
|
52
|
+
if defined? OpenSSL
|
53
|
+
OpenSSL::HMAC.digest(OpenSSL::Digest::SHA256.new, key, text)
|
54
54
|
else
|
55
55
|
return HMAC::SHA256.digest(key, text)
|
56
56
|
end
|
data/lib/openid/message.rb
CHANGED
@@ -254,7 +254,7 @@ module OpenID
|
|
254
254
|
post_args = self.to_post_args
|
255
255
|
kvargs = {}
|
256
256
|
post_args.each { |k,v|
|
257
|
-
if !k.
|
257
|
+
if !k.start_with?('openid.')
|
258
258
|
raise ArgumentError, "This message can only be encoded as a POST, because it contains arguments that are not prefixed with 'openid.'"
|
259
259
|
else
|
260
260
|
kvargs[k[7..-1]] = v
|
data/lib/openid/trustroot.rb
CHANGED
@@ -178,7 +178,7 @@ module OpenID
|
|
178
178
|
end
|
179
179
|
|
180
180
|
begin
|
181
|
-
parsed = URI::parse(url)
|
181
|
+
parsed = URI::DEFAULT_PARSER.parse(url)
|
182
182
|
rescue URI::InvalidURIError
|
183
183
|
return nil
|
184
184
|
end
|
@@ -315,7 +315,7 @@ module OpenID
|
|
315
315
|
return false
|
316
316
|
end
|
317
317
|
elsif ((@host != '') and
|
318
|
-
(!host.
|
318
|
+
(!host.end_with?('.' + @host)) and
|
319
319
|
(host != @host))
|
320
320
|
return false
|
321
321
|
end
|
data/lib/openid/urinorm.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
require 'uri'
|
2
2
|
|
3
|
-
require "openid/extras"
|
4
|
-
|
5
3
|
module OpenID
|
6
4
|
|
7
5
|
module URINorm
|
@@ -42,15 +40,15 @@ module OpenID
|
|
42
40
|
result_segments = []
|
43
41
|
|
44
42
|
while path.length > 0
|
45
|
-
if path.
|
43
|
+
if path.start_with?('../')
|
46
44
|
path = path[3..-1]
|
47
|
-
elsif path.
|
45
|
+
elsif path.start_with?('./')
|
48
46
|
path = path[2..-1]
|
49
|
-
elsif path.
|
47
|
+
elsif path.start_with?('/./')
|
50
48
|
path = path[2..-1]
|
51
49
|
elsif path == '/.'
|
52
50
|
path = '/'
|
53
|
-
elsif path.
|
51
|
+
elsif path.start_with?('/../')
|
54
52
|
path = path[3..-1]
|
55
53
|
result_segments.pop if result_segments.length > 0
|
56
54
|
elsif path == '/..'
|
data/lib/openid/util.rb
CHANGED
data/lib/openid/version.rb
CHANGED
data/test/discoverdata.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
require 'uri'
|
3
3
|
require 'openid/yadis/constants'
|
4
4
|
require 'openid/yadis/discovery'
|
5
|
-
require 'openid/extras'
|
6
5
|
require 'openid/util'
|
7
6
|
|
8
7
|
module OpenID
|
@@ -106,7 +105,7 @@ module OpenID
|
|
106
105
|
|
107
106
|
ctype = nil
|
108
107
|
header_lines.each { |header_line|
|
109
|
-
if header_line.
|
108
|
+
if header_line.start_with?('Content-Type:')
|
110
109
|
_, ctype = header_line.split(':', 2)
|
111
110
|
ctype = ctype.strip()
|
112
111
|
break
|
data/test/test_accept.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
|
-
require '
|
1
|
+
require 'minitest/autorun'
|
2
2
|
require 'testutil'
|
3
3
|
require 'openid/yadis/accept'
|
4
|
-
require 'openid/extras'
|
5
4
|
require 'openid/util'
|
6
5
|
|
7
6
|
module OpenID
|
8
7
|
|
9
|
-
class AcceptTest < Test
|
8
|
+
class AcceptTest < Minitest::Test
|
10
9
|
include TestDataMixin
|
11
10
|
|
12
11
|
def getTestData()
|
@@ -30,7 +29,7 @@ module OpenID
|
|
30
29
|
chunk = []
|
31
30
|
lines.each { |lineno, line|
|
32
31
|
stripped = line.strip()
|
33
|
-
if (stripped == '') or stripped.
|
32
|
+
if (stripped == '') or stripped.start_with?('#')
|
34
33
|
if chunk.length > 0
|
35
34
|
chunks << chunk
|
36
35
|
chunk = []
|
@@ -154,7 +153,7 @@ module OpenID
|
|
154
153
|
].each { |input, expected_header|
|
155
154
|
|
156
155
|
if expected_header.nil?
|
157
|
-
|
156
|
+
assert_raises(ArgumentError) {
|
158
157
|
Yadis.generate_accept_header(*input)
|
159
158
|
}
|
160
159
|
else
|
data/test/test_association.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
require "
|
1
|
+
require "minitest/autorun"
|
2
2
|
require "openid/association"
|
3
|
+
require "openid/protocolerror"
|
3
4
|
|
4
5
|
module OpenID
|
5
|
-
class AssociationTestCase < Test
|
6
|
+
class AssociationTestCase < Minitest::Test
|
6
7
|
def setup
|
7
8
|
# Use this funny way of getting a time so that it does not have
|
8
9
|
# fractional seconds, and so can be serialized exactly using our
|
@@ -202,7 +203,7 @@ module OpenID
|
|
202
203
|
end
|
203
204
|
end
|
204
205
|
|
205
|
-
class AssociationNegotiatorTestCase < Test
|
206
|
+
class AssociationNegotiatorTestCase < Minitest::Test
|
206
207
|
def assert_equal_under(item1, item2)
|
207
208
|
val1 = yield(item1)
|
208
209
|
val2 = yield(item2)
|
@@ -1,23 +1,23 @@
|
|
1
|
-
require "
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "testutil"
|
2
3
|
require "openid/consumer/associationmanager"
|
3
4
|
require "openid/association"
|
4
5
|
require "openid/dh"
|
5
6
|
require "openid/util"
|
6
7
|
require "openid/cryptutil"
|
7
8
|
require "openid/message"
|
9
|
+
require "openid/protocolerror"
|
8
10
|
require "openid/store/memory"
|
9
11
|
require "util"
|
10
12
|
require "time"
|
11
13
|
|
12
14
|
module OpenID
|
13
|
-
class DHAssocSessionTest < Test
|
15
|
+
class DHAssocSessionTest < Minitest::Test
|
14
16
|
def test_sha1_get_request
|
15
17
|
# Initialized without an explicit DH gets defaults
|
16
18
|
sess = Consumer::DiffieHellmanSHA1Session.new
|
17
19
|
assert_equal(['dh_consumer_public'], sess.get_request.keys)
|
18
|
-
|
19
|
-
Util::from_base64(sess.get_request['dh_consumer_public'])
|
20
|
-
end
|
20
|
+
Util::from_base64(sess.get_request['dh_consumer_public'])
|
21
21
|
end
|
22
22
|
|
23
23
|
def test_sha1_get_request_custom_dh
|
@@ -28,9 +28,7 @@ module OpenID
|
|
28
28
|
req.keys.sort)
|
29
29
|
assert_equal(dh.modulus, CryptUtil.base64_to_num(req['dh_modulus']))
|
30
30
|
assert_equal(dh.generator, CryptUtil.base64_to_num(req['dh_gen']))
|
31
|
-
|
32
|
-
Util::from_base64(req['dh_consumer_public'])
|
33
|
-
end
|
31
|
+
Util::from_base64(req['dh_consumer_public'])
|
34
32
|
end
|
35
33
|
end
|
36
34
|
|
@@ -102,7 +100,7 @@ module OpenID
|
|
102
100
|
end
|
103
101
|
end
|
104
102
|
|
105
|
-
class TestConsumerOpenID1DHSHA1 < Test
|
103
|
+
class TestConsumerOpenID1DHSHA1 < Minitest::Test
|
106
104
|
include TestDiffieHellmanResponseParametersMixin
|
107
105
|
class << self
|
108
106
|
attr_reader :session_cls, :message_namespace
|
@@ -112,7 +110,7 @@ module OpenID
|
|
112
110
|
@message_namespace = OPENID1_NS
|
113
111
|
end
|
114
112
|
|
115
|
-
class TestConsumerOpenID2DHSHA1 < Test
|
113
|
+
class TestConsumerOpenID2DHSHA1 < Minitest::Test
|
116
114
|
include TestDiffieHellmanResponseParametersMixin
|
117
115
|
class << self
|
118
116
|
attr_reader :session_cls, :message_namespace
|
@@ -122,7 +120,7 @@ module OpenID
|
|
122
120
|
@message_namespace = OPENID2_NS
|
123
121
|
end
|
124
122
|
|
125
|
-
class TestConsumerOpenID2DHSHA256 < Test
|
123
|
+
class TestConsumerOpenID2DHSHA256 < Minitest::Test
|
126
124
|
include TestDiffieHellmanResponseParametersMixin
|
127
125
|
class << self
|
128
126
|
attr_reader :session_cls, :message_namespace
|
@@ -132,7 +130,7 @@ module OpenID
|
|
132
130
|
@message_namespace = OPENID2_NS
|
133
131
|
end
|
134
132
|
|
135
|
-
class TestConsumerNoEncryptionSession < Test
|
133
|
+
class TestConsumerNoEncryptionSession < Minitest::Test
|
136
134
|
def setup
|
137
135
|
@sess = Consumer::NoEncryptionSession.new
|
138
136
|
end
|
@@ -149,7 +147,7 @@ module OpenID
|
|
149
147
|
end
|
150
148
|
end
|
151
149
|
|
152
|
-
class TestCreateAssociationRequest < Test
|
150
|
+
class TestCreateAssociationRequest < Minitest::Test
|
153
151
|
def setup
|
154
152
|
@server_url = 'http://invalid/'
|
155
153
|
@assoc_manager = Consumer::AssociationManager.new(nil, @server_url)
|
@@ -203,7 +201,7 @@ module OpenID
|
|
203
201
|
|
204
202
|
# This is a random base-64 value, so just check that it's
|
205
203
|
# present.
|
206
|
-
|
204
|
+
refute_nil(args.get_arg(OPENID1_NS, 'dh_consumer_public'))
|
207
205
|
args.del_arg(OPENID1_NS, 'dh_consumer_public')
|
208
206
|
|
209
207
|
# OK, session_type is set here and not for no-encryption
|
@@ -216,7 +214,7 @@ module OpenID
|
|
216
214
|
end
|
217
215
|
end
|
218
216
|
|
219
|
-
class TestAssociationManagerExpiresIn < Test
|
217
|
+
class TestAssociationManagerExpiresIn < Minitest::Test
|
220
218
|
def expires_in_msg(val)
|
221
219
|
msg = Message.from_openid_args({'expires_in' => val})
|
222
220
|
Consumer::AssociationManager.extract_expires_in(msg)
|
@@ -248,7 +246,7 @@ module OpenID
|
|
248
246
|
end
|
249
247
|
end
|
250
248
|
|
251
|
-
class TestAssociationManagerCreateSession < Test
|
249
|
+
class TestAssociationManagerCreateSession < Minitest::Test
|
252
250
|
def test_invalid
|
253
251
|
assert_raises(ArgumentError) {
|
254
252
|
Consumer::AssociationManager.create_session('monkeys')
|
@@ -292,7 +290,7 @@ module OpenID
|
|
292
290
|
|
293
291
|
# Test the session type negotiation behavior of an OpenID 2
|
294
292
|
# consumer.
|
295
|
-
class TestOpenID2SessionNegotiation < Test
|
293
|
+
class TestOpenID2SessionNegotiation < Minitest::Test
|
296
294
|
include NegotiationTestMixin
|
297
295
|
|
298
296
|
Compat = false
|
@@ -413,7 +411,7 @@ module OpenID
|
|
413
411
|
# oidutil.log. See the calls to self.failUnlessLogMatches. Some of
|
414
412
|
# these tests pass openid2-style messages to the openid 1
|
415
413
|
# association processing logic to be sure it ignores the extra data.
|
416
|
-
class TestOpenID1SessionNegotiation < Test
|
414
|
+
class TestOpenID1SessionNegotiation < Minitest::Test
|
417
415
|
include NegotiationTestMixin
|
418
416
|
|
419
417
|
Compat = true
|
@@ -498,7 +496,7 @@ module OpenID
|
|
498
496
|
end
|
499
497
|
|
500
498
|
|
501
|
-
class TestExtractAssociation < Test
|
499
|
+
class TestExtractAssociation < Minitest::Test
|
502
500
|
include ProtocolErrorMixin
|
503
501
|
|
504
502
|
# An OpenID associate response (without the namespace)
|
@@ -619,7 +617,7 @@ module OpenID
|
|
619
617
|
end
|
620
618
|
end
|
621
619
|
|
622
|
-
class GetOpenIDSessionTypeTest < Test
|
620
|
+
class GetOpenIDSessionTypeTest < Minitest::Test
|
623
621
|
include TestUtil
|
624
622
|
|
625
623
|
SERVER_URL = 'http://invalid/'
|
@@ -666,7 +664,7 @@ module OpenID
|
|
666
664
|
end
|
667
665
|
end
|
668
666
|
|
669
|
-
class ExtractAssociationTest < Test
|
667
|
+
class ExtractAssociationTest < Minitest::Test
|
670
668
|
include ProtocolErrorMixin
|
671
669
|
|
672
670
|
SERVER_URL = 'http://invalid/'
|
@@ -740,7 +738,7 @@ module OpenID
|
|
740
738
|
end
|
741
739
|
end
|
742
740
|
|
743
|
-
class TestExtractAssociationDiffieHellman < Test
|
741
|
+
class TestExtractAssociationDiffieHellman < Minitest::Test
|
744
742
|
include ProtocolErrorMixin
|
745
743
|
|
746
744
|
SECRET = 'x' * 20
|
@@ -799,7 +797,7 @@ module OpenID
|
|
799
797
|
end
|
800
798
|
end
|
801
799
|
|
802
|
-
class TestAssocManagerGetAssociation < Test
|
800
|
+
class TestAssocManagerGetAssociation < Minitest::Test
|
803
801
|
include FetcherMixin
|
804
802
|
include TestUtil
|
805
803
|
|
@@ -859,7 +857,7 @@ module OpenID
|
|
859
857
|
end
|
860
858
|
end
|
861
859
|
|
862
|
-
class TestAssocManagerRequestAssociation < Test
|
860
|
+
class TestAssocManagerRequestAssociation < Minitest::Test
|
863
861
|
include FetcherMixin
|
864
862
|
include TestUtil
|
865
863
|
|
data/test/test_ax.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'minitest/autorun'
|
2
2
|
require 'openid/extensions/ax'
|
3
3
|
require 'openid/message'
|
4
4
|
require 'openid/consumer/responses'
|
@@ -23,7 +23,7 @@ module OpenID
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
class AXMessageTest < Test
|
26
|
+
class AXMessageTest < Minitest::Test
|
27
27
|
def setup
|
28
28
|
@bax = BogusAXMessage.new
|
29
29
|
end
|
@@ -38,7 +38,7 @@ module OpenID
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
class AttrInfoTest < Test
|
41
|
+
class AttrInfoTest < Minitest::Test
|
42
42
|
def test_construct
|
43
43
|
assert_raises(ArgumentError) { AttrInfo.new }
|
44
44
|
type_uri = 'uri geller'
|
@@ -51,7 +51,7 @@ module OpenID
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
class ToTypeURIsTest < Test
|
54
|
+
class ToTypeURIsTest < Minitest::Test
|
55
55
|
def setup
|
56
56
|
@aliases = NamespaceMap.new
|
57
57
|
end
|
@@ -91,7 +91,7 @@ module OpenID
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
class ParseAXValuesTest < Test
|
94
|
+
class ParseAXValuesTest < Minitest::Test
|
95
95
|
def ax_values(ax_args, expected_args)
|
96
96
|
msg = KeyValueMessage.new
|
97
97
|
msg.parse_extension_args(ax_args)
|
@@ -221,7 +221,7 @@ module OpenID
|
|
221
221
|
end
|
222
222
|
end
|
223
223
|
|
224
|
-
class FetchRequestTest < Test
|
224
|
+
class FetchRequestTest < Minitest::Test
|
225
225
|
def setup
|
226
226
|
@msg = FetchRequest.new
|
227
227
|
@type_a = 'http://janrain.example.com/a'
|
@@ -483,7 +483,7 @@ module OpenID
|
|
483
483
|
end
|
484
484
|
end
|
485
485
|
|
486
|
-
class FetchResponseTest < Test
|
486
|
+
class FetchResponseTest < Minitest::Test
|
487
487
|
def setup
|
488
488
|
@msg = FetchResponse.new
|
489
489
|
@value_a = 'commodity'
|
@@ -675,7 +675,7 @@ module OpenID
|
|
675
675
|
end
|
676
676
|
end
|
677
677
|
|
678
|
-
class StoreRequestTest < Test
|
678
|
+
class StoreRequestTest < Minitest::Test
|
679
679
|
def setup
|
680
680
|
@msg = StoreRequest.new
|
681
681
|
@type_a = 'http://oranges.are.for/'
|
@@ -729,7 +729,7 @@ module OpenID
|
|
729
729
|
end
|
730
730
|
end
|
731
731
|
|
732
|
-
class StoreResponseTest < Test
|
732
|
+
class StoreResponseTest < Minitest::Test
|
733
733
|
def test_success
|
734
734
|
msg = StoreResponse.new
|
735
735
|
assert(msg.succeeded?)
|