mirror of
https://github.com/ansible/awx.git
synced 2026-03-20 10:27:34 -02:30
Use sha1 with hmac.new instead of md5
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
# Python
|
# Python
|
||||||
import datetime
|
import datetime
|
||||||
|
import hashlib
|
||||||
import hmac
|
import hmac
|
||||||
import logging
|
import logging
|
||||||
from urlparse import urljoin
|
from urlparse import urljoin
|
||||||
@@ -152,7 +153,7 @@ class AdHocCommand(UnifiedJob, JobNotificationMixin):
|
|||||||
def task_auth_token(self):
|
def task_auth_token(self):
|
||||||
'''Return temporary auth token used for task requests via API.'''
|
'''Return temporary auth token used for task requests via API.'''
|
||||||
if self.status == 'running':
|
if self.status == 'running':
|
||||||
h = hmac.new(settings.SECRET_KEY, self.created.isoformat())
|
h = hmac.new(settings.SECRET_KEY, self.created.isoformat(), digestmod=hashlib.sha1)
|
||||||
return '%d-%s' % (self.pk, h.hexdigest())
|
return '%d-%s' % (self.pk, h.hexdigest())
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
# Python
|
# Python
|
||||||
import datetime
|
import datetime
|
||||||
|
import hashlib
|
||||||
import hmac
|
import hmac
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
@@ -480,7 +481,7 @@ class Job(UnifiedJob, JobOptions, SurveyJobMixin, JobNotificationMixin):
|
|||||||
def task_auth_token(self):
|
def task_auth_token(self):
|
||||||
'''Return temporary auth token used for task requests via API.'''
|
'''Return temporary auth token used for task requests via API.'''
|
||||||
if self.status == 'running':
|
if self.status == 'running':
|
||||||
h = hmac.new(settings.SECRET_KEY, self.created.isoformat())
|
h = hmac.new(settings.SECRET_KEY, self.created.isoformat(), digestmod=hashlib.sha1)
|
||||||
return '%d-%s' % (self.pk, h.hexdigest())
|
return '%d-%s' % (self.pk, h.hexdigest())
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
Reference in New Issue
Block a user