Skip to content

Refactor: Security hardening, GPU optimization, and new batch inference features for app.py #863

Description

@ryanzone

Description

A comprehensive code audit and feature alignment process identified several security vulnerabilities, architectural performance bottlenecks, and a critical UI bug (History page charts failing to load due to strict CSP blocks) within app.py.

This issue tracks a unified refactor to harden the platform, optimize deep-learning operations, and implement missing advanced capabilities.

Problems Solved

  1. Insecure Deserialization Vulnerability: Modified model loading blocks to enforce strict weights_only=True unpickling protections.
  2. Forced CPU Processing Bottleneck: Migrated hardcoded cpu map locations to a dynamic target environment configuration supporting GPU acceleration (cuda).
  3. Denial of Service (DoS) Risk: Fixed an unbounded database query (.all()) on administrative role records by enforcing clear pagination boundaries.
  4. Broken History Dashboard UI: Adjusted the strict Content Security Policy (CSP) by restoring safe usage parameters for 'unsafe-inline' and 'unsafe-eval' script assets required by client-side graphing engines.
  5. Missing Feature Requirements: Incorporated core pipeline utilities to handle multi-file batch transmissions, human-in-the-loop retraining prediction feedback loops, and automated image EXIF geotag processing.

Expected Behavior

A secure, hardware-accelerated Flask gateway environment where frontend history metrics load seamlessly without browser security blocks, admin panel routes scale gracefully, and batch processing routes function end-to-end.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions