feat: enhance backend security and configuration
- Updated Dockerfile to improve security with a non-root user and added health checks. - Modified docker-compose.yml to set containers as read-only, restrict ports to localhost, and implement health checks. - Enhanced .env.example with additional environment variables for security and configuration. - Improved FastAPI application with middleware for security headers, CORS, and body size limits. - Refactored authentication flow in auth.py to include state validation and improved error handling. - Added rate limiting to various endpoints to prevent abuse. - Updated researcher and publication handling to ensure better validation and error management.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
"""
|
||||
Schemas de los endpoints de export.
|
||||
|
||||
El backend recibe `pub_ids` como UUIDs en formato string. Pydantic ya los
|
||||
valida y convierte; aquí además aplicamos un tope de tamaño para impedir
|
||||
peticiones gigantes.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List
|
||||
from uuid import UUID
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from app.core.config import settings
|
||||
|
||||
|
||||
class PublicationIdsRequestSchema(BaseModel):
|
||||
pub_ids: List[UUID] = Field(
|
||||
min_length=1,
|
||||
max_length=settings.MAX_PUB_IDS_BATCH,
|
||||
)
|
||||
Reference in New Issue
Block a user