Repository navigation
security: harden CORS, rate limits, /health, and SQLite compat (1.0.0a5) - #27
Conversation
…ompat for 1.0.0a5
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2de5368. Configure here.
|
|
||
| CORS_ALLOWED_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"] | ||
| CORS_ALLOWED_HEADERS = ["Content-Type", "X-Operator-Scan-Token", "Authorization", "Accept"] | ||
| RATE_LIMITED_POST_PATHS = frozenset({"/scans", "/process/demo", "/search/semantic"}) |
There was a problem hiding this comment.
Canonical semantic search endpoint bypasses rate limiting
High Severity
RATE_LIMITED_POST_PATHS only includes "/search/semantic", which is the hidden compatibility alias for semantic_search_route in apps/api/app/api/routes.py. Requests to the canonical, OpenAPI-documented endpoint (POST /api/v1/search and POST /api/search, also used by apps/web/src/lib/api.ts) return None from _normalize_rate_limit_path and bypass rate limiting completely.
Reviewed by Cursor Bugbot for commit 2de5368. Configure here.


Addresses the remaining hardening recommendations from security advisory GHSA-5v46-prgf-5hxf and prepares
1.0.0a5:CORSMiddlewarefrom wildcard*methods/headers to explicit HTTP methods and headers.RATE_LIMIT_REQUESTS_PER_MINUTE, defaulting to60/minoutsideENVIRONMENT=local, disabled in local dev) onPOST /api/scans,POST /api/process/demo, andPOST /api/search/semantic.llm_provider,embedding_model) from unauthenticated/healthresponses outsideENVIRONMENT=local.ALTER TABLE/CREATE INDEXstatements.1.0.0a5/1.0.0-alpha.5and passesscripts/release_check.py --version 1.0.0a5 --require-clean.Note
Medium Risk
Changes request handling for CORS, high-load POST routes, and /health in non-local deployments; misconfiguration could block legitimate clients or hide diagnostics until operators authenticate.
Overview
Prepares 1.0.0a5 with API security hardening aligned to advisory GHSA-5v46-prgf-5hxf.
CORS no longer allows wildcard methods/headers; only explicit verbs and headers (
Content-Type,X-Operator-Scan-Token,Authorization,Accept) are permitted.Rate limiting adds an in-process sliding-window cap via
RATE_LIMIT_REQUESTS_PER_MINUTE(default 60/min in non-local environments, off whenENVIRONMENT=local) forPOSTon/api/scans,/api/process/demo, and/api/search/semantic, returning 429 withRetry-After.Outside local, unauthenticated
/healthreturns only{status: ok}; full runtime fields (llm_provider,embedding_model) require a valid operator token.SQLite compat migrations now validate table/column/index names with a strict regex before running hardcoded
ALTER TABLE/CREATE INDEXstatements.Version metadata, lockfiles, changelog, and new regression tests in
test_security_hardening.pyare updated accordingly.Reviewed by Cursor Bugbot for commit 2de5368. Bugbot is set up for automated code reviews on this repo. Configure here.