You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
:allowed_clock_drift should be bidrectional (allow X sec before "NotBefore" and X sec after "NotOnOrAfter"). Also improves readability of associated error messages.
error_msg="Current time is earlier than NotBefore condition (#{now_with_drift} < #{not_before})"
695
+
ifnot_before && now < (not_before -allowed_clock_drift)
696
+
error_msg="Current time is earlier than NotBefore condition (#{now} < #{not_before}#{" - #{allowed_clock_drift.ceil}s"ifallowed_clock_drift > 0})")
697
697
returnappend_error(error_msg)
698
698
end
699
699
700
-
ifnot_on_or_after && now >= (not_on_or_after_with_drift=not_on_or_after + allowed_clock_drift)
701
-
error_msg="Current time is on or after NotOnOrAfter condition (#{now} >= #{not_on_or_after_with_drift})"
700
+
ifnot_on_or_after && now >= (not_on_or_after + allowed_clock_drift)
701
+
error_msg="Current time is on or after NotOnOrAfter condition (#{now} >= #{not_on_or_after}#{" + #{allowed_clock_drift.ceil}s"ifallowed_clock_drift > 0})")
Copy file name to clipboardExpand all lines: lib/onelogin/ruby-saml/slo_logoutrequest.rb
+8-2Lines changed: 8 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -130,6 +130,12 @@ def session_indexes
130
130
131
131
private
132
132
133
+
# returns the allowed clock drift on timing validation
134
+
# @return [Float]
135
+
defallowed_clock_drift
136
+
options[:allowed_clock_drift].to_f.abs
137
+
end
138
+
133
139
# Hard aux function to validate the Logout Request
134
140
# @param collect_errors [Boolean] Stop validation when first error appears or keep validating. (if soft=true)
135
141
# @return [Boolean] TRUE if the Logout Request is valid
@@ -187,8 +193,8 @@ def validate_version
187
193
#
188
194
defvalidate_not_on_or_after
189
195
now=Time.now.utc
190
-
ifnot_on_or_after && now >= (not_on_or_after + (options[:allowed_clock_drift] || 0))
191
-
returnappend_error("Current time is on or after NotOnOrAfter (#{now} >= #{not_on_or_after})")
196
+
ifnot_on_or_after && now >= (not_on_or_after + allowed_clock_drift)
197
+
returnappend_error("Current time is on or after NotOnOrAfter (#{now} >= #{not_on_or_after}#{" + #{allowed_clock_drift.ceil}s"ifallowed_clock_drift > 0})")
0 commit comments