Is there an existing issue for this?
What happened?
Current configuration allows ANY origin to make requests to the local API, which:
- Creates potential security vulnerability
- Could allow malicious websites to access user's local photo data
- Violates privacy-first principle
Changes
- Updated CORS
allow_origins to whitelist only known localhost origins
- Specified exact HTTP methods and headers instead of wildcards
- Added Tauri-specific origins for production builds
Before:
app.add_middleware(
CORSMiddleware,
allow_origins=["*"], # Allows all origins
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
After:
app.add_middleware(
CORSMiddleware,
allow_origins=[
"http://localhost:1420", # Tauri dev server
"http://localhost:5173", # Vite dev server
"tauri://localhost", # Tauri production
"https://tauri.localhost", # Tauri HTTPS
],
allow_credentials=True,
allow_methods=["GET", "POST", "PUT", "DELETE", "OPTIONS"],
allow_headers=["Content-Type", "Accept", "Authorization"],
)
Record
Checklist before Submitting
Is there an existing issue for this?
What happened?
Current configuration allows ANY origin to make requests to the local API, which:
Changes
allow_originsto whitelist only known localhost originsBefore:
After:
Record
Checklist before Submitting