samlr 2.7.1.pre.3 → 2.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99111c7af501ed1d300602d81d603fe0869e042dc9b330cb38aa800c77a79517
4
- data.tar.gz: 755f39f3397bdff3454a05bd47c329ebbf0440c4103469153ed3518bf1aa47c1
3
+ metadata.gz: 981235b1e8b9c47db48aa1ad9dd69103f68766c4e9f247980e2482f5c0130f38
4
+ data.tar.gz: ffda22321c9f2cb8564681747e426f59dc9cd77aed0761bb71e88d5c43ac393d
5
5
  SHA512:
6
- metadata.gz: 49bb0ebfda779df0a6950eaedac7487b5c1a03475b488573b028d4b86b51a1cbf16c641ad09f15e3bae9bc8717795572d59103590b456b82f22879347881a4d2
7
- data.tar.gz: f111bab5d4b7f933bf217b7bd0a2c89d179768409fc0215e78e9c0a739ebf8bf5860fb481ec4c94da9e352da7c6975f8293003acc19160c03d04e2ae38bd8577
6
+ metadata.gz: 3001de515250f4deb3fff83454aab102c7c72a712304206a88a398b4a5db4f0aa00fc618ae9c85964b8ccfd60cefbc7b13b2fccb50820851b8257e22943a64af
7
+ data.tar.gz: df04ff380856705c2b15ce7bdbde71708c12d5d8ae3c518debfcd6f7042987fd7b347433bb09eb7f69f5391ac5f30feb3589756e51e34fa3b0da30d068b62700
@@ -17,14 +17,8 @@ module Samlr
17
17
  @options = options
18
18
  @signature = nil
19
19
 
20
- # TODO: This option exists only in a pre-release version to allow testing the feature; remove it from the final release
21
- if options[:skip_signature_reference_checking]
22
- @signature = @document.at("#{prefix}/ds:Signature", NS_MAP)
23
- @signature.remove if @signature # enveloped signatures only
24
- else
25
- id = @document.at("#{prefix}", NS_MAP)&.attribute('ID')
26
- @signature = find_signature_for_element_id(id) if id
27
- end
20
+ id = @document.at("#{prefix}", NS_MAP)&.attribute('ID')
21
+ @signature = find_signature_for_element_id(id) if id
28
22
 
29
23
  @fingerprint = if options[:fingerprint]
30
24
  Fingerprint.from_string(options[:fingerprint])
@@ -45,28 +39,17 @@ module Samlr
45
39
  raise SignatureError.new("No signature at #{prefix}/ds:Signature") unless present?
46
40
 
47
41
  verify_fingerprint! unless options[:skip_fingerprint]
48
- if options[:skip_signature_reference_checking]
49
- verify_digests!
50
- verify_signature!
51
- else
52
- verify_signature! # <- Do this first while signature is still available
53
- verify_digests! # <- This can remove the signature
54
- end
42
+ verify_signature! # Do this first while signature is still available
43
+ verify_digests! # This may remove enveloped signatures
55
44
 
56
45
  true
57
46
  end
58
47
 
59
48
  def references
60
49
  @references ||= [].tap do |refs|
61
- if options[:skip_signature_reference_checking]
62
- original.xpath("#{prefix}/ds:Signature/ds:SignedInfo/ds:Reference[@URI]", NS_MAP).each do |ref|
63
- refs << Samlr::Reference.new(ref)
64
- end
65
- else
66
- refs_xpath = @signature.xpath("./ds:SignedInfo/ds:Reference[@URI]", NS_MAP)
67
- refs_xpath.each do |ref|
68
- refs << Samlr::Reference.new(ref)
69
- end
50
+ refs_xpath = @signature.xpath("./ds:SignedInfo/ds:Reference[@URI]", NS_MAP)
51
+ refs_xpath.each do |ref|
52
+ refs << Samlr::Reference.new(ref)
70
53
  end
71
54
 
72
55
  end
@@ -85,58 +68,39 @@ module Samlr
85
68
 
86
69
  # Tests that the document content has not been edited
87
70
  def verify_digests!
