fix(security): require auth on six unauthenticated API routes (GHSA-xh98-w6qh-cr44) (#886)
Six /api/* routes shipped without any authentication dependency, allowing unauthenticated cross-tenant disclosure and pre-auth state changes: GET /api/agents/dashboard/agents (cross-tenant agent inventory) GET /api/incidents/.../alerts/not-created (live alert backlog) POST /api/incidents/.../create/auto (alert creation) POST /api/carbonblack/provision (EDR provisioning) GET /api/carbonblack/test (EDR collection trigger) GET /api/wazuh-indexer/resize_wazuh_index_fields (destructive index change) The scheduler invokes these handlers in-process (not over HTTP), and the scheduler_login() HTTP-token helper is unused, so adding HTTP auth does not affect scheduled jobs. - 5 routes now require an admin/analyst JWT via dependencies=[Security(AuthHandler().require_any_scope("admin", "analyst"))]. - /agents/dashboard/agents is genuinely called by external Grafana, so it gets a verify_grafana_header shared-secret dependency (advisory Option 2). Unlike the legacy verify_graylog_header/verify_velociraptor_header, it FAILS CLOSED: it does not fall back to a hardcoded default secret (a published default would reintroduce the bypass, cf. GHSA-4gxj-hw3c-3x2x). GRAFANA_API_HEADER_VALUE must be set or the route is denied; documented in .env.example. No docker-compose change needed: copilot-backend uses env_file: .env, so the new variable is passed through automatically. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>