Skip to main content
QMSQMS
QMS
  • Welcome to your QMS
  • Quality Manual
  • Procedures
  • Records
  • Legit.Health Plus Version 1.1.0.0
    • CAPA Plan - BSI CE Mark Closeout
    • Index
    • Overview and Device Description
    • Information provided by the Manufacturer
    • Design and Manufacturing Information
      • R-TF-012-019 SOUPs
        • Aioboto3
        • Albumentations
        • Argon2-CFFI
        • Authlib
        • Boto3
        • Dependency Injector
        • Dill
        • FastAPI
        • PyTorch Grad-CAM
        • Httpx
        • NumPy
        • PyNVML
        • OpenCV
        • Pillow
        • Psutil
        • Pydantic
        • Pydantic Settings
        • PyYAML
        • Segmentation Models PyTorch
        • Starlette
        • Timm
        • PyTorch
        • TorchVision
        • Ultralytics YOLO
        • Uvicorn
      • R-TF-012-028 Software Requirement Specification
      • R-TF-012-029 Software Architecture Description
      • R-TF-012-030 Software Configuration Management Plan
      • R-TF-012-031 Product requirements specification
      • R-TF-012-037 Labeling and IFU Requirements
      • R-TF-012-040 Documentation level FDA
      • R-TF-012-041 Software Classification 62304
      • R-TF-012-043 Traceability Matrix
      • Review meetings
    • GSPR
    • Benefit-Risk Analysis and Risk Management
    • Product Verification and Validation
    • Post-Market Surveillance
  • Legit.Health Plus Version 1.1.0.1
  • Legit.Health Utilities
  • Licenses and accreditations
  • Applicable Standards and Regulations
  • Pricing
  • Public tenders
  • Legit.Health Plus Version 1.1.0.0
  • Design and Manufacturing Information
  • R-TF-012-019 SOUPs
  • FastAPI

FastAPI

General Information​

FieldValue
Package Namefastapi
Manufacturer / VendorSebastián Ramírez (tiangolo)
Software CategoryFramework
Primary DocumentationDocumentation, GitHub, PyPI, Tutorial
Programming Language(s)Python
LicenseMIT License
Deployed Version(s)>=0.124.0 (version-locked at 0.124.2–0.128.0 across services)
Most Recent Available Version0.128.0
Last Review Date2026-01-27

Overview​

FastAPI is a modern, high-performance web framework for building APIs with Python based on standard Python type hints. Built on top of Starlette for the web layer and Pydantic for data validation, FastAPI provides automatic OpenAPI documentation, request/response validation, dependency injection, and asynchronous request handling. It is one of the fastest Python frameworks available, with performance comparable to NodeJS and Go.

Within the medical device software, FastAPI serves as the primary HTTP/REST interface layer powering all external and internal API communications. It is integrated throughout the distributed microservices architecture:

  • API Gateway: The client-facing service that exposes clinical endpoints for diagnosis support and severity assessment, device health and information endpoints, and authentication-protected resources
  • Control Plane: Orchestrates clinical workflows by routing requests to appropriate downstream services, managing distributed tracing via correlation IDs, and coordinating the expert orchestrator and report builder services
  • Expert Orchestrator: Coordinates 50+ expert microservices for clinical sign classification, segmentation, and detection, distributing inference requests and aggregating results
  • Report Builder: Generates canonical clinical reports from aggregated expert results, providing structured diagnosis and severity assessment outputs
  • Expert Microservices: Each of the 50+ clinical expert models (classifiers, segmenters, detectors) runs as an isolated FastAPI service with prediction endpoints, health checks, and resource monitoring

FastAPI was selected over alternatives (Flask, Django REST Framework, Tornado) due to:

  • High performance with native async/await support for concurrent request handling
  • Automatic request/response validation using Python type hints and Pydantic models
  • Built-in dependency injection system integrating seamlessly with the device's dependency-injector container
  • Automatic OpenAPI documentation generation for API contract verification
  • Strong typing support enabling compile-time error detection and IDE assistance
  • Active maintenance with regular security updates and a responsive maintainer
  • MIT license permitting commercial use in medical device software

