Skip to content

Commit 28547c5

Browse files
Merge branch 'v2.x' into yolo-refactor-of-sp-settings
2 parents 9c72fa5 + bd87168 commit 28547c5

14 files changed

Lines changed: 224 additions & 97 deletions

.github/workflows/test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
fail-fast: false
2727
matrix:
2828
os:
29-
- ubuntu-20.04
29+
- ubuntu-22.04
3030
- macos-latest
3131
- windows-latest
3232
ruby-version:
@@ -36,10 +36,13 @@ jobs:
3636
- 3.3
3737
- 3.4
3838
- jruby-9.4
39+
- jruby-10.0
3940
- truffleruby
4041
exclude:
4142
- os: windows-latest
4243
ruby-version: jruby-9.4
44+
- os: windows-latest
45+
ruby-version: jruby-10.0
4346
- os: windows-latest
4447
ruby-version: truffleruby
4548
runs-on: ${{ matrix.os }}

CHANGELOG.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
* [#731](https://github.com/SAML-Toolkits/ruby-saml/pull/731) Add CI coverage for Ruby 3.4. Remove CI coverage for Ruby 1.x and 2.x.
2222
* [#735](https://github.com/SAML-Toolkits/ruby-saml/pull/735) Add `Settings#sp_uuid_prefix` and deprecate `Utils#set_prefix`.
2323

24+
### 1.18.1 (Jul 29, 2025)
25+
* Fix vulnerability CVE-2025-54572 Prevent DOS due large SAML Message
26+
* Adapt tests to be able to execute signature validation sooner
27+
* CI Improvements. Support Ruby 3.4
28+
2429
### 1.18.0 (Mar 12, 2025)
2530
* [#750](https://github.com/SAML-Toolkits/ruby-saml/pull/750) Fix vulnerabilities: CVE-2025-25291, CVE-2025-25292: SAML authentication bypass via Signature Wrapping attack allowed due parser differential. Fix vulnerability: CVE-2025-25293: Potential DOS abusing of compressed messages.
2631
* [#718](https://github.com/SAML-Toolkits/ruby-saml/pull/718/) Add support to retrieve from SAMLResponse the AuthnInstant and AuthnContextClassRef values
@@ -61,7 +66,7 @@
6166
* [#614](https://github.com/SAML-Toolkits/ruby-saml/pull/614) Support :name_id_format option for IdpMetadataParser
6267
* [#611](https://github.com/SAML-Toolkits/ruby-saml/pull/611) IdpMetadataParser should always set idp_cert_multi, even when there is only one cert
6368
* [#610](https://github.com/SAML-Toolkits/ruby-saml/pull/610) New IDP sso/slo binding params which deprecate :embed_sign
64-
* [#602](https://github.com/SAML-Toolkits/ruby-saml/pull/602) Refactor the OneLogin::RubySaml::Metadata class
69+
* [#602](https://github.com/SAML-Toolkits/ruby-saml/pull/602) Refactor the RubySaml::Metadata class
6570
* [#586](https://github.com/SAML-Toolkits/ruby-saml/pull/586) Support milliseconds in cacheDuration parsing
6671
* [#585](https://github.com/SAML-Toolkits/ruby-saml/pull/585) Do not append " | " to StatusCode unnecessarily
6772
* [#607](https://github.com/SAML-Toolkits/ruby-saml/pull/607) Clean up
@@ -136,7 +141,7 @@
136141
* Updated invalid audience error message
137142

138143
### 1.7.2 (Feb 28, 2018)
139-
* [#446](https://github.com/SAML-Toolkits/ruby-saml/pull/446) Normalize text returned by OneLogin::RubySaml::Utils.element_text
144+
* [#446](https://github.com/SAML-Toolkits/ruby-saml/pull/446) Normalize text returned by RubySaml::Utils.element_text
140145

141146
### 1.7.1 (Feb 28, 2018)
142147
* [#444](https://github.com/SAML-Toolkits/ruby-saml/pull/444) Fix audience validation for empty audience restriction
@@ -266,7 +271,7 @@
266271
* [#226](https://github.com/SAML-Toolkits/ruby-saml/pull/226) Ensure IdP certificate is formatted properly
267272
* [#225](https://github.com/SAML-Toolkits/ruby-saml/pull/225) Add documentation to several methods. Fix xpath injection on xml_security.rb
268273
* [#223](https://github.com/SAML-Toolkits/ruby-saml/pull/223) Allow logging to be delegated to an arbitrary Logger
269-
* [#222](https://github.com/SAML-Toolkits/ruby-saml/pull/222) No more silent failure fetching idp metadata (OneLogin::RubySaml::HttpError raised).
274+
* [#222](https://github.com/SAML-Toolkits/ruby-saml/pull/222) No more silent failure fetching idp metadata (RubySaml::HttpError raised).
270275

271276
### 0.9.2 (Apr 28, 2015)
272277
* [#216](https://github.com/SAML-Toolkits/ruby-saml/pull/216) Add fingerprint algorithm support
@@ -314,10 +319,10 @@
314319
* [#183](https://github.com/SAML-Toolkits/ruby-saml/pull/183) Resolved a security vulnerability where string interpolation in a `REXML::XPath.first()` method call allowed for arbitrary code execution.
315320

316321
### 0.8.0 (Feb 21, 2014)
317-
**IMPORTANT**: This release changed namespace of the gem from `OneLogin::Saml` to `OneLogin::RubySaml`. Please update your implementations of the gem accordingly.
322+
**IMPORTANT**: This release changed namespace of the gem from `Saml` to `RubySaml`. Please update your implementations of the gem accordingly.
318323

319-
* [#111](https://github.com/SAML-Toolkits/ruby-saml/pull/111) `Onelogin::` is `OneLogin::`
320-
* [#108](https://github.com/SAML-Toolkits/ruby-saml/pull/108) Change namespacing from `Onelogin::Saml` to `Onelogin::Rubysaml`
324+
* [#111](https://github.com/SAML-Toolkits/ruby-saml/pull/111) `` is ``
325+
* [#108](https://github.com/SAML-Toolkits/ruby-saml/pull/108) Change namespacing from `Saml` to `Rubysaml`
321326

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

README.md

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,18 @@ Ruby SAML minor versions may introduce breaking changes. Please read
99

1010
## Vulnerability Notice
1111

12-
There are **critical vulnerabilities** affecting ruby-saml < 1.18.0 which allow
13-
SAML authentication bypass (CVE-2024-45409, CVE-2025-25291, CVE-2025-25292, CVE-2025-25293).
14-
**Please upgrade to a fixed version (1.18.0 or 2.0.0) as soon as possible.**
12+
Please note the following **critical vulnerabilities**:
13+
14+
- CVE-2025-54572 (DOS attack vector) affects version ruby-saml < 1.18.1
15+
- CVE-2024-45409, CVE-2025-25291, CVE-2025-25292, CVE-2025-25293 (SAML authentication bypass) affects ruby-saml < 1.18.0
16+
17+
**Please upgrade to a fixed version (2.0.0 or 1.18.1) as soon as possible.**
18+
19+
## Sponsors
20+
21+
Thanks to the following sponsors for securing the open source ecosystem,
22+
23+
[<img alt="84codes" src="https://avatars.githubusercontent.com/u/5353257" width="75px">](https://www.84codes.com)
1524

1625
## Overview
1726

@@ -46,7 +55,7 @@ it by email to the maintainer: sixto.martin.garcia+security@gmail.com
4655
The following Ruby versions are covered by CI testing:
4756

4857
* Ruby (MRI) 3.0 to 3.4
49-
* JRuby 9.4
58+
* JRuby 9.4 to 10.0
5059
* TruffleRuby (latest)
5160

5261
Older Ruby versions are supported on the 1.x release of Ruby SAML.
@@ -929,22 +938,24 @@ or underscore, and can only contain letters, digits, underscores, hyphens, and p
929938

930939
Some IdPs may require to add SPs to add additional fields (Organization, ContactPerson, etc.)
931940
into the SP metadata. This can be done by extending the `RubySaml::Metadata` class and
932-
overriding the `#add_extras` method using a Nokogiri XML builder as per the following example:
941+
overriding the `#add_extras` method where the first arg is a
942+
[Nokogiri::XML::Builder](https://nokogiri.org/rdoc/Nokogiri/XML/Builder.html) object as per
943+
the following example:
933944

934945
```ruby
935946
class MyMetadata < RubySaml::Metadata
936947
private
937948

938949
def add_extras(xml, _settings)
939-
xml['md'].Organization do
940-
xml['md'].OrganizationName('ACME Inc.', 'xml:lang' => 'en-US')
941-
xml['md'].OrganizationDisplayName('ACME', 'xml:lang' => 'en-US')
942-
xml['md'].OrganizationURL('https://www.acme.com', 'xml:lang' => 'en-US')
950+
xml.Organization do
951+
xml.OrganizationName('xml:lang' => 'en-US') { xml.text 'ACME Inc.' }
952+
xml.OrganizationDisplayName('xml:lang' => 'en-US') { xml.text 'ACME' }
953+
xml.OrganizationURL('xml:lang' => 'en-US') { xml.text 'https://www.acme.com' }
943954
end
944955

945-
xml['md'].ContactPerson('contactType' => 'technical') do
946-
xml['md'].GivenName('ACME SAML Team')
947-
xml['md'].EmailAddress('saml@acme.com')
956+
xml.ContactPerson('contactType' => 'technical') do
957+
xml.GivenName { xml.text 'ACME SAML Team' }
958+
xml.EmailAddress { xml.text 'saml@acme.com' }
948959
end
949960
end
950961
end

UPGRADING.md

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ authn.url
9696
RubySaml::Application(settings).sp.build('AuthnRequest', **options)
9797

9898

99-
100-
10199
## Upgrading from 1.x to 2.0.0
102100

103101
**IMPORTANT: Please read this section carefully as it contains breaking changes!**
@@ -124,15 +122,15 @@ This issue is likely not critical for most IdPs, but since it is not tested, it
124122

125123
### Root "OneLogin" namespace changed to "RubySaml"
126124

127-
RubySaml version `2.0.0` changes the root namespace from `OneLogin::RubySaml::` to just `RubySaml::`.
128-
Please remove `OneLogin::` and `onelogin/` everywhere in your codebase. Aside from this namespace change,
125+
RubySaml version `2.0.0` changes the root namespace from `RubySaml::` to just `RubySaml::`.
126+
Please remove `` and `onelogin/` everywhere in your codebase. Aside from this namespace change,
129127
the class names themselves have intentionally been kept the same.
130128

131129
Note that the project folder structure has also been updated accordingly. Notably, the directory
132130
`lib/onelogin/schemas` is now `lib/ruby_saml/schemas`.
133131

134-
For backward compatibility, the alias `OneLogin = Object` has been set, so `OneLogin::RubySaml::` will still work
135-
as before. This alias will be removed in RubySaml version `2.1.0`.
132+
For backward compatibility, the alias `OneLogin = Object` has been set, so `RubySaml::` will still work
133+
as before. This alias will be removed in RubySaml version `3.0.0`.
136134

137135
### Deprecation and removal of "XMLSecurity" namespace
138136

@@ -172,24 +170,33 @@ settings.security[:signature_method] = RubySaml::XML::RSA_SHA1
172170
### Replacement of REXML with Nokogiri
173171

174172
RubySaml `1.x` used a combination of REXML and Nokogiri for XML parsing and generation.
175-
In `2.0.0`, REXML has been replaced with Nokogiri. This change should be transparent
176-
to most users, however, see note about Custom Metadata Fields below.
173+
In `2.0.0`, REXML has been replaced with Nokogiri. As a result, there are minor differences
174+
in how XML is generated, ncluding SAML requests and SP Metadata:
175+
176+
1. All XML namespace declarations will be on the root node of the XML. Previously,
177+
some declarations such as `xmlns:ds` were done on child nodes.
178+
2. The ordering of attributes on each node may be different.
179+
180+
These differences should not affect how the XML is parsed by various XML parsing libraries.
181+
However, if you are strictly asserting that the generated XML is an exact string in your tests,
182+
such tests may need to be adjusted accordingly.
177183

178184
### Custom Metadata Fields now use Nokogiri XML Builder
179185

180186
If you have added custom fields to your SP metadata generation by overriding
181-
the `RubySaml::Metadata#add_extras` method, you will need to update your code to use
182-
[Nokogiri::XML::Builder](https://nokogiri.org/rdoc/Nokogiri/XML/Builder.html) format
183-
instead of REXML. Here is an example of the new format:
187+
the `RubySaml::Metadata#add_extras` method, you will need to update your code
188+
so that the first arg of the method is a
189+
[Nokogiri::XML::Builder](https://nokogiri.org/rdoc/Nokogiri/XML/Builder.html)
190+
object. Here is an example of the new format:
184191

185192
```ruby
186193
class MyMetadata < RubySaml::Metadata
187194
private
188195

189-
def add_extras(xml, _settings)
190-
xml['md'].ContactPerson('contactType' => 'technical') do
191-
xml['md'].GivenName('ACME SAML Team')
192-
xml['md'].EmailAddress('saml@acme.com')
196+
def add_extras(builder, _settings)
197+
builder.ContactPerson('contactType' => 'technical') do
198+
builder.GivenName { builder.text 'ACME SAML Team' }
199+
builder.EmailAddress { builder.text 'saml@acme.com' }
193200
end
194201
end
195202
end
@@ -199,7 +206,7 @@ end
199206

200207
RubySaml now always uses double quotes for attribute values when generating XML.
201208
The `settings.double_quote_xml_attribute_values` parameter now always behaves as `true`,
202-
and will be removed in RubySaml 2.1.0.
209+
and will be removed in RubySaml 3.0.0.
203210

204211
The reasons for this change are:
205212
- RubySaml will use Nokogiri instead of REXML to generate XML. Nokogiri does not support
@@ -252,7 +259,7 @@ a different `sp_uuid_prefix` is passed-in on subsequent calls.
252259
### Deprecation of compression settings
253260

254261
The `settings.compress_request` and `settings.compress_response` parameters have been deprecated
255-
and are no longer functional. They will be removed in RubySaml 2.1.0. Please remove `compress_request`
262+
and are no longer functional. They will be removed in RubySaml 3.0.0. Please remove `compress_request`
256263
and `compress_response` everywhere within your project code.
257264

258265
The SAML SP request/response message compression behavior is now controlled automatically by the
@@ -264,13 +271,15 @@ compression may be achieved by enabling `Content-Encoding: gzip` on your webserv
264271
### Deprecation of IdP certificate fingerprint settings
265272

266273
The `settings.idp_cert_fingerprint` and `settings.idp_cert_fingerprint_algorithm` are deprecated
267-
and will be removed in RubySaml 2.1.0. Please use `settings.idp_cert` or `settings.idp_cert_multi` instead.
268-
The reasons for this deprecation are that (1) fingerprint cannot be used with HTTP-Redirect binding,
269-
and (2) fingerprint is theoretically susceptible to collision attacks.
274+
and will be removed in RubySaml 3.0.0. Please use `settings.idp_cert` or `settings.idp_cert_multi` instead.
275+
276+
The reasons for this deprecation are:
277+
- Fingerprint cannot be used with HTTP-Redirect binding
278+
- Fingerprint is theoretically susceptible to collision attacks.
270279

271280
### Other settings deprecations
272281

273-
The following parameters in `RubySaml::Settings` are deprecated and will be removed in RubySaml 2.1.0:
282+
The following parameters in `RubySaml::Settings` are deprecated and will be removed in RubySaml 3.0.0:
274283

275284
- `#issuer` is deprecated and replaced 1:1 by `#sp_entity_id`
276285
- `#idp_sso_target_url` is deprecated and replaced 1:1 by `#idp_sso_service_url`
@@ -406,7 +415,7 @@ options = {
406415
"RelayState" => raw_query_params["RelayState"],
407416
},
408417
}
409-
slo_logout_request = OneLogin::RubySaml::SloLogoutrequest.new(query_params["SAMLRequest"], settings, options)
418+
slo_logout_request = RubySaml::SloLogoutrequest.new(query_params["SAMLRequest"], settings, options)
410419
raise "Invalid Logout Request" unless slo_logout_request.is_valid?
411420
```
412421

@@ -466,4 +475,4 @@ Version `0.9` adds many new features and improvements.
466475

467476
## Upgrading from 0.7.x to 0.8.x
468477

469-
Version `0.8.x` changes the namespace of the gem from `OneLogin::Saml` to `OneLogin::RubySaml`. Please update your implementations of the gem accordingly.
478+
Version `0.8.x` changes the namespace of the gem from `Saml` to `RubySaml`. Please update your implementations of the gem accordingly.

lib/ruby_saml.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@
3939
require 'ruby_saml/utils'
4040
require 'ruby_saml/version'
4141

42-
# @deprecated This alias adds compatibility with v1.x and will be removed in v2.1.0
42+
# @deprecated This alias adds compatibility with v1.x and will be removed in v3.0.0
4343
OneLogin = Object

0 commit comments

Comments
 (0)