Cloud CDN Singed Urls and Signed Cookies examples use time-zone unaware datetime objects #12692
Labels
priority: p2
Moderately-important priority. Fix may not be included in next release.
samples
Issues that are directly related to samples.
triage me
I really want to be triaged.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
The code snippets of Cloud CDN use naive datetime objects as expiration times and depend on deprecated datetime.utcfromtimestamp() function. It is not apparent for the users that they are supposed to pass UTC expiration datetime.
If unnoticed by a user of the snippet, this may lead to generating signatures that are valid for shorter or longer then expected.
In which file did you encounter the issue?
cdn/snippets.py
Describe the issue
If a user create an expiration datetime that depends on local timezone, e.g. by adding expiration period to
datetime.now()
, the signature may be longer or shorter than expected, depending on the local-time zone, where the code was executed.Instead, the code snippets should use time-zone aware datetime objects, to ensure that time-zone offsets are taken into account, when the signatures are calculated.
The text was updated successfully, but these errors were encountered: