There was an error while loading. Please reload this page.
1 parent 6a0d421 commit d599cc2Copy full SHA for d599cc2
1 file changed
lib/hooks/plugins/auth/hmac.rb
@@ -249,9 +249,13 @@ def self.parse_iso8601_timestamp(timestamp_value)
249
if timestamp_value =~ /\A(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2}(?:\.\d+)?)(?: )\+0000\z/
250
timestamp_value = "#{$1}T#{$2}+00:00"
251
end
252
+ # Ensure the timestamp explicitly includes a UTC indicator
253
+ return nil unless timestamp_value =~ /(Z|\+00:00|\+0000)\z/
254
return nil unless iso8601_timestamp?(timestamp_value)
255
t = Time.parse(timestamp_value) rescue nil
256
return nil unless t
257
+ # The check for UTC indicator in regex makes this t.utc? or t.utc_offset == 0 redundant
258
+ # but kept for safety, though it should always be true now if Time.parse succeeds.
259
(t.utc? || t.utc_offset == 0) ? t.to_i : nil
260
261
0 commit comments