saml-kit 1.5.0 → 1.5.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -2
- data/Gemfile.lock +1 -1
- data/lib/saml/kit/concerns/xsd_validatable.rb +33 -6
- data/lib/saml/kit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 55bb650eff422a517582801633097c71478c4294f5cc8a4ff5bd3842545609ff
|
|
4
|
+
data.tar.gz: 2b9dfe74c62d2c04cd83453f9a579a4192a854b87124de15e92d49375d31000b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b89dcaf5a139f92e8bd641bada1226a738aaaf92a06dbfcf2004f628f4e7f56822ae4aad6276f961bb1cce7b4e9482e388d3b0e24ce90b431ab7fd187d1b3db9
|
|
7
|
+
data.tar.gz: a98cb7a584d24fe7a0a7093d6e1028c27d777c2d26a42b621d1d5793adee1bc7e214140a2bcaeb04d14f74ee82519cdbb01ae7fbe774d005f0567a7a07c1739d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Version 1.5.
|
|
1
|
+
Version 1.5.1
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
All notable changes to this project will be documented in this file.
|
|
@@ -8,6 +8,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [1.5.1] - 2026-08-18
|
|
12
|
+
### Fixed
|
|
13
|
+
- Compile the SAML XSDs without `Dir.chdir`. Schema compilation ran inside a
|
|
14
|
+
`Dir.chdir` block, which mutates process global state, so two threads
|
|
15
|
+
validating a document at the same time could raise `conflicting chdir during
|
|
16
|
+
another chdir block`. Each schema is now parsed as a document carrying its own
|
|
17
|
+
path, so its relative imports resolve without changing the working directory.
|
|
18
|
+
- Compile each XSD once instead of on every `valid?` call.
|
|
19
|
+
|
|
11
20
|
## [1.5.0] - 2026-08-17
|
|
12
21
|
### Security
|
|
13
22
|
- Reject a `Response` or `Assertion` that carries no signature. A registered
|
|
@@ -142,7 +151,8 @@ exploitable or is a side effect of closing one that was.
|
|
|
142
151
|
### Removed
|
|
143
152
|
- Removed optional SessionNotOnOrAfter attribute from AuthnStatement.
|
|
144
153
|
|
|
145
|
-
[Unreleased]: https://github.com/xlgmokha/saml-kit/compare/v1.5.
|
|
154
|
+
[Unreleased]: https://github.com/xlgmokha/saml-kit/compare/v1.5.1...HEAD
|
|
155
|
+
[1.5.1]: https://github.com/xlgmokha/saml-kit/compare/v1.5.0...v1.5.1
|
|
146
156
|
[1.5.0]: https://github.com/xlgmokha/saml-kit/compare/v1.4.1...v1.5.0
|
|
147
157
|
[1.4.1]: https://github.com/xlgmokha/saml-kit/compare/v1.4.0...v1.4.1
|
|
148
158
|
[1.4.0]: https://github.com/xlgmokha/saml-kit/compare/v1.3.0...v1.4.0
|
data/Gemfile.lock
CHANGED
|
@@ -13,15 +13,42 @@ module Saml
|
|
|
13
13
|
'../xsd/saml-schema-metadata-2.0.xsd', File.dirname(__FILE__)
|
|
14
14
|
).freeze
|
|
15
15
|
|
|
16
|
+
@schemas = {}
|
|
17
|
+
@monitor = Mutex.new
|
|
18
|
+
|
|
19
|
+
class << self
|
|
20
|
+
# Validation treats a schema as read only, so one instance is shared
|
|
21
|
+
# across threads. The hit path reads without the lock, which at worst
|
|
22
|
+
# compiles the same schema twice on rubies that lack a global lock.
|
|
23
|
+
#
|
|
24
|
+
# @!visibility private
|
|
25
|
+
def schema_for(path)
|
|
26
|
+
@schemas[path] || @monitor.synchronize do
|
|
27
|
+
@schemas[path] ||= compile(path)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
# The xsd is parsed as a document carrying its own path as a base uri,
|
|
34
|
+
# so the relative schemaLocation imports in our xsds resolve against
|
|
35
|
+
# the xsd's own directory. A bare String carries no base uri and would
|
|
36
|
+
# resolve them against the working directory instead, which is what
|
|
37
|
+
# Dir.chdir used to paper over at the cost of crashing under threads.
|
|
38
|
+
def compile(path)
|
|
39
|
+
Nokogiri::XML::Schema.from_document(
|
|
40
|
+
Nokogiri::XML::Document.parse(File.read(path), url: path)
|
|
41
|
+
)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
16
45
|
# @!visibility private
|
|
17
|
-
def matches_xsd?(
|
|
46
|
+
def matches_xsd?(path)
|
|
18
47
|
return unless to_nokogiri.present?
|
|
19
48
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
errors.add(:base, error.message)
|
|
24
|
-
end
|
|
49
|
+
schema = XsdValidatable.schema_for(path)
|
|
50
|
+
schema.validate(to_nokogiri.document).each do |error|
|
|
51
|
+
errors.add(:base, error.message)
|
|
25
52
|
end
|
|
26
53
|
end
|
|
27
54
|
end
|
data/lib/saml/kit/version.rb
CHANGED