Release v1.7.15: security hardening, async auth, CSP tightening, model validation, SSRF guard, rate limiting improvements, frontend extraction, Docker compose security
Release / build-and-push (push) Successful in 3m12s
Release / build-and-push (push) Successful in 3m12s
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
"""Alert management endpoints."""
|
||||
|
||||
import re
|
||||
from typing import Literal
|
||||
|
||||
from auth import require_auth
|
||||
from bson import ObjectId
|
||||
from database import alerts_collection
|
||||
@@ -10,7 +13,7 @@ router = APIRouter(dependencies=[Depends(require_auth)])
|
||||
|
||||
|
||||
class AlertStatusUpdate(BaseModel):
|
||||
status: str # open | acknowledged | resolved | false_positive
|
||||
status: Literal["open", "acknowledged", "resolved", "false_positive"]
|
||||
|
||||
|
||||
class AlertListResponse(BaseModel):
|
||||
@@ -32,7 +35,7 @@ def list_alerts(
|
||||
if severity:
|
||||
query["severity"] = severity
|
||||
if rule_name:
|
||||
query["rule_name"] = {"$regex": rule_name, "$options": "i"}
|
||||
query["rule_name"] = {"$regex": re.escape(rule_name), "$options": "i"}
|
||||
|
||||
total = alerts_collection.count_documents(query)
|
||||
skip = (page - 1) * page_size
|
||||
|
||||
Reference in New Issue
Block a user