feat(B-RL): Rate-Limiting Konsistenz — zentrale Policies für Auth/AI/Upload/Webhook
Check Cross-Plugin Imports / check (push) Has been cancelled
Check Cross-Plugin Imports / check (push) Has been cancelled
B-RL: Rate-Limiting auf zentrale check_rate_limit() umgestellt - forgejo_error_reporter: In-Memory → zentrale Redis-Rate-Limit - ai_proactive: eigene Redis-Logik → zentrale check_rate_limit() - agent_runner: DB-basiertes Limit bleibt (zählt echte Ausführungen) - RateLimitPolicy Enum (AUTH/AI/UPLOAD/WEBHOOK) + check_rate_limit_policy() - 8 neue config.py Settings für Policy-Limits - 12 Routes mit Policies versehen (login, password-reset, AI, uploads, webhooks) Tests: 20 Tests in test_rate_limit_policies.py — alle grün - Policies, check_rate_limit, reset, get_client_ip, forgejo, ai_proactive - Keine Regression: 116 bestehende Tests grün
This commit is contained in:
@@ -494,6 +494,13 @@ async def upload_file(
|
||||
user_id = uuid.UUID(current_user["user_id"])
|
||||
fid = _parse_uuid(folder_id, "folder_id") if folder_id else None
|
||||
|
||||
# Rate limit — UPLOAD policy
|
||||
from app.core.rate_limit import RateLimitPolicy, check_rate_limit_policy
|
||||
await check_rate_limit_policy(
|
||||
f"rate:upload:dms:{tenant_id}:{user_id}",
|
||||
RateLimitPolicy.UPLOAD,
|
||||
)
|
||||
|
||||
# Check for blocked file types
|
||||
if _is_blocked_filetype(file.filename or ""):
|
||||
raise HTTPException(
|
||||
|
||||
Reference in New Issue
Block a user