Skip to content

Flask API Runs on Built-In Dev Server with Debug Enabled #242

Description

@devprashant19

Component: Flask ML API / DevOps
Files Affected: backend/api.py, run-dev.ps1
Severity: Critical

Description

The Python Flask API relies on app.run(host="0.0.0.0", port=FLASK_PORT, debug=True) to start the server.

  1. Debug Mode: Leaving debug=True exposed to a network is a severe vulnerability. The Werkzeug debugger allows arbitrary Python code execution if an attacker triggers a stack trace.
  2. Built-in Server: The built-in Flask server is synchronous and meant strictly for local development. It cannot handle concurrent production load efficiently.

Proposed Fix

  1. Remove debug=True from app.run().
  2. Introduce a production-grade WSGI server (such as gunicorn or waitress) into the Python requirements and modify the startup scripts (run-dev.ps1 or Dockerfiles) to run the app through the WSGI server instead of directly invoking api.py.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions