amazon-web-servicesboto3

Is it possible to make boto3 ignore signature expired error?


I was testing a Python app using boto3 to access DynamoDB and I got the following error message from boto3.

{'error': 
    {'Message': u'Signature expired: 20160915T000000Z is now earlier than 20170828T180022Z (20170828T181522Z - 15 min.)', 
     'Code': u'InvalidSignatureException'}}

I noticed that it's because I'm using the python package 'freezegun.free_time' to freeze the time at 20160915, since the mock data used by the tests is static.

I did research the error a little bit and I found this answer post. Basically, it's saying that AWS makes signatures invalid after a short time after they are created. From my understanding, in my case, the signature is marked to be created at 20160915 because of the use of 'freeze_time', but AWS uses the current time (the time when the test runs). Therefore, AWS thinks that this signature has expired for almost a year and sends an error message back.

Is there any way to make AWS ignore that error? Or is it possible to use boto3 to manually modify the date and time the signature is created at?

Please let me know if I'm not explaining my questions clearly. Any ideas are appreciated.


Solution

  • AWS API calls use a timestamp to prevent replay attacks. If you computer time/date is skewed too far from actual time, then the API calls will be denied.

    Running requests from a computer with the date set to 2016 would certainly trigger this failure situation.

    The checking is done on the host side, so there is nothing you can fix locally aside from using the real date (or somehow forcing Python into using a different date to the rest of your system).