Fix: reject null bytes in search and permission codenames, cap the log limit, validate TOTP input

This commit is contained in:
Trenton H committed 2026-11-29 13:34:26 -08:00
1 parent d35c6e6e97
commit 641bb83860
4 files changed
+155 -5

No files matched your search

+6
View File
@@ -3,6 +3,7 @@ import logging
import os
import platform
import re
import sys
import tempfile
import zipfile
from collections import Counter
@@ -2962,6 +2963,8 @@ class LogViewSet(ViewSet):
raise ValidationError({"limit": "Must be a positive integer"})
if limit < 1:
raise ValidationError({"limit": "Must be a positive integer"})
# A limit past what a deque can hold is the same as no limit at all
limit = min(limit, sys.maxsize)
else:
limit = None
@@ -3819,6 +3822,9 @@ class GlobalSearchView(PassUserMixin):
return HttpResponseBadRequest(
f"Query must be at most {_MAX_QUERY_LENGTH} characters",
)
if "\x00" in query:
# Postgres cannot store or compare text containing a null byte
return HttpResponseBadRequest("Query must not contain null characters")
db_only = request.query_params.get("db_only", False)