rullst-security 12.3.0

Runtime application security, RASP, OWASP headers, Login Jail, and WAF middleware for Rullst.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! Wall-clock budgets for the linear-time regression tests.

use std::time::Duration;

/// Scales `budget` by `RULLST_TEST_TIME_SCALE` (1 to 100, default 1).
///
/// The sanitizer workflow sets the variable because instrumentation slows
/// every memory access; ordinary test runs keep the unscaled budget.
pub(crate) fn scaled(budget: Duration) -> Duration {
    let scale = std::env::var("RULLST_TEST_TIME_SCALE")
        .ok()
        .and_then(|value| value.parse::<u32>().ok())
        .unwrap_or(1)
        .clamp(1, 100);
    budget * scale
}