Signature time cheching tollerance

main
Bob Mottram 2023-02-21 13:26:17 +00:00
parent 78db0d7084
commit defa0e2c44
2 changed files with 4 additions and 3 deletions

View File

@ -312,13 +312,14 @@ def _verify_recent_signature(signed_date_str: str) -> bool:
break
if not signed_date:
return False
time_diff_sec = (curr_date - signed_date).seconds
time_diff_sec = (curr_date - signed_date).total_seconds()
# 12 hours tollerance
if time_diff_sec > 43200:
print('WARN: Header signed too long ago: ' + signed_date_str + ' ' +
str(time_diff_sec / (60 * 60)) + ' hours')
return False
if time_diff_sec < 0:
# allow clocks to be off by a few mins
if time_diff_sec < -480:
print('WARN: Header signed in the future! ' + signed_date_str + ' ' +
str(time_diff_sec / (60 * 60)) + ' hours')
return False

View File

@ -5984,7 +5984,7 @@ def seconds_between_published(published1: str, published2: str) -> int:
print('EX: seconds_between_published unable to parse date 2 ' +
str(published2))
return -1
return (published2_time - published1_time).seconds
return (published2_time - published1_time).total_seconds()
def edited_post_filename(base_dir: str, nickname: str, domain: str,