Skip to content

Commit

Permalink
Don't send SCRAM mechanism name in server-final Authentication-Info.
Browse files Browse the repository at this point in the history
Look up correct permission creation serializers by API version.
  • Loading branch information
C. Weaver committed Oct 3, 2023
1 parent 3366c45 commit b7acdd3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scimma_admin/hopskotch_auth/api_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def middleware(request):
scram_state = request.META.get("scram_state", None)
if scram_state:
sfinal=base64.b64encode(scram_state.s.get_server_final().encode("utf-8")).decode('utf-8')
response["Authentication-Info"]=f"{scram_state.mech} sid={scram_state.sid}, data={sfinal}"
response["Authentication-Info"]=f"sid={scram_state.sid}, data={sfinal}"
return response
return middleware

Expand Down Expand Up @@ -1273,7 +1273,7 @@ def create(self, request, *args, **kwargs):
logger.info(f"User {request.user.username} ({request.user.email}) "
f"requested to create a group permission "
f"from {client_ip(request)}")
serializer = GroupKafkaPermissionCreateSerializer(data=request.data)
serializer = serializers[self.kwargs.get("version",current_api_version)].GroupKafkaPermissionCreateSerializer(data=request.data)
serializer.is_valid(raise_exception=True)

topic = serializer.validated_data['topic']
Expand All @@ -1282,7 +1282,7 @@ def create(self, request, *args, **kwargs):
if not self.request.user.is_staff and not is_group_owner(self.request.user.id, topic.owning_group):
raise PermissionDenied

perm = add_kafka_permission_for_group(serializer.validated_data['principal'].id,
perm = add_kafka_permission_for_group(serializer.validated_data['principal'],
serializer.validated_data['topic'],
serializer.validated_data['operation'])

Expand Down Expand Up @@ -1372,7 +1372,7 @@ def create(self, request, *args, **kwargs):
logger.info(f"User {request.user.username} ({request.user.email}) "
f"requested to add a permission to SCRAM credential {kwargs.get('cred','<missing>')} "
f"from {client_ip(request)}")
serializer = CredentialKafkaPermissionCreationSerializer(data=request.data)
serializer = serializers[self.kwargs.get("version",current_api_version)].CredentialKafkaPermissionCreationSerializer(data=request.data)
serializer.is_valid(raise_exception=True)

principal = serializer.validated_data["principal"]
Expand Down

0 comments on commit b7acdd3

Please sign in to comment.