Skip to content

Commit

Permalink
validate pk in job api url
Browse files Browse the repository at this point in the history
  • Loading branch information
akihikokuroda committed Sep 18, 2024
1 parent 4089372 commit 0311be4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gateway/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import logging
import mimetypes
import os
import re
import time
from typing import Optional
from wsgiref.util import FileWrapper
Expand Down Expand Up @@ -436,6 +437,9 @@ def get_serializer_class(self):
return self.serializer_class

def get_queryset(self):
pk = self.kwargs.get("pk")
if pk and not re.match("^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$", pk, re.IGNORECASE):
return None
type_filter = self.request.query_params.get("filter")
if type_filter:
if type_filter == "catalog":
Expand Down

0 comments on commit 0311be4

Please sign in to comment.