jwt_tool icon indicating copy to clipboard operation
jwt_tool copied to clipboard

Handling of very large timestamps

Open richardkirner-seon opened this issue 3 years ago • 1 comments

The tool does not handle extremely large timestamps (e.g.: 1001662538673) properly and crashes. The dissectPayl function should be patched like this:

def dissectPayl(paylDict, count=False):
    timeseen = 0
    comparestamps = []
    countval = 0
    expiredtoken = False
    nowtime = int(datetime.now().timestamp())
    for claim in paylDict:
        countval += 1
        if count:
            placeholder = str(countval)
        else:
            placeholder = "+"
        if claim in ["exp", "nbf", "iat"]:
            if int(paylDict[claim]) > 10000000000:
                timestamp = datetime.fromtimestamp(10000000000)
            else:
                timestamp = datetime.fromtimestamp(int(paylDict[claim]))

richardkirner-seon avatar Sep 15 '22 13:09 richardkirner-seon

Any chance this will get fixed? I run into this on a pretty regular basis

liquidsec avatar Nov 30 '22 19:11 liquidsec