app: limit user-controlled computation to protect the hosted service #31

Open
opened 2026-10-06 13:49:54 +00:00 by ffrauenberger · 0 comments
Owner

Severity: improvement (high for the public multi-user deployment: one user can tie up the server)

Where

  • app/ui/export_ui/export_view.py:59-74
  • app/ui/genetic_miner_ui/genetic_miner_view.py:14-28
  • app/mining_algorithms/alpha_mining.py:46-60
  • module.nix:141-147

Problem

The application runs as one Python process for all users, and several inputs have no upper bound:

Input Bound Effect
Export DPI min_value=50, no max PNG size grows with DPI²; the result is base64-encoded and kept in memory. DPI 20000 on a medium graph needs gigabytes. It is re-rendered on every rerun (#41).
Genetic Population Size / Max Generations min_value only 10⁶ × 10⁶ runs practically forever in the session thread.
Alpha Miner none Exponential subset enumeration (#37); ~30 pairwise independent activities never finish.
Upload size 200 MB default The file is held in memory several times (#45).

Mining runs synchronously in Streamlit's script thread and holds the GIL most of the time, so a single user can slow down or stall the service for everyone. Closing the browser tab does not stop a running computation.

Related: #54, #37, #39, #41, #45, #61.

Fix

Bound the resources a single session can consume:

  • Add hard limits (max_value) for DPI (e.g. 600), population size and generations, and a maximum number of activities for the Alpha Miner, with a clear message to the user
  • Run expensive work in a bounded worker pool with timeouts and cancellation (#54)
  • Set systemd resource limits (MemoryMax=, CPUQuota=, TasksMax=) in module.nix

from issues/SEC-001-unbounded-user-controlled-computation-dos.md (code analysis of commit 6bcc646, 2026-10-03)

**Severity:** improvement (high for the public multi-user deployment: one user can tie up the server) ## Where - `app/ui/export_ui/export_view.py:59-74` - `app/ui/genetic_miner_ui/genetic_miner_view.py:14-28` - `app/mining_algorithms/alpha_mining.py:46-60` - `module.nix:141-147` ## Problem The application runs as **one Python process** for all users, and several inputs have no upper bound: | Input | Bound | Effect | |---|---|---| | Export **DPI** | `min_value=50`, no max | PNG size grows with DPI²; the result is base64-encoded and kept in memory. DPI 20000 on a medium graph needs gigabytes. It is re-rendered on every rerun (#41). | | Genetic **Population Size** / **Max Generations** | `min_value` only | 10⁶ × 10⁶ runs practically forever in the session thread. | | Alpha Miner | none | Exponential subset enumeration (#37); ~30 pairwise independent activities never finish. | | Upload size | 200 MB default | The file is held in memory several times (#45). | Mining runs synchronously in Streamlit's script thread and holds the GIL most of the time, so a single user can slow down or stall the service for everyone. Closing the browser tab does not stop a running computation. Related: #54, #37, #39, #41, #45, #61. ## Fix Bound the resources a single session can consume: - Add hard limits (`max_value`) for DPI (e.g. 600), population size and generations, and a maximum number of activities for the Alpha Miner, with a clear message to the user - Run expensive work in a bounded worker pool with timeouts and cancellation (#54) - Set systemd resource limits (`MemoryMax=`, `CPUQuota=`, `TasksMax=`) in `module.nix` --- from `issues/SEC-001-unbounded-user-controlled-computation-dos.md` (code analysis of commit 6bcc646, 2026-10-03)
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ffrauenberger/ProcessIntel#31
No description provided.