Skip to content

fix(security): restrict wildcard CORS origin in Flask API#235

Merged
Userunknown84 merged 1 commit into
Userunknown84:mainfrom
devprashant19:fix/wildcard-cors-flask-api
Jun 24, 2026
Merged

fix(security): restrict wildcard CORS origin in Flask API#235
Userunknown84 merged 1 commit into
Userunknown84:mainfrom
devprashant19:fix/wildcard-cors-flask-api

Conversation

@devprashant19

Copy link
Copy Markdown
Contributor

Description

This PR resolves an issue where the Flask ML API was configured with a wildcard CORS policy (origins: "*"). Since the Flask API is strictly an internal service intended to be accessed only by the Node.js gateway, allowing any origin exposes internal endpoints (such as those requiring the X-Internal-Secret) to cross-origin attacks from any browser.
Closes #221

Changes

  • Modified backend/api.py to replace the wildcard CORS configuration.
  • The CORS origin is now restricted by the NODE_GATEWAY_ORIGIN environment variable, defaulting to http://localhost:3000.

Related Issues

  • Resolves the wildcard CORS vulnerability.

Type of Change

  • Security fix
  • Bug fix
  • New feature
  • Refactoring

Pre-submission Checklist

  • Tested locally to ensure cross-origin requests from unauthorized domains are blocked.
  • Verified that internal requests from the Node.js gateway still succeed.

@vercel

vercel Bot commented Jun 23, 2026

Copy link
Copy Markdown

@devprashant19 is attempting to deploy a commit to the Aditya Sharma's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Userunknown84 Userunknown84 merged commit 528b302 into Userunknown84:main Jun 24, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security: Wildcard CORS on Flask ML API Exposes Internal Endpoints to Any Browser Origin

2 participants