Fix: Prevent CORS exposure and sensitive error disclosure - #1739
Conversation
This PR mitigates critical data disclosure and unauthorized origin execution vectors in the FastAPI RPC server. Updates: CORS Hardening: Removed the permissive allow_origins=["*"] configuration. The server now requires a comma-separated ALLOWED_ORIGINS environment variable and will strictly fail closed (RuntimeError) on startup if it is omitted. This ensures a deliberate deployment policy is always enforced. Error Disclosure Prevention: Removed the str(exc) reflection in the /api endpoint's fallback exception handler. Provider, RPC, and internal contract state anomalies are now safely logged to the server backend while the client receives a static An unexpected server error occurred response detail.
|
This PR targeted I retargeted it to |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This PR mitigates critical data disclosure and unauthorized origin execution vectors in the FastAPI RPC server.
Updates:
CORS Hardening: Removed the permissive allow_origins=["*"] configuration. The server now requires a comma-separated ALLOWED_ORIGINS environment variable and will strictly fail closed (RuntimeError) on startup if it is omitted. This ensures a deliberate deployment policy is always enforced.
Error Disclosure Prevention: Removed the str(exc) reflection in the /api endpoint's fallback exception handler. Provider, RPC, and internal contract state anomalies are now safely logged to the server backend while the client receives a static An unexpected server error occurred response detail.
Fixes #issue-number-here
What
Why
Testing done
Decisions made
Checks
Reviewing tips
User facing release notes