certego / .github

CI repo for Certego DevOps
https://www.certego.net
5 stars 0 forks source link

use CodeQL to create alerts on blocked libraries/function #120

Open 0ssigeno opened 1 year ago

0ssigeno commented 1 year ago

We have discovered that mongo, every time you save a date on the DB, removes the timezone. This means that the following code will generate an error


obj = klass.objects.create(time=now()) # now of django.utils.timezone
max(obj.time, now())  # no error, the value is not retrieved from the db
obj.reload("time") # reloading the field with the actual value from mongo
max(obj.time, now())  # TypeError: can't compare offset-naive and offset-aware datetimes

We could leverage CodeQL to write queries that generate alerts for these kind of issues at org level