88
- if options[:skip_signature_reference_checking]
89
- references.each do |reference|
90
- node = referenced_node(reference.uri)
91
- canoned = node.canonicalize(C14N, reference.namespaces)
92
- digest = reference.digest_method.digest(canoned)
93
-
94
- if digest != reference.decoded_digest_value
95
- raise SignatureError.new("Reference validation error: Digest mismatch for #{reference.uri}")
96
- end
97
- end
98
- else
99
- # Check if we need to remove an enveloped signature
100
- if @signature && !@signature_removed
101
- signed_element = @document.at("#{prefix}", NS_MAP)
102
- is_enveloped = signed_element&.xpath(".//ds:Signature", NS_MAP)&.include?(@signature)
103
-
104
- # Remove enveloped signature for digest verification
105
- if is_enveloped
106
- @signature.remove
107
- @signature_removed = true
108
- end
71
+ # Check if we need to remove an enveloped signature
72
+ if @signature && !@signature_removed
73
+ signed_element = @document.at("#{prefix}", NS_MAP)
74
+ is_enveloped = signed_element&.xpath(".//ds:Signature", NS_MAP)&.include?(@signature)
75
+
76
+ # Remove enveloped signature for digest verification
77
+ if is_enveloped
78
+ @signature.remove
79
+ @signature_removed = true
109
80
  end
81
+ end
110
82
 
111
- references.each do |reference|
112
- node = referenced_node(reference.uri)
113
- canoned = node.canonicalize(C14N, reference.namespaces)
114
- digest = reference.digest_method.digest(canoned)
83
+ references.each do |reference|
84
+ node = referenced_node(reference.uri)
85
+ canoned = node.canonicalize(C14N, reference.namespaces)
86
+ digest = reference.digest_method.digest(canoned)
115
87
 
116
- if digest != reference.decoded_digest_value
117
- raise SignatureError.new("Reference validation error: Digest mismatch for #{reference.uri}")
118
- end
88
+ if digest != reference.decoded_digest_value
89
+ raise SignatureError.new("Reference validation error: Digest mismatch for #{reference.uri}")
119
90
  end
120
91
  end
121
92
  end
122
93
 
123
94
  # Tests correctness of the signature (and hence digests)
124
95
  def verify_signature!
125
- if options[:skip_signature_reference_checking]
126
- node = original.at("#{prefix}/ds:Signature/ds:SignedInfo", NS_MAP)
127
- canoned = node.canonicalize(C14N)
128
- unless x509.public_key.verify(signature_method.new, decoded_signature_value, canoned)
129
- raise SignatureError.new("Signature validation error: Possible canonicalization mismatch", "This canonicalizer returns #{canoned}")
130
- end
131
- else
132
- # Cache the canonicalized SignedInfo to avoid DOM issues with multiple verifications
133
- unless @canonicalized_signed_info
134
- node = @signature.at("./ds:SignedInfo", NS_MAP)
135
- @canonicalized_signed_info = node.canonicalize(C14N)
136
- end
137
- unless x509.public_key.verify(signature_method.new, decoded_signature_value, @canonicalized_signed_info)
138
- raise SignatureError.new("Signature validation error: Possible canonicalization mismatch", "This canonicalizer returns #{@canonicalized_signed_info}")
139
- end
96
+ # Cache the canonicalized SignedInfo to avoid DOM issues with multiple verifications
97
+ unless @canonicalized_signed_info
98
+ node = @signature.at("./ds:SignedInfo", NS_MAP)
99
+ @canonicalized_signed_info = node.canonicalize(C14N)
100
+ end
101
+
102
+ unless x509.public_key.verify(signature_method.new, decoded_signature_value, @canonicalized_signed_info)
103
+ raise SignatureError.new("Signature validation error: Possible canonicalization mismatch", "This canonicalizer returns #{@canonicalized_signed_info}")
140
104
  end
141
105
  end
142
106
 