Functional Requirements​

The following functional capabilities of this SOUP are relied upon by the medical device software.

Requirement IDDescriptionSource / Reference
FR-001Create web application instances with configurable metadataFastAPI() class constructor
FR-002Define HTTP endpoints using route decorators@app.get(), @app.post(), @router.get(), @router.post()
FR-003Automatically validate request bodies against Pydantic modelsType hints with BaseModel subclasses
FR-004Return typed responses with automatic serializationresponse_model parameter in route decorators
FR-005Organize routes using modular router componentsAPIRouter class with prefix and tags
FR-006Inject dependencies into route handlersDepends() function and dependency injection system
FR-007Register custom exception handlers for error processing@app.exception_handler() decorator and add_exception_handler()
FR-008Add middleware for cross-cutting concernsapp.add_middleware() and BaseHTTPMiddleware
FR-009Implement authentication via HTTP Bearer tokensHTTPBearer security scheme from fastapi.security
FR-010Define application lifecycle events (startup/shutdown)lifespan context manager parameter
FR-011Return structured error responses with appropriate HTTP status codesHTTPException class with status_code and detail
FR-012Include routers with path prefixes for API versioningapp.include_router() with prefix parameter
FR-013Configure request timeouts for long-running operationsTimeout parameters in route handlers
FR-014Access request headers for correlation ID propagationRequest object and header extraction

Performance Requirements​

The following performance expectations are relevant to the medical device software.

Requirement IDDescriptionAcceptance Criteria
PR-001API request processing shall complete within acceptable latency boundsRequest handling overhead < 10ms excluding business logic
PR-002Concurrent request handling shall scale with available resourcesAsync handlers enable concurrent processing without thread exhaustion
PR-003Memory usage shall remain stable under sustained request loadNo memory leaks during continuous API operation
PR-004Request validation shall not introduce significant latency overheadPydantic validation completes within acceptable bounds

Hardware Requirements​

The following hardware dependencies or constraints are imposed by this SOUP component.

Requirement IDDescriptionNotes / Limitations
HR-001x86-64 or ARM64 processor architecturePre-built wheels available for common platforms
HR-002Sufficient system memory for request processingMemory scales with concurrent connection count
HR-003Network interface for HTTP communicationRequired for all API endpoints

Software Requirements​

The following software dependencies and environmental assumptions are required by this SOUP component.

Requirement IDDescriptionDependency / Version Constraints
SR-001Python runtime environmentPython >=3.9
SR-002Starlette ASGI frameworkBundled dependency; device uses Starlette >=0.49.0 (locked at 0.50.0)
SR-003Pydantic data validation libraryBundled dependency; device uses Pydantic >=2.12.0
SR-004ASGI server for production deploymentUvicorn with standard extras >=0.38.0
SR-005python-multipart for form data processingRequired for multipart/form-data handling

Known Anomalies Assessment​

This section evaluates publicly reported issues, defects, or security vulnerabilities associated with this SOUP component and their relevance to the medical device software.

Anomaly ReferenceStatusApplicableRationaleReviewed At
CVE-2024-24762 (python-multipart ReDoS)FixedNoHigh severity (CVSS 7.5) ReDoS via crafted Content-Type header in python-multipart. Fixed in FastAPI 0.109.1; device uses >=0.124.0 which includes the fix2026-01-27
CVE-2024-47874 (Starlette multipart DoS)FixedNoCritical (CVSS 8.7) memory exhaustion via multipart/form-data without filename. Fixed in Starlette 0.40.0; device uses Starlette >=0.49.0 which includes the fix2026-01-27
CVE-2025-54121 (Starlette event thread blocking)FixedNoModerate (CVSS 5.3) event loop blocking during large file upload rollover. Fixed in Starlette 0.47.2; device uses Starlette >=0.49.0 which includes the fix2026-01-27
CVE-2025-62727 (Starlette FileResponse ReDoS)FixedNoReDoS via crafted HTTP Range header in FileResponse. Fixed in Starlette 0.49.1; device uses Starlette locked at 0.50.0 which includes the fix. Additionally not applicable as device does not serve static files via FileResponse2026-01-27
CVE-2025-14546 (fastapi-sso CSRF)FixedNoCSRF in fastapi-sso package due to improper OAuth state validation. The device does not use the fastapi-sso third-party package2026-01-27
CVE-2025-68481 (fastapi-users account takeover)FixedNoOAuth state token vulnerability in fastapi-users package. The device does not use the fastapi-users third-party package; authentication is handled internally2026-01-27

