feat: add reflex cloud scan security review command#6632
Conversation
Adds a Reflex-aware security review CLI command. Zips the app source (pruning build/dependency dirs), uploads it via a presigned URL, submits it for review, polls to completion, and renders findings by severity. Supports --json output and a --fail-on severity gate for CI. ENG-9640
Merging this PR will not alter performance
Comparing Footnotes
|
Greptile SummaryThis PR introduces
Confidence Score: 3/5The command flow is sound but the hosting-layer functions can leak raw KeyError tracebacks to the user if the server returns a well-formed HTTP 200 with an unexpected JSON body, bypassing the clean error-handling path in scan_command. When upload[url], upload[key], or response.json()[job_id] fail to match the expected shape, the resulting KeyError is not caught by the except hosting.SecurityReviewError handler in scan_command. A user hitting a server-side schema change or edge-case response would see a raw Python traceback instead of the intended friendly error message. The polling logic, zip pruning, severity gating, and test coverage are all solid. packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py — the three dict-key accesses on server responses in submit_security_review need try/except KeyError guards to keep all error paths flowing through SecurityReviewError. Important Files Changed
Reviews (1): Last reviewed commit: "feat: add `reflex cloud scan` security r..." | Re-trigger Greptile |
What
Adds
reflex cloud scan, a Reflex-aware security review command under thereflex cloudCLI group (ENG-9640). It scans an app's source for Reflex-specific security and logic flaws (e.g. exposed setters on trust-sensitive vars, secrets leaked as frontend vars, blocking calls in async event handlers).How it works
.), pruning build/dependency dirs (.web,node_modules,.venv, …) during the walk and skipping over-cap files.PUTs the archive straight to object storage, then submits the stored object by key.Backed by
POST/GET /api/v1/agents/security-review/jobs(Enterprise-tier gated).Flags
[DIRECTORY]— app root to scan (default current dir)--token— auth token (else uses stored login)--json— raw result payload--fail-on {critical|high|medium|low|none}— exit non-zero at/above this severity (defaultlow);noneto always exit 0--loglevel,--interactive/--no-interactiveTesting
--json,--fail-ongating, markup-escaping, error paths) and the hosting-layer client (three-step upload flow, upload/submit failures, server-detail passthrough).ruff,ruff format,pyright, and the fulltests/units/reflex_clisuite (219) pass.Notes
.env*files are currently included in the upload (so the reviewer can flag committed secrets) — open to excluding them if preferred.