properly sanitize encrypted default passwords in JT.survey_spec

see: https://github.com/ansible/ansible-tower/issues/7259
This commit is contained in:
Ryan Petrello
2017-10-04 16:03:45 -04:00
committed by Matthew Jones
parent f2d46baf09
commit 82d05e0a10
4 changed files with 21 additions and 20 deletions

View File

@@ -2851,13 +2851,8 @@ class JobTemplateSurveySpec(GenericAPIView):
if not feature_enabled('surveys'):
raise LicenseForbids(_('Your license does not allow '
'adding surveys.'))
survey_spec = obj.survey_spec
for pos, field in enumerate(survey_spec.get('spec', [])):
if field.get('type') == 'password':
if 'default' in field and field['default']:
field['default'] = '$encrypted$'
return Response(survey_spec)
return Response(obj.display_survey_spec())
def post(self, request, *args, **kwargs):
obj = self.get_object()