T05 · Unauthorized Access and Privilege Escalation
- Location
src/main.py:29- Finding
Missing Authentication Across Sensitive and State-Changing APIs
- Content
View full analysis
str: """验证 API Key""" # 如果没配置 API Key,跳过验证 if not API_KEY: return "dev" # 验证 if not api_key: raise HTTPException( status_code=401, detail="请提供 API Key" ) if api_key != API_KEY: raise HTTPException( status_code=403, detail="API Key 无效" ) return api_key def require_auth(): """认证依赖""" return Depends(verify_api_key) ``` ### Technical Analysis An API-key verification function exists, but none of the application routers or individual endpoints apply `require_auth()` or `verify_api_key`. Consequently, every route is accessible without authentication. The authentication implementation also fails open when `WORKSWITH_CLAW_API_KEY` is empty. This is particularly dangerous because the documented launch command binds the application to `0.0.0.0`, and the Docker configuration leaves the API key empty while using host ...[truncated 1267 chars]- Remediation
View remediation
