(token: str, request: Request = None)
| 222 | SECURITY_TOKEN = os.environ.get("SECURITY_TOKEN") or config.get("token", "") or config.get("security_token", "") |
| 223 | |
| 224 | def validate_token(token: str, request: Request = None) -> None: |
| 225 | if SECURITY_TOKEN and token != SECURITY_TOKEN: |
| 226 | client_ip = request.client.host if request and request.client else "unknown" |
| 227 | logger.warning(f"Authentication failed from IP: {client_ip}") |
| 228 | raise HTTPException(status_code=403, detail="Invalid security token") |
| 229 | |
| 230 | def load_history() -> list: |
| 231 | try: |
no outgoing calls
no test coverage detected