Skip to content

Commit 6f73a4f

Browse files
authored
Merge pull request #725 from johnnyshields/v2.x-merge-master-20240930
[READY] Merge master into v2.x
2 parents 0124daf + 3ee7584 commit 6f73a4f

File tree

6 files changed

+24
-35
lines changed

6 files changed

+24
-35
lines changed

.rubocop_todo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Layout/FirstHashElementIndentation:
8686
- 'lib/ruby_saml/authrequest.rb'
8787
- 'lib/ruby_saml/metadata.rb'
8888

89-
# Offense count: 4
89+
# Offense count: 3
9090
# This cop supports safe autocorrection (--autocorrect).
9191
# Configuration parameters: Width, AllowedPatterns.
9292
Layout/IndentationWidth:

CHANGELOG.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515
* [#718](https://github.com/SAML-Toolkits/ruby-saml/pull/718/) Add support to retrieve from SAMLResponse the AuthnInstant and AuthnContextClassRef values
1616
* [#711](https://github.com/SAML-Toolkits/ruby-saml/pull/711) Standardize how RubySaml reads and formats certificate and private_key PEM values, including the `RubySaml::Util#format_cert` and `#format_private_key` methods.
1717

18-
### 1.17.0
18+
### 1.18.0 (???)
19+
* [#718](https://github.com/SAML-Toolkits/ruby-saml/pull/718) Add support to retrieve from SAMLResponse the AuthnInstant and AuthnContextClassRef values
20+
* [#720](https://github.com/SAML-Toolkits/ruby-saml/pull/720) Fix ambiguous regex warnings
21+
* [#715](https://github.com/SAML-Toolkits/ruby-saml/pull/715) Fix typo in SPNameQualifier error text
22+
23+
### 1.17.0 (Sep 10, 2024)
24+
* Fix for critical vulnerability CVE-2024-45409: SAML authentication bypass via Incorrect XPath selector
1925
* [#687](https://github.com/SAML-Toolkits/ruby-saml/pull/687) Add CI coverage for Ruby 3.3 and Windows.
2026
* [#673](https://github.com/SAML-Toolkits/ruby-saml/pull/673) Add `Settings#sp_cert_multi` paramter to facilitate SP certificate and key rotation.
2127
* [#673](https://github.com/SAML-Toolkits/ruby-saml/pull/673) Support multiple simultaneous SP decryption keys via `Settings#sp_cert_multi` parameter.
@@ -55,6 +61,9 @@
5561
* Add warning about the use of IdpMetadataParser class and SSRF
5662
* CI: Migrate from Travis to Github Actions
5763

64+
### 1.12.3 (Sep 10, 2024)
65+
* Fix for critical vulnerability CVE-2024-45409: SAML authentication bypass via Incorrect XPath selector
66+
5867
### 1.12.2 (Apr 08, 2021)
5968
* [#575](https://github.com/SAML-Toolkits/ruby-saml/pull/575) Fix SloLogoutresponse bug on LogoutRequest
6069

@@ -182,14 +191,12 @@
182191
* Require Issuer element. (Must match IdP EntityID).
183192
* Destination value can't be blank (if present must match ACS URL).
184193
* Check that the EncryptedAssertion element only contains 1 Assertion element.
185-
186194
* [#335](https://github.com/SAML-Toolkits/ruby-saml/pull/335) Explicitly parse as XML and fix setting of Nokogiri options.
187195
* [#345](https://github.com/SAML-Toolkits/ruby-saml/pull/345)Support multiple settings.auth_context
188196
* More tests to prevent XML Signature Wrapping
189197
* [#342](https://github.com/SAML-Toolkits/ruby-saml/pull/342) Correct the usage of Mutex
190198
* [352](https://github.com/SAML-Toolkits/ruby-saml/pull/352) Support multiple AttributeStatement tags
191199

192-
193200
### 1.3.1 (July 10, 2016)
194201
* Fix response_test.rb of gem 1.3.0
195202
* Add reference to Security Guidelines
@@ -302,7 +309,6 @@
302309
* [#111](https://github.com/SAML-Toolkits/ruby-saml/pull/111) `Onelogin::` is `OneLogin::`
303310
* [#108](https://github.com/SAML-Toolkits/ruby-saml/pull/108) Change namespacing from `Onelogin::Saml` to `Onelogin::Rubysaml`
304311

305-
306312
### 0.7.3 (Feb 20, 2014)
307313
Updated gem dependencies to be compatible with Ruby 1.8.7-p374 and 1.9.3-p448. Removed unnecessary `canonix` gem dependency.
308314

README.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
Ruby SAML minor and tiny versions may introduce breaking changes. Please read
88
[UPGRADING.md](UPGRADING.md) for guidance on upgrading to new Ruby SAML versions.
99

10+
**There is a critical vulnerability affecting ruby-saml < 1.17.0 (CVE-2024-45409).
11+
Make sure you are using an updated version. (1.12.3 is safe)**
12+
1013
## Overview
1114

1215
The Ruby SAML library is for implementing the client side of a SAML authorization,
@@ -983,14 +986,3 @@ end
983986
# Output XML with custom metadata
984987
MyMetadata.new.generate(settings)
985988
```
986-
987-
## Attribution
988-
989-
Portions of the code in `RubySaml::XML` namespace is adapted from earlier work
990-
copyrighted by either Oracle and/or Todd W. Saxton. The original code was distributed
991-
under the Common Development and Distribution License (CDDL) 1.0. This code is planned to
992-
be written entirely in future versions.
993-
994-
## License
995-
996-
Ruby SAML is made available under the MIT License. Refer to [LICENSE](LICENSE).

lib/ruby_saml/response.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ def validate_name_id
825825
end
826826

827827
if !(settings.sp_entity_id.nil? || settings.sp_entity_id.empty? || name_id_spnamequalifier.nil? || name_id_spnamequalifier.empty?) && (name_id_spnamequalifier != settings.sp_entity_id)
828-
return append_error('SPNameQualifier value does not match the SP entityID value.')
828+
return append_error('SPNameQualifier value does not match the SP entityID value.')
829829
end
830830
end
831831

test/response_test.rb

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,25 +1356,16 @@ def generate_audience_error(expected, actual)
13561356
end
13571357
end
13581358

1359-
# Gets the AuthnInstant from the AuthnStatement.
1360-
# Could be used to require re-authentication if a long time has passed
1361-
# since the last user authentication.
1362-
# @return [String] AuthnInstant value
1363-
#
1364-
def authn_instant
1365-
@authn_instant ||= begin
1366-
node = xpath_first_from_signed_assertion('/a:AuthnStatement')
1367-
node.nil? ? nil : node.attributes['AuthnInstant']
1359+
describe "#authn_instant" do
1360+
it "extract the value of the AuthnInstant attribute" do
1361+
assert_equal "2010-11-18T21:57:37Z", response.authn_instant
13681362
end
13691363
end
13701364

1371-
# Gets the AuthnContextClassRef from the AuthnStatement
1372-
# Could be used to require re-authentication if the assertion
1373-
# did not met the requested authentication context class.
1374-
# @return [String] AuthnContextClassRef value
1375-
#
1376-
def authn_context_class_ref
1377-
@authn_context_class_ref ||= Utils.element_text(xpath_first_from_signed_assertion('/a:AuthnStatement/a:AuthnContext/a:AuthnContextClassRef'))
1365+
describe "#authn_context_class_ref" do
1366+
it "extract the value of the AuthnContextClassRef attribute" do
1367+
assert_equal "urn:oasis:names:tc:SAML:2.0:ac:classes:Password", response.authn_context_class_ref
1368+
end
13781369
end
13791370

13801371
describe "#success" do

test/utils_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,11 +363,11 @@ def result(duration, reference = 0)
363363
end
364364

365365
it 'successfully decrypts with the first private key' do
366-
assert_match %r{\A<saml:Assertion}, RubySaml::Utils.decrypt_multi(encrypted, [private_key])
366+
assert_match(/\A<saml:Assertion/, RubySaml::Utils.decrypt_multi(encrypted, [private_key]))
367367
end
368368

369369
it 'successfully decrypts with a subsequent private key' do
370-
assert_match %r{\A<saml:Assertion}, RubySaml::Utils.decrypt_multi(encrypted, [invalid_key1, private_key])
370+
assert_match(/\A<saml:Assertion/, RubySaml::Utils.decrypt_multi(encrypted, [invalid_key1, private_key]))
371371
end
372372

373373
it 'raises an error when there is only one key and it fails to decrypt' do

0 commit comments

Comments
 (0)