T09 · Insecure Skill Coding Practices
- Location
assets/server_template.py:1025- Finding
Unauthenticated Network-Wide Exposure of Skill Execution Endpoints
- Content
View full analysis
None: if not FLASH_API_KEY: return key = request.headers.get(API_KEY_HEADER_NAME, "").strip() # Constant-time comparison if not hmac.compare_digest(key, FLASH_API_KEY): raise HTTPException( status_code=401, detail="Unauthorized: invalid or missing API key", ) ``` ```python @app.post("/run") async def run_sync(req: RunRequest, request: _Request): """Synchronous execution through subprocess.run.""" _check_api_key(request) params = _extract_params(req) start = time.time() try: _validate_input(params) except FlashError as e: elapsed = int((time.time() - start) * 1000) logger.warning(f"validation_failed: {e.message}") return _envelope_error(e.error_type, e.message, elapsed, http_status=400) try: argv = _build_argv(params) except FlashError as e: elapsed = int((time.time() - start) * 1000) logger.warning(f"{e.error_type}: {e.message}") return _envelope_error( e.error_type, e.message, elapsed, http_status=500 if e.error_type == "entry_not_found" else 400, ) try: proc, stdout_truncated, stderr_truncated = _run_subprocess( argv, req.timeout_seconds, truncate=True, ...[truncated 2822 chars]- Remediation
View remediation
