more hardening
This commit is contained in:
parent
26a7dd821c
commit
fac130c49c
3 changed files with 21 additions and 9 deletions
18
paranoia.py
18
paranoia.py
|
|
@ -80,12 +80,24 @@ def assert_valid_wallet_id(v:str):
|
|||
def assert_valid_timestamp_seconds(v:int):
|
||||
if not ENABLE_HARDENING:
|
||||
return
|
||||
assert_valid_int(v)
|
||||
if v < 0 and v != -1:
|
||||
panic("timestamp is negative")
|
||||
assert_valid_positive_int(v)
|
||||
if v > 2**31:
|
||||
panic("timestamp is too high")
|
||||
|
||||
|
||||
# Check if valid expiration in seconds
|
||||
def assert_valid_expiration_seconds(v: int):
|
||||
if not ENABLE_HARDENING:
|
||||
return
|
||||
assert_valid_int(v)
|
||||
if v == -1:
|
||||
return
|
||||
if v < 0:
|
||||
panic("expiration is invalid")
|
||||
if v > 2**31:
|
||||
panic("expiration is too high")
|
||||
|
||||
|
||||
# Check if string is within sane parameters
|
||||
def assert_sane_string(v:str):
|
||||
if not ENABLE_HARDENING:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue