hezarfen_backend
Clone
https://git.tahinli.com/archive/hezarfen_backend.git
0 watching0 forksRust8.3 MiB6d68754Ahmet Kaan Gümüş2 months ago566 commits
| 1 | # Time policy enforcement (see src/domain/timestamp.rs). |
| 2 | # |
| 3 | # All wall-clock reads must go through `Timestamp::now()` — one UTC |
| 4 | # unix-millisecond source. Local time and absolute non-UTC types are banned so |
| 5 | # timezone/clock bugs cannot be reintroduced. `Instant` (monotonic) stays |
| 6 | # allowed: it is the correct tool for pacing (rate limiter) and immune to |
| 7 | # clock adjustments. `[lints.clippy]` in Cargo.toml raises these to `deny`. |
| 8 | |
| 9 | disallowed-methods = [ |
| 10 | { path = "chrono::Utc::now", reason = "use domain::timestamp::Timestamp::now() / today_utc() — the single clock choke point" }, |
| 11 | { path = "chrono::Local::now", reason = "local time is banned; use domain::timestamp::Timestamp (UTC unix-millis)" }, |
| 12 | { path = "std::time::SystemTime::now", reason = "use domain::timestamp::Timestamp::now() — the single clock choke point" }, |
| 13 | { path = "time::OffsetDateTime::now_utc", reason = "use domain::timestamp::Timestamp::now() — the single clock choke point" }, |
| 14 | # Unreachable today (time's `local-offset` feature is off) — allow-invalid |
| 15 | # keeps the ban armed in case a future feature flag exposes it. |
| 16 | { path = "time::OffsetDateTime::now_local", reason = "local time is banned; use domain::timestamp::Timestamp (UTC unix-millis)", allow-invalid = true }, |
| 17 | { path = "cookie::Cookie::set_expires", reason = "absolute Expires compares against the client's clock; use max_age (relative) instead" }, |
| 18 | ] |
| 19 | |
| 20 | disallowed-types = [ |
| 21 | { path = "chrono::Local", reason = "local timezone is banned; all instants are UTC unix-millis (domain::timestamp::Timestamp)" }, |
| 22 | { path = "chrono::NaiveDateTime", reason = "timezone-ambiguous; use Timestamp (UTC instant) or NaiveDate (pure calendar date)" }, |
| 23 | ] |