Puestas de seguridad y limpieza de codigo

This commit is contained in:
2026-02-25 10:34:11 -06:00
parent 96757ffdd2
commit e4d4d0cce6
11 changed files with 88 additions and 53 deletions

View File

@@ -44,7 +44,6 @@ class Settings(BaseSettings):
SYNC_SECRET_TOKEN: str = "change-this-sync-token-in-production"
CENTRAL_SERVER_URL: str = "http://localhost:8000/api/v1/core/help-center/sync/"
SPOKE_URLS: str = "" # Comma separated list of Spoke URLs for Broadcast (Hub only)
CLIENT_UUID: str = "" # Unique identifier for this Client instance (Spoke only)
# CORS
CORS_ORIGINS: str = "http://localhost:5173,http://localhost:3000"

View File

@@ -106,6 +106,10 @@ def has_role(required_role: str):
user_roles = current_user.get("realm_access", {}).get("roles", [])
if required_role not in user_roles:
logger.warning(f"Role denied. Required: {required_role}. User actually has: {user_roles}")
# Also check client roles as a debug fallback
client_roles = current_user.get("resource_access", {})
logger.warning(f"User client roles: {client_roles}")
raise HTTPException(
status_code=403,
detail=f"User does not have required role: {required_role}",