B4: Alert threshold uses INTEGER type - risk of overflow #4

Open
opened 2026-06-05 10:21:43 +00:00 by sebse · 0 comments
Owner

Bug

File: web/migrations/001_initial_schema.js:93

Alert threshold column is typed as PostgreSQL INTEGER (4-byte, max 2^31-1 = ~2.1B).

Impact

Signal values (green/red columns) are also INTEGER. If signals exceed ~2.1B or user enters a large threshold, comparison silently wraps. Low risk currently, but a ticking time bomb for long-running factories.

Code reference

threshold: { type: 'integer', notNull: true },

Fix

Change to bigint (requires new migration). Signal columns should also be migrated to bigint for consistency.

## Bug **File:** `web/migrations/001_initial_schema.js:93` Alert `threshold` column is typed as PostgreSQL `INTEGER` (4-byte, max 2^31-1 = ~2.1B). ### Impact Signal values (green/red columns) are also `INTEGER`. If signals exceed ~2.1B or user enters a large threshold, comparison silently wraps. Low risk currently, but a ticking time bomb for long-running factories. ### Code reference ```js threshold: { type: 'integer', notNull: true }, ``` ### Fix Change to `bigint` (requires new migration). Signal columns should also be migrated to `bigint` for consistency.
sebse added the bug label 2026-06-05 10:21:43 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sebse/factorio-signal-exporter#4