Skip to content

Commit

Permalink
security fix (project-koku#3900)
Browse files Browse the repository at this point in the history
  • Loading branch information
lcouzens authored Sep 27, 2022
1 parent 0aca264 commit f0fcf4c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions koku/api/provider/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,9 @@ def create(self, validated_data):
# We can re-use a billing source or a auth, but not the same combination.
dup_queryset = Provider.objects.filter(authentication=auth).filter(billing_source=bill)
if dup_queryset.count() != 0:
conflict_provider = dup_queryset.first()
message = (
f"Cost management does not allow duplicate accounts. "
f"{conflict_provider.name} already exists. Edit source settings to configure a new source."
"Cost management does not allow duplicate accounts. "
"A source already exists with these details. Edit source settings to configure a new source."
)
LOG.warn(message)
raise serializers.ValidationError(error_obj(ProviderErrors.DUPLICATE_AUTH, message))
Expand Down Expand Up @@ -402,10 +401,9 @@ def update(self, instance, validated_data):
if instance.billing_source != bill or instance.authentication != auth:
dup_queryset = Provider.objects.filter(authentication=auth).filter(billing_source=bill)
if dup_queryset.count() != 0:
conflict_provder = dup_queryset.first()
message = (
f"Cost management does not allow duplicate accounts. "
f"{conflict_provder.name} already exists. Edit source settings to configure a new source."
"Cost management does not allow duplicate accounts. "
"A source already exists with these details. Edit source settings to configure a new source."
)
LOG.warn(message)
raise serializers.ValidationError(error_obj(ProviderErrors.DUPLICATE_AUTH, message))
Expand Down

0 comments on commit f0fcf4c

Please sign in to comment.