ruby-saml 0.8.11 → 0.8.16
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ruby-saml might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/Gemfile +3 -1
- data/Rakefile +0 -14
- data/lib/onelogin/ruby-saml/logoutresponse.rb +9 -51
- data/lib/onelogin/ruby-saml/response.rb +121 -30
- data/lib/onelogin/ruby-saml/settings.rb +27 -10
- data/lib/onelogin/ruby-saml/slo_logoutrequest.rb +101 -0
- data/lib/onelogin/ruby-saml/utils.rb +92 -0
- data/lib/onelogin/ruby-saml/version.rb +1 -1
- data/lib/ruby-saml.rb +1 -0
- data/lib/xml_security.rb +222 -87
- data/test/certificates/certificate.der +0 -0
- data/test/certificates/formatted_certificate +14 -0
- data/test/certificates/formatted_chained_certificate +42 -0
- data/test/certificates/formatted_private_key +12 -0
- data/test/certificates/formatted_rsa_private_key +12 -0
- data/test/certificates/invalid_certificate1 +1 -0
- data/test/certificates/invalid_certificate2 +1 -0
- data/test/certificates/invalid_certificate3 +12 -0
- data/test/certificates/invalid_chained_certificate1 +1 -0
- data/test/certificates/invalid_private_key1 +1 -0
- data/test/certificates/invalid_private_key2 +1 -0
- data/test/certificates/invalid_private_key3 +10 -0
- data/test/certificates/invalid_rsa_private_key1 +1 -0
- data/test/certificates/invalid_rsa_private_key2 +1 -0
- data/test/certificates/invalid_rsa_private_key3 +10 -0
- data/test/certificates/ruby-saml-2.crt +15 -0
- data/test/logoutrequest_test.rb +124 -126
- data/test/logoutresponse_test.rb +22 -42
- data/test/requests/logoutrequest_fixtures.rb +47 -0
- data/test/response_test.rb +373 -129
- data/test/responses/adfs_response_xmlns.xml +45 -0
- data/test/responses/encrypted_new_attack.xml.base64 +1 -0
- data/test/responses/invalids/invalid_issuer_assertion.xml.base64 +1 -0
- data/test/responses/invalids/invalid_issuer_message.xml.base64 +1 -0
- data/test/responses/invalids/multiple_signed.xml.base64 +1 -0
- data/test/responses/invalids/no_signature.xml.base64 +1 -0
- data/test/responses/invalids/response_with_concealed_signed_assertion.xml +51 -0
- data/test/responses/invalids/response_with_doubled_signed_assertion.xml +49 -0
- data/test/responses/invalids/signature_wrapping_attack.xml.base64 +1 -0
- data/test/responses/logoutresponse_fixtures.rb +4 -4
- data/test/responses/response_with_concealed_signed_assertion.xml +51 -0
- data/test/responses/response_with_doubled_signed_assertion.xml +49 -0
- data/test/responses/response_with_signed_assertion_3.xml +30 -0
- data/test/responses/response_with_signed_message_and_assertion.xml +34 -0
- data/test/responses/response_with_undefined_recipient.xml.base64 +1 -0
- data/test/responses/response_wrapped.xml.base64 +150 -0
- data/test/responses/valid_response.xml.base64 +1 -0
- data/test/responses/valid_response_without_x509certificate.xml.base64 +1 -0
- data/test/settings_test.rb +111 -5
- data/test/slo_logoutrequest_test.rb +66 -0
- data/test/test_helper.rb +110 -41
- data/test/utils_test.rb +201 -11
- data/test/xml_security_test.rb +359 -68
- metadata +77 -7
Binary file
|
@@ -0,0 +1,14 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIICPDCCAaWgAwIBAgIIEiC/9HMAWWAwDQYJKoZIhvcNAQEFBQAwTzELMAkGA1UE
|
3
|
+
BhMCVVMxDDAKBgNVBAoTA2libTEMMAoGA1UECxMDc3NvMSQwIgYDVQQDExtjMjVh
|
4
|
+
MDI3Ny50b3JvbnRvLmNhLmlibS5jb20wHhcNMTEwNTI0MTYzNTQ4WhcNMjEwNTIx
|
5
|
+
wsQMPBj4WQTNzTYMCQYDVQQGEwJVUzEMMAoGA1UEChMDaWJtMQwwCgYDVQQLEwNz
|
6
|
+
c28xJDAiBgNVBAMTG2MyNWEwMjc3LnRvcm9udG8uY2EuaWJtLmNvbTCBnzANBgkq
|
7
|
+
hkiG9w0BAQEFAAOBjQAwgYkCgYEAgzfYQZuf5FVdJTcrsIQZ+YHTPjOsw2MGo0jC
|
8
|
+
mdGMcp4brWeFgk1OVaOmytPx6P76wHWR436AleX3crHBPd8gPxuZdnvBQ7PkrKpw
|
9
|
+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BsZS5jb20wHhcNMTcwNDA3MDgzMDAzWhcNMjcwNDA1MDgzMDAzWjBHMQswCQYD
|
5
|
+
VQQGEwJ1czEQMA4GA1UECAwHZXhhbXBsZTEQMA4GA1UECgwHZXhhbXBsZTEUMBIG
|
6
|
+
A1UEAwwLZXhhbXBsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKhP
|
7
|
+
S4/0azxbQekHHewQGKD7Pivr3CDpsrKxY3xlVanxj427OwzOb5KUVzsDEazumt6s
|
8
|
+
ZFY8HfidsjXY4EYA4ZzyL7ciIAR5vlAsIYN9nJ4AwVDnN/RjVwj+TN6BqWPLpVIp
|
9
|
+
Hc6Dl005HyE0zJnk1DZDn2tQVrIzbD3FhCp7YeotAgMBAAGjUDBOMB0GA1UdDgQW
|
10
|
+
BBRYZx4thASfNvR/E7NsCF2IaZ7wIDAfBgNVHSMEGDAWgBRYZx4thASfNvR/E7Ns
|
11
|
+
CF2IaZ7wIDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBDQUAA4GBACz4aobx9aG3
|
12
|
+
kh+rNyrlgM3K6dYfnKG1/YH5sJCAOvg8kDr0fQAQifH8lFVWumKUMoAe0bFTfwWt
|
13
|
+
p/VJ8MprrEJth6PFeZdczpuv+fpLcNj2VmNVJqvQYvS4m36OnBFh1QFZW8UrbFIf
|
14
|
+
dtm2nuZ+twSKqfKwjLdqcoX0p39h7Uw/
|
15
|
+
-----END CERTIFICATE-----
|
data/test/logoutrequest_test.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require File.expand_path(File.join(File.dirname(__FILE__), "test_helper"))
|
2
|
-
require 'uuid'
|
3
2
|
|
4
3
|
class LogoutRequestTest < Minitest::Test
|
5
4
|
|
@@ -29,7 +28,7 @@ class LogoutRequestTest < Minitest::Test
|
|
29
28
|
end
|
30
29
|
|
31
30
|
it "set sessionindex" do
|
32
|
-
sessionidx =
|
31
|
+
sessionidx = random_id
|
33
32
|
settings.sessionindex = sessionidx
|
34
33
|
|
35
34
|
unauth_url = OneLogin::RubySaml::Logoutrequest.new.create(settings, { :name_id => "there" })
|
@@ -78,169 +77,168 @@ class LogoutRequestTest < Minitest::Test
|
|
78
77
|
assert_match %r[ID='#{unauth_req.uuid}'], inflated
|
79
78
|
end
|
80
79
|
end
|
81
|
-
end
|
82
80
|
|
83
|
-
describe "when the settings indicate to sign (embedded) logout request" do
|
84
81
|
|
85
|
-
|
86
|
-
# sign the logout request
|
87
|
-
settings.security[:logout_requests_signed] = true
|
88
|
-
settings.security[:embed_sign] = true
|
89
|
-
settings.certificate = ruby_saml_cert_text
|
90
|
-
settings.private_key = ruby_saml_key_text
|
91
|
-
end
|
82
|
+
describe "when the settings indicate to sign (embedded) logout request" do
|
92
83
|
|
93
|
-
|
94
|
-
|
95
|
-
|
84
|
+
before do
|
85
|
+
# sign the logout request
|
86
|
+
settings.security[:logout_requests_signed] = true
|
87
|
+
settings.security[:embed_sign] = true
|
88
|
+
settings.certificate = ruby_saml_cert_text
|
89
|
+
settings.private_key = ruby_saml_key_text
|
90
|
+
end
|
96
91
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
end
|
92
|
+
it "doesn't sign through create_xml_document" do
|
93
|
+
unauth_req = OneLogin::RubySaml::Logoutrequest.new
|
94
|
+
inflated = unauth_req.create_xml_document(settings).to_s
|
101
95
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
96
|
+
refute_match %r[<ds:SignatureValue>([a-zA-Z0-9/+=]+)</ds:SignatureValue>], inflated
|
97
|
+
refute_match %r[<ds:SignatureMethod Algorithm='http://www.w3.org/2000/09/xmldsig#rsa-sha1'/>], inflated
|
98
|
+
refute_match %r[<ds:DigestMethod Algorithm='http://www.w3.org/2000/09/xmldsig#sha1'/>], inflated
|
99
|
+
end
|
106
100
|
|
107
|
-
|
108
|
-
|
109
|
-
|
101
|
+
it "sign unsigned request" do
|
102
|
+
unauth_req = OneLogin::RubySaml::Logoutrequest.new
|
103
|
+
unauth_req_doc = unauth_req.create_xml_document(settings)
|
104
|
+
inflated = unauth_req_doc.to_s
|
110
105
|
|
111
|
-
|
106
|
+
refute_match %r[<ds:SignatureValue>([a-zA-Z0-9/+=]+)</ds:SignatureValue>], inflated
|
107
|
+
refute_match %r[<ds:SignatureMethod Algorithm='http://www.w3.org/2000/09/xmldsig#rsa-sha1'/>], inflated
|
108
|
+
refute_match %r[<ds:DigestMethod Algorithm='http://www.w3.org/2000/09/xmldsig#sha1'/>], inflated
|
112
109
|
|
113
|
-
|
114
|
-
assert_match %r[<ds:SignatureMethod Algorithm='http://www.w3.org/2000/09/xmldsig#rsa-sha1'/>], inflated
|
115
|
-
assert_match %r[<ds:DigestMethod Algorithm='http://www.w3.org/2000/09/xmldsig#sha1'/>], inflated
|
116
|
-
end
|
110
|
+
inflated = unauth_req.sign_document(unauth_req_doc, settings).to_s
|
117
111
|
|
118
|
-
|
119
|
-
|
120
|
-
|
112
|
+
assert_match %r[<ds:SignatureValue>([a-zA-Z0-9/+=]+)</ds:SignatureValue>], inflated
|
113
|
+
assert_match %r[<ds:SignatureMethod Algorithm='http://www.w3.org/2000/09/xmldsig#rsa-sha1'/>], inflated
|
114
|
+
assert_match %r[<ds:DigestMethod Algorithm='http://www.w3.org/2000/09/xmldsig#sha1'/>], inflated
|
115
|
+
end
|
121
116
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
end
|
117
|
+
it "signs through create_logout_request_xml_doc" do
|
118
|
+
unauth_req = OneLogin::RubySaml::Logoutrequest.new
|
119
|
+
inflated = unauth_req.create_logout_request_xml_doc(settings).to_s
|
126
120
|
|
127
|
-
|
128
|
-
|
121
|
+
assert_match %r[<ds:SignatureValue>([a-zA-Z0-9/+=]+)</ds:SignatureValue>], inflated
|
122
|
+
assert_match %r[<ds:SignatureMethod Algorithm='http://www.w3.org/2000/09/xmldsig#rsa-sha1'/>], inflated
|
123
|
+
assert_match %r[<ds:DigestMethod Algorithm='http://www.w3.org/2000/09/xmldsig#sha1'/>], inflated
|
124
|
+
end
|
129
125
|
|
130
|
-
|
131
|
-
|
126
|
+
it "created a signed logout request" do
|
127
|
+
settings.compress_request = true
|
132
128
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
129
|
+
unauth_req = OneLogin::RubySaml::Logoutrequest.new
|
130
|
+
unauth_url = unauth_req.create(settings)
|
131
|
+
|
132
|
+
inflated = decode_saml_request_payload(unauth_url)
|
133
|
+
assert_match %r[<ds:SignatureValue>([a-zA-Z0-9/+=]+)</ds:SignatureValue>], inflated
|
134
|
+
assert_match %r[<ds:SignatureMethod Algorithm='http://www.w3.org/2000/09/xmldsig#rsa-sha1'/>], inflated
|
135
|
+
assert_match %r[<ds:DigestMethod Algorithm='http://www.w3.org/2000/09/xmldsig#sha1'/>], inflated
|
136
|
+
end
|
138
137
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
138
|
+
it "create a signed logout request with 256 digest and signature method" do
|
139
|
+
settings.compress_request = false
|
140
|
+
settings.security[:signature_method] = XMLSecurity::Document::RSA_SHA256
|
141
|
+
settings.security[:digest_method] = XMLSecurity::Document::SHA256
|
143
142
|
|
144
|
-
|
145
|
-
|
143
|
+
params = OneLogin::RubySaml::Logoutrequest.new.create_params(settings)
|
144
|
+
request_xml = Base64.decode64(params["SAMLRequest"])
|
146
145
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
146
|
+
assert_match %r[<ds:SignatureValue>([a-zA-Z0-9/+=]+)</ds:SignatureValue>], request_xml
|
147
|
+
assert_match %r[<ds:SignatureMethod Algorithm='http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'/>], request_xml
|
148
|
+
assert_match %r[<ds:DigestMethod Algorithm='http://www.w3.org/2001/04/xmlenc#sha256'/>], request_xml
|
149
|
+
end
|
151
150
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
151
|
+
it "create a signed logout request with 512 digest and signature method RSA_SHA384" do
|
152
|
+
settings.compress_request = false
|
153
|
+
settings.security[:signature_method] = XMLSecurity::Document::RSA_SHA384
|
154
|
+
settings.security[:digest_method] = XMLSecurity::Document::SHA512
|
156
155
|
|
157
|
-
|
158
|
-
|
156
|
+
params = OneLogin::RubySaml::Logoutrequest.new.create_params(settings)
|
157
|
+
request_xml = Base64.decode64(params["SAMLRequest"])
|
159
158
|
|
160
|
-
|
161
|
-
|
162
|
-
|
159
|
+
assert_match %r[<ds:SignatureValue>([a-zA-Z0-9/+=]+)</ds:SignatureValue>], request_xml
|
160
|
+
assert_match %r[<ds:SignatureMethod Algorithm='http://www.w3.org/2001/04/xmldsig-more#rsa-sha384'/>], request_xml
|
161
|
+
assert_match %r[<ds:DigestMethod Algorithm='http://www.w3.org/2001/04/xmlenc#sha512'/>], request_xml
|
162
|
+
end
|
163
163
|
end
|
164
|
-
end
|
165
164
|
|
166
|
-
|
165
|
+
describe "#create_params when the settings indicate to sign the logout request" do
|
167
166
|
|
168
|
-
|
167
|
+
let(:cert) { OpenSSL::X509::Certificate.new(ruby_saml_cert_text) }
|
169
168
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
169
|
+
before do
|
170
|
+
# sign the logout request
|
171
|
+
settings.security[:logout_requests_signed] = true
|
172
|
+
settings.security[:embed_sign] = false
|
173
|
+
settings.certificate = ruby_saml_cert_text
|
174
|
+
settings.private_key = ruby_saml_key_text
|
175
|
+
end
|
177
176
|
|
178
|
-
|
179
|
-
|
177
|
+
it "create a signature parameter with RSA_SHA1 / SHA1 and validate it" do
|
178
|
+
settings.security[:signature_method] = XMLSecurity::Document::RSA_SHA1
|
180
179
|
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
180
|
+
params = OneLogin::RubySaml::Logoutrequest.new.create_params(settings, :RelayState => 'http://example.com')
|
181
|
+
assert params['SAMLRequest']
|
182
|
+
assert params[:RelayState]
|
183
|
+
assert params['Signature']
|
184
|
+
assert_equal params['SigAlg'], XMLSecurity::Document::RSA_SHA1
|
186
185
|
|
187
|
-
|
188
|
-
|
189
|
-
|
186
|
+
query_string = "SAMLRequest=#{CGI.escape(params['SAMLRequest'])}"
|
187
|
+
query_string << "&RelayState=#{CGI.escape(params[:RelayState])}"
|
188
|
+
query_string << "&SigAlg=#{CGI.escape(params['SigAlg'])}"
|
190
189
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
190
|
+
signature_algorithm = XMLSecurity::BaseDocument.new.algorithm(params['SigAlg'])
|
191
|
+
assert_equal signature_algorithm, OpenSSL::Digest::SHA1
|
192
|
+
assert cert.public_key.verify(signature_algorithm.new, Base64.decode64(params['Signature']), query_string)
|
193
|
+
end
|
195
194
|
|
196
|
-
|
197
|
-
|
195
|
+
it "create a signature parameter with RSA_SHA256 / SHA256 and validate it" do
|
196
|
+
settings.security[:signature_method] = XMLSecurity::Document::RSA_SHA256
|
198
197
|
|
199
|
-
|
200
|
-
|
201
|
-
|
198
|
+
params = OneLogin::RubySaml::Logoutrequest.new.create_params(settings, :RelayState => 'http://example.com')
|
199
|
+
assert params['Signature']
|
200
|
+
assert_equal params['SigAlg'], XMLSecurity::Document::RSA_SHA256
|
202
201
|
|
203
|
-
|
204
|
-
|
205
|
-
|
202
|
+
query_string = "SAMLRequest=#{CGI.escape(params['SAMLRequest'])}"
|
203
|
+
query_string << "&RelayState=#{CGI.escape(params[:RelayState])}"
|
204
|
+
query_string << "&SigAlg=#{CGI.escape(params['SigAlg'])}"
|
206
205
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
206
|
+
signature_algorithm = XMLSecurity::BaseDocument.new.algorithm(params['SigAlg'])
|
207
|
+
assert_equal signature_algorithm, OpenSSL::Digest::SHA256
|
208
|
+
assert cert.public_key.verify(signature_algorithm.new, Base64.decode64(params['Signature']), query_string)
|
209
|
+
end
|
211
210
|
|
212
|
-
|
213
|
-
|
211
|
+
it "create a signature parameter with RSA_SHA384 / SHA384 and validate it" do
|
212
|
+
settings.security[:signature_method] = XMLSecurity::Document::RSA_SHA384
|
214
213
|
|
215
|
-
|
216
|
-
|
217
|
-
|
214
|
+
params = OneLogin::RubySaml::Logoutrequest.new.create_params(settings, :RelayState => 'http://example.com')
|
215
|
+
assert params['Signature']
|
216
|
+
assert_equal params['SigAlg'], XMLSecurity::Document::RSA_SHA384
|
218
217
|
|
219
|
-
|
220
|
-
|
221
|
-
|
218
|
+
query_string = "SAMLRequest=#{CGI.escape(params['SAMLRequest'])}"
|
219
|
+
query_string << "&RelayState=#{CGI.escape(params[:RelayState])}"
|
220
|
+
query_string << "&SigAlg=#{CGI.escape(params['SigAlg'])}"
|
222
221
|
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
222
|
+
signature_algorithm = XMLSecurity::BaseDocument.new.algorithm(params['SigAlg'])
|
223
|
+
assert_equal signature_algorithm, OpenSSL::Digest::SHA384
|
224
|
+
assert cert.public_key.verify(signature_algorithm.new, Base64.decode64(params['Signature']), query_string)
|
225
|
+
end
|
227
226
|
|
228
|
-
|
229
|
-
|
227
|
+
it "create a signature parameter with RSA_SHA512 / SHA512 and validate it" do
|
228
|
+
settings.security[:signature_method] = XMLSecurity::Document::RSA_SHA512
|
230
229
|
|
231
|
-
|
232
|
-
|
233
|
-
|
230
|
+
params = OneLogin::RubySaml::Logoutrequest.new.create_params(settings, :RelayState => 'http://example.com')
|
231
|
+
assert params['Signature']
|
232
|
+
assert_equal params['SigAlg'], XMLSecurity::Document::RSA_SHA512
|
234
233
|
|
235
|
-
|
236
|
-
|
237
|
-
|
234
|
+
query_string = "SAMLRequest=#{CGI.escape(params['SAMLRequest'])}"
|
235
|
+
query_string << "&RelayState=#{CGI.escape(params[:RelayState])}"
|
236
|
+
query_string << "&SigAlg=#{CGI.escape(params['SigAlg'])}"
|
238
237
|
|
239
|
-
|
240
|
-
|
241
|
-
|
238
|
+
signature_algorithm = XMLSecurity::BaseDocument.new.algorithm(params['SigAlg'])
|
239
|
+
assert_equal signature_algorithm, OpenSSL::Digest::SHA512
|
240
|
+
assert cert.public_key.verify(signature_algorithm.new, Base64.decode64(params['Signature']), query_string)
|
241
|
+
end
|
242
242
|
end
|
243
|
-
|
244
243
|
end
|
245
|
-
|
246
244
|
end
|