Skip to content

Commit 6d791df

Browse files
ashnaaseth2325-ossbjester
authored andcommitted
fix: validate channel_id as UUID before querying in remove_self
1 parent 04fa1f2 commit 6d791df

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • contentcuration/contentcuration/viewsets

contentcuration/contentcuration/viewsets/user.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
from contentcuration.viewsets.sync.constants import DELETED
5252
from contentcuration.viewsets.sync.constants import EDITOR_M2M
5353
from contentcuration.viewsets.sync.constants import VIEWER_M2M
54-
54+
import uuid
5555

5656
logger = logging.getLogger(__name__)
5757

@@ -341,6 +341,10 @@ def remove_self(self, request, pk=None):
341341

342342
if not channel_id:
343343
return HttpResponseBadRequest("Channel ID is required.")
344+
try:
345+
uuid.UUID(channel_id)
346+
except ValueError:
347+
return HttpResponseBadRequest("Invalid channel ID")
344348

345349
try:
346350
channel = Channel.objects.get(id=channel_id)

0 commit comments

Comments
 (0)