data/lib/samlr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Samlr
2
- VERSION = "2.7.1.pre.3"
2
+ VERSION = "2.7.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: samlr
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.1.pre.3
4
+ version: 2.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Morten Primdahl
@@ -9,34 +9,6 @@ bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
- - !ruby/object:Gem::Dependency
13
- name: nokogiri
14
- requirement: !ruby/object:Gem::Requirement
15
- requirements:
16
- - - ">="
17
- - !ruby/object:Gem::Version
18
- version: 1.5.5
19
- type: :runtime
20
- prerelease: false
21
- version_requirements: !ruby/object:Gem::Requirement
22
- requirements:
23
- - - ">="
24
- - !ruby/object:Gem::Version
25
- version: 1.5.5
26
- - !ruby/object:Gem::Dependency
27
- name: uuidtools
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 2.1.3
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: 2.1.3
40
12
  - !ruby/object:Gem::Dependency
41
13
  name: base64
42
14
  requirement: !ruby/object:Gem::Requirement
@@ -52,7 +24,7 @@ dependencies:
52
24
  - !ruby/object:Gem::Version
53
25
  version: '0'
54
26
  - !ruby/object:Gem::Dependency
55
- name: logger
27
+ name: cgi
56
28
  requirement: !ruby/object:Gem::Requirement
57
29
  requirements:
58
30
  - - ">="
@@ -66,27 +38,13 @@ dependencies:
66
38
  - !ruby/object:Gem::Version
67
39
  version: '0'
68
40
  - !ruby/object:Gem::Dependency
69
- name: rake
70
- requirement: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: '0'
75
- type: :development
76
- prerelease: false
77
- version_requirements: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- version: '0'
82
- - !ruby/object:Gem::Dependency
83
- name: bundler
41
+ name: logger
84
42
  requirement: !ruby/object:Gem::Requirement
85
43
  requirements:
86
44
  - - ">="
87
45
  - !ruby/object:Gem::Version
88
46
  version: '0'
89
- type: :development
47
+ type: :runtime
90
48
  prerelease: false
91
49
  version_requirements: !ruby/object:Gem::Requirement
92
50
  requirements:
@@ -94,47 +52,33 @@ dependencies:
94
52
  - !ruby/object:Gem::Version
95
53
  version: '0'
96
54
  - !ruby/object:Gem::Dependency
97
- name: bump
55
+ name: nokogiri
98
56
  requirement: !ruby/object:Gem::Requirement
99
57
  requirements:
100
58
  - - ">="
101
59
  - !ruby/object:Gem::Version
102
- version: '0'
103
- type: :development
60
+ version: 1.5.5
61
+ type: :runtime
104
62
  prerelease: false
105
63
  version_requirements: !ruby/object:Gem::Requirement
106
64
  requirements:
107
65
  - - ">="
108
66
  - !ruby/object:Gem::Version
109
- version: '0'
110
- - !ruby/object:Gem::Dependency
111
- name: minitest
112
- requirement: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - "~>"
115
- - !ruby/object:Gem::Version
116
- version: '6.0'
117
- type: :development
118
- prerelease: false
119
- version_requirements: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - "~>"
122
- - !ruby/object:Gem::Version
123
- version: '6.0'
67
+ version: 1.5.5
124
68
  - !ruby/object:Gem::Dependency
125
- name: minitest-mock
69
+ name: uuidtools
126
70
  requirement: !ruby/object:Gem::Requirement
127
71
  requirements:
128
72
  - - ">="
129
73
  - !ruby/object:Gem::Version
130
- version: '0'
131
- type: :development
74
+ version: 2.1.3
75
+ type: :runtime
132
76
  prerelease: false
133
77
  version_requirements: !ruby/object:Gem::Requirement
134
78
  requirements:
135
79
  - - ">="
136
80
  - !ruby/object:Gem::Version
137
- version: '0'
81
+ version: 2.1.3
138
82
  description: Helps you implement a SAML SP
139
83
  email: primdahl@me.com
140
84
  executables:
@@ -187,7 +131,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
187
131
  requirements:
188
132
  - - ">="
189
133
  - !ruby/object:Gem::Version
190
- version: '2.7'
134
+ version: '3.2'
191
135
  required_rubygems_version: !ruby/object:Gem::Requirement
192
136
  requirements:
193
137
  - - ">="