FastAPI is actively maintained by Sebastián Ramírez with a strong track record of prompt security response. The project maintains a security policy for coordinated disclosure. According to Snyk's vulnerability database, the current version (0.128.0) is listed as the latest non-vulnerable version.

The device's usage pattern minimizes attack surface exposure:

  • Authenticated endpoints: All clinical and user-facing endpoints require valid JWT authentication via HTTPBearer
  • Input validation: Pydantic models validate all request bodies before business logic execution, rejecting malformed data at the framework layer
  • Version locking: Requirements lock files pin FastAPI versions across all services: core services (API Gateway, Control Plane) at 0.124.4, expert microservices range from 0.125.0 to 0.128.0. All locked versions include fixes for CVE-2024-24762 (fixed in 0.109.1)
  • No static file serving: The device does not use FileResponse or StaticFiles, eliminating exposure to CVE-2025-62727
  • Controlled form data: Multipart form handling is limited to specific endpoints with size validation, mitigating DoS risks
  • IEC 62304 compliant error handling: Global exception handlers ensure no internal details leak to clients; all errors return sanitized messages with correlation IDs for debugging
  • Distributed tracing: Correlation ID middleware enables end-to-end request tracking for security audit trails
  • Container isolation: Each microservice runs in isolated containers with restricted filesystem and network access

Risk Control Measures​

The following risk control measures are implemented to mitigate potential security and operational risks associated with this SOUP component:

  • Version constraints in requirements ensure deployment of patched versions
  • JWT authentication prevents unauthenticated access to clinical endpoints
  • Pydantic validation rejects malformed requests before processing
  • Rate limiting and request size limits prevent resource exhaustion
  • Container isolation limits potential impact of any exploitation
  • Audit logging with correlation IDs enables forensic analysis of security events

Assessment Methodology​

The following methodology was used to identify and assess known anomalies:

  • Sources consulted:

    • National Vulnerability Database (NVD) search for "fastapi" and "starlette"
    • Snyk vulnerability database for FastAPI
    • Snyk vulnerability database for Starlette
    • GitHub Security Advisories for fastapi/fastapi
    • CVE Details for FastAPI
    • Security research publications and vendor security bulletins
  • Criteria for determining applicability:

    • Vulnerability must affect deployed versions (FastAPI 0.124.2–0.128.0, Starlette 0.50.0)
    • Vulnerability must be exploitable through the device's operational context (authenticated API, no static files)
    • Attack vector must be reachable through the device's interfaces
    • Input validation, authentication, and isolation controls must not mitigate the vulnerability

Signature meaning

The signatures for the approval process of this document can be found in the verified commits at the repository for the QMS. As a reference, the team members who are expected to participate in this document and their roles in the approval process, as defined in Annex I Responsibility Matrix of the GP-001, are:

  • Author: Team members involved
  • Reviewer: JD-003, JD-004
  • Approver: JD-001
Previous
Dill
Next
PyTorch Grad-CAM
  • General Information
  • Overview
  • Functional Requirements
  • Performance Requirements
  • Hardware Requirements
  • Software Requirements
  • Known Anomalies Assessment
    • Risk Control Measures
    • Assessment Methodology
All the information contained in this QMS is confidential. The recipient agrees not to transmit or reproduce the information, neither by himself nor by third parties, through whichever means, without obtaining the prior written permission of Legit.Health (AI Labs Group S.L.)