Allow preflight requests for cloud template endpoints#1709
Allow preflight requests for cloud template endpoints#1709MarceloRGonc merged 19 commits intomainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
This PR disables CORS handling for cloud template endpoints and user info endpoints by adding cors: false configuration. The changes ensure that these publicly accessible endpoints bypass the default CORS plugin, likely to allow direct access from various origins without preflight request complications.
Key Changes
- Added
cors: falseconfiguration to cloud template endpoints (list and get by slug) - Added
cors: falseconfiguration to user info endpoint
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/server/api/src/app/flow-template/cloud-template.controller.ts | Disables CORS for two cloud template endpoints that already skip authentication |
| packages/server/api/src/app/user-info/user-info.module.ts | Disables CORS for user info endpoint that already skips authentication |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Greptile OverviewGreptile SummaryAdded Critical Issue: The The routes already use
Confidence Score: 0/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Client
participant Fastify
participant CORSPlugin as @fastify/cors Plugin
participant OnRequestHook as allowAllOriginsHookHandler
participant Route as Cloud Template Route
Client->>Fastify: GET /v1/cloud-templates
Note over Fastify: Check route config {cors: false}
Note over Fastify: ⚠️ No handler reads config.cors
Fastify->>CORSPlugin: Process CORS (lines 140-165 in app.ts)
CORSPlugin->>CORSPlugin: Check origin against allowed list
Note over CORSPlugin: Will reject if not in allowed domains
Fastify->>OnRequestHook: Execute hook (line 27 in controller)
OnRequestHook->>OnRequestHook: Set Access-Control-Allow-Origin: *
Note over OnRequestHook: Manually adds CORS headers
Fastify->>Route: Execute route handler
Route-->>Client: Response with conflicting CORS headers
|
|



Fixes OPS-3165.