From SECURITY_AUDIT.md (SEC-08). Severity: Untrusted = Medium, Local-trusted = Low.
Issue
Public-facing argument/shape validation done via assert is removed when Python runs with -O, silently disabling the checks and allowing invalid input to corrupt results or crash later in an obscure place. ~105 instances; validation-style examples:
process_improve/regression/methods.py:486-489,615
process_improve/experiments/optimal.py:79-80
process_improve/batch/data_input.py:67,74,81,86,104,146,152
process_improve/monitoring/control_charts.py:104-105,181-186
process_improve/univariate/metrics.py:397,583,733-734
Fix direction
Convert validation asserts (those checking user-supplied arguments or external data) to explicit if not ...: raise ValueError/TypeError(...). Genuine internal invariants may remain asserts but prefer explicit raises at API boundaries.
Tests
- Invalid input raises the expected exception even under
-O (or simply assert the explicit raise).
Note
Large and somewhat mechanical; may be split per-module if a single PR gets unwieldy.
From
SECURITY_AUDIT.md(SEC-08). Severity: Untrusted = Medium, Local-trusted = Low.Issue
Public-facing argument/shape validation done via
assertis removed when Python runs with-O, silently disabling the checks and allowing invalid input to corrupt results or crash later in an obscure place. ~105 instances; validation-style examples:process_improve/regression/methods.py:486-489,615process_improve/experiments/optimal.py:79-80process_improve/batch/data_input.py:67,74,81,86,104,146,152process_improve/monitoring/control_charts.py:104-105,181-186process_improve/univariate/metrics.py:397,583,733-734Fix direction
Convert validation asserts (those checking user-supplied arguments or external data) to explicit
if not ...: raise ValueError/TypeError(...). Genuine internal invariants may remain asserts but prefer explicit raises at API boundaries.Tests
-O(or simply assert the explicitraise).Note
Large and somewhat mechanical; may be split per-module if a single PR gets unwieldy.