1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

Merge pull request #627 from ryanpetrello/fix-7898

enforce strings for secret password inputs on Credentials
This commit is contained in:
Ryan Petrello 2018-02-12 17:11:02 -05:00 committed by GitHub
commit eda53eb548
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -499,6 +499,12 @@ class CredentialInputField(JSONSchemaField):
v != '$encrypted$',
model_instance.pk
]):
if not isinstance(getattr(model_instance, k), six.string_types):
raise django_exceptions.ValidationError(
_('secret values must be of type string, not {}').format(type(v).__name__),
code='invalid',
params={'value': v},
)
decrypted_values[k] = utils.decrypt_field(model_instance, k)
else:
decrypted_values[k] = v