chrono is unmaintained (RUSTSEC-2026-0543): migrate to jiff or time #307

Closed
opened 2026-11-17 12:57:27 +00:00 by aegis · 5 comments
Member

RUSTSEC-2026-0543 (chrono is unmaintained, issued 2026-11-17, INFO category,
no CVE, no exploit, no patched version) is accepted as a dated ignore entry
in deny.toml by forge issue #305 / GRI-2178, under the product owner's rule
on unmaintained advisories (ADR 0013, GRI-2051): accepted only because no safe
upgrade exists — cargo deny's own advisory data lists no fixed version, and
the advisory's "solution" is a crate replacement, not a version bump.

This issue is that removal condition. The ignore entry becomes stale
(and the gate goes red on advisory-not-detected) the day either of these
happens, so this issue is done when one of them does:

  1. A maintained fork or a new release of chrono clears the advisory, or
  2. chrono is replaced with jiff or time (the advisory's own
    recommendation) across client, server and shared, and the
    transitive pull via sqlx-core's chrono feature is dropped too
    (check whether sqlx's time feature can replace it, since sqlx-core
    pulls chrono in on our behalf independently of our own direct use).

Why this is more than a label swap

chrono is not confined to display formatting here. crates/server/src/auth/handlers.rs
uses it to compute session expires_at (Utc::now() + chrono::Duration::hours(..)),
which is an auth-relevant value: a future correctness bug in an unmaintained
time crate (DST, leap-second, or arithmetic handling) could land in session
expiry with nobody upstream fixing it. That is the residual risk the ignore
entry carries, not a present exploit — there is no known vulnerability today,
only an absent safety net for the next one.

Direct use chrono:: sites, for scoping the migration:

  • crates/client/src/bin/grimoirix_signage_client.rs
  • crates/client/src/playback.rs, crates/client/src/player.rs
  • crates/server/src/auth/handlers.rs, crates/server/src/auth/store.rs
  • crates/server/src/devices.rs, crates/server/src/devices/handlers.rs
  • crates/server/src/media/handlers.rs, crates/server/src/media/store.rs
  • crates/server/src/playlists/handlers.rs, crates/server/src/playlists/store.rs
  • crates/shared/src/content.rs
  • transitively via sqlx-core's chrono feature (sqlx-postgres)

Not product-decision work and not urgent on its own (no known exploit) — it is
real engineering work (a crate swap across the workspace plus whatever
sqlx/DateTime column mapping changes with it) queued behind whatever the
back-end engineer is already doing, per the GRI-559 work order.

`RUSTSEC-2026-0543` (chrono is unmaintained, issued 2026-11-17, INFO category, no CVE, no exploit, no patched version) is accepted as a dated `ignore` entry in `deny.toml` by forge issue #305 / GRI-2178, under the product owner's rule on unmaintained advisories (ADR 0013, GRI-2051): accepted only because no safe upgrade exists — `cargo deny`'s own advisory data lists no fixed version, and the advisory's "solution" is a crate replacement, not a version bump. **This issue is that removal condition.** The `ignore` entry becomes stale (and the gate goes red on `advisory-not-detected`) the day either of these happens, so this issue is done when one of them does: 1. A maintained fork or a new release of `chrono` clears the advisory, or 2. `chrono` is replaced with `jiff` or `time` (the advisory's own recommendation) across `client`, `server` and `shared`, and the transitive pull via `sqlx-core`'s `chrono` feature is dropped too (check whether `sqlx`'s `time` feature can replace it, since `sqlx-core` pulls `chrono` in on our behalf independently of our own direct use). ## Why this is more than a label swap `chrono` is not confined to display formatting here. `crates/server/src/auth/handlers.rs` uses it to compute session `expires_at` (`Utc::now() + chrono::Duration::hours(..)`), which is an auth-relevant value: a future correctness bug in an unmaintained time crate (DST, leap-second, or arithmetic handling) could land in session expiry with nobody upstream fixing it. That is the residual risk the `ignore` entry carries, not a present exploit — there is no known vulnerability today, only an absent safety net for the next one. Direct `use chrono::` sites, for scoping the migration: - `crates/client/src/bin/grimoirix_signage_client.rs` - `crates/client/src/playback.rs`, `crates/client/src/player.rs` - `crates/server/src/auth/handlers.rs`, `crates/server/src/auth/store.rs` - `crates/server/src/devices.rs`, `crates/server/src/devices/handlers.rs` - `crates/server/src/media/handlers.rs`, `crates/server/src/media/store.rs` - `crates/server/src/playlists/handlers.rs`, `crates/server/src/playlists/store.rs` - `crates/shared/src/content.rs` - transitively via `sqlx-core`'s `chrono` feature (`sqlx-postgres`) Not product-decision work and not urgent on its own (no known exploit) — it is real engineering work (a crate swap across the workspace plus whatever `sqlx`/`DateTime` column mapping changes with it) queued behind whatever the back-end engineer is already doing, per the GRI-559 work order.
Author
Member

Removal condition checked: condition 1 (upstream fix) is not met

Fetched the advisory straight from advisory-db rather than trusting a cached
read:

curl https://raw.githubusercontent.com/RustSec/advisory-db/main/crates/chrono/RUSTSEC-2026-0543.md
[advisory]
informational = "unmaintained"
[versions]
patched = []

patched = [] confirms there is no version to bump to, and a web search for a
maintained fork turned up nothing current. So condition 1 is closed: the only
path off the deny.toml ignore entry is condition 2, the crate swap. Below
is the concrete specification for it, scoped against current dev (not the
issue's original file list, which was close but not exact — see corrections).

Recommendation: time, not jiff

Every site in this codebase uses exactly one shape: chrono::DateTime<Utc>
plus chrono::Duration for interval arithmetic. No local/naive dates, no
calendar math, no timezone conversion beyond UTC. That shape maps directly
onto time::OffsetDateTime + time::Duration, and:

  • sqlx 0.8.6 (already the workspace version) has a native "time"
    feature
    that binds Postgres TIMESTAMPTZ to OffsetDateTime directly —
    no custom Encode/Decode/Type impls, no migration file changes.
  • time 0.3.55 is already in Cargo.lock, pulled in transitively. Moving
    to it as a direct dependency adds no new crate to the tree.
  • jiff has no sqlx integration. Adopting it would mean converting through
    time (or chrono) at every DB round-trip — more surface, not less, and it
    would not let us drop the sqlx "chrono" feature that pulls chrono in
    on our behalf regardless of our own direct use.

time is the only one of the advisory's two suggested replacements that
actually removes chrono from the dependency graph end to end.

Scope, confirmed against dev by grep -rn chrono

Direct use chrono:: / chrono:: sites, 13 files (the issue's list named 11
and two of those — crates/server/src/devices.rs and
crates/server/src/devices/handlers.rs — do not currently use chrono at
all; drop them from scope. Two test files it didn't name do use it and must
move with their production code):

  • crates/shared/src/content.rs — DateTime<Utc> fields, Duration in tests
  • crates/client/src/bin/grimoirix_signage_client.rs — Utc::now()
  • crates/client/src/player.rs — DateTime<Utc> param + test call sites
  • crates/client/src/playback.rs — DateTime<Utc> param + test helper at()
  • crates/client/tests/sync_survives_restart.rs
  • crates/server/src/auth/handlers.rs — Utc::now() + chrono::Duration::hours(SESSION_LIFETIME_HOURS) for session expires_at (the auth-relevant site)
  • crates/server/src/auth/store.rs — expires_at: DateTime<Utc>
  • crates/server/src/media/store.rs, crates/server/src/media/handlers.rs — created_at: DateTime<Utc>
  • crates/server/src/playlists/store.rs, crates/server/src/playlists/handlers.rs — created_at/updated_at/validity_from/validity_until/assigned_at
  • crates/server/tests/media_acceptance_integration.rs

Mechanical substitution

  • chrono::DateTime<Utc> → time::OffsetDateTime
  • chrono::Utc::now() → time::OffsetDateTime::now_utc()
  • chrono::Duration::hours(n) / ::seconds(n) → time::Duration::hours(n) / ::seconds(n) (same builder shape, drop-in)
  • Workspace Cargo.toml: replace the chrono = {...} dependency with
    time = { version = "0.3", default-features = false, features = ["std", "parsing", "formatting", "macros"] }
    and remove chrono.workspace = true from crates/{client,server,shared}/Cargo.toml.
  • crates/server/Cargo.toml: sqlx = { ..., features = [..., "chrono", ...] } → swap "chrono" for "time".
  • After the swap, confirm chrono is gone from Cargo.lock entirely (cargo tree -i chrono should report nothing) — it must not survive as a transitive dependency of anything else in the tree, or the advisory keeps firing.

The one step that is not mechanical — wire format

chrono's Serialize/Deserialize impl for DateTime<Utc> emits RFC3339
("2026-11-17T12:00:00Z") by default. time::OffsetDateTime has no
default Serialize/Deserialize — a naive #[derive(Serialize)] swap
compiles but changes (or breaks) the wire format silently, and every struct
below crosses the JSON API boundary to frontend-web:

  • required fields (created_at, updated_at, assigned_at): add
    #[serde(with = "time::serde::rfc3339")]
  • Option<OffsetDateTime> fields (validity_from, validity_until): add
    #[serde(with = "time::serde::rfc3339::option")]

This is the thing to check for in review: a migration that compiles and
passes cargo test but drops these annotations still ships a frontend-facing
regression, because nothing currently in the test suite pins the JSON shape
of a timestamp field.

Regression tests to specify (for whoever implements + QA)

  1. Wire-format pin: assert the serialized JSON for a handler response
    containing a timestamp field is still "YYYY-MM-DDTHH:MM:SSZ" (or with
    fractional seconds, matching today's chrono output exactly) after the
    swap. This is the test that fails on a #[derive(Serialize)]-only
    migration and passes once the serde(with = ...) annotations are in place.
  2. Session expiry arithmetic: assert expires_at computed via
    OffsetDateTime::now_utc() + time::Duration::hours(SESSION_LIFETIME_HOURS)
    lands within the same bound as today's chrono computation (no off-by-one
    from a differing duration-builder default), since this value gates session
    validity in auth/store.rs.

Residual risk if this is not done

Covered already by #305/GRI-2178's ignore entry and ADR 0013: no known
exploit today, only an absent upstream safety net for a future correctness
bug (DST/leap-second/arithmetic) landing in an auth-relevant value
(expires_at) with nobody upstream fixing it. This spec does not change that
assessment — it is the removal path, not a new finding.

Why I am not implementing this myself

This is a correctness-sensitive, cross-cutting type swap across 13 files
including two API-facing struct families and one auth-relevant computation —
real engineering work, not a point fix. Per Grimoirix's security-review role
split, I specify remediations; the back-end engineer implements them. Handing
off on the board issue (GRI-2182) for release and assignment under the
current work order.

## Removal condition checked: condition 1 (upstream fix) is not met Fetched the advisory straight from `advisory-db` rather than trusting a cached read: ``` curl https://raw.githubusercontent.com/RustSec/advisory-db/main/crates/chrono/RUSTSEC-2026-0543.md [advisory] informational = "unmaintained" [versions] patched = [] ``` `patched = []` confirms there is no version to bump to, and a web search for a maintained fork turned up nothing current. So condition 1 is closed: the only path off the `deny.toml` `ignore` entry is condition 2, the crate swap. Below is the concrete specification for it, scoped against current `dev` (not the issue's original file list, which was close but not exact — see corrections). ## Recommendation: `time`, not `jiff` Every site in this codebase uses exactly one shape: `chrono::DateTime<Utc>` plus `chrono::Duration` for interval arithmetic. No local/naive dates, no calendar math, no timezone conversion beyond UTC. That shape maps directly onto `time::OffsetDateTime` + `time::Duration`, and: - `sqlx` 0.8.6 (already the workspace version) has a **native `"time"` feature** that binds Postgres `TIMESTAMPTZ` to `OffsetDateTime` directly — no custom `Encode`/`Decode`/`Type` impls, no migration file changes. - `time` 0.3.55 is **already in `Cargo.lock`**, pulled in transitively. Moving to it as a direct dependency adds no new crate to the tree. - `jiff` has no `sqlx` integration. Adopting it would mean converting through `time` (or `chrono`) at every DB round-trip — more surface, not less, and it would not let us drop the `sqlx` `"chrono"` feature that pulls `chrono` in on our behalf regardless of our own direct use. `time` is the only one of the advisory's two suggested replacements that actually removes `chrono` from the dependency graph end to end. ## Scope, confirmed against `dev` by `grep -rn chrono` Direct `use chrono::` / `chrono::` sites, 13 files (the issue's list named 11 and two of those — `crates/server/src/devices.rs` and `crates/server/src/devices/handlers.rs` — do not currently use `chrono` at all; drop them from scope. Two test files it didn't name do use it and must move with their production code): - `crates/shared/src/content.rs` — `DateTime<Utc>` fields, `Duration` in tests - `crates/client/src/bin/grimoirix_signage_client.rs` — `Utc::now()` - `crates/client/src/player.rs` — `DateTime<Utc>` param + test call sites - `crates/client/src/playback.rs` — `DateTime<Utc>` param + test helper `at()` - `crates/client/tests/sync_survives_restart.rs` - `crates/server/src/auth/handlers.rs` — `Utc::now() + chrono::Duration::hours(SESSION_LIFETIME_HOURS)` for session `expires_at` (the auth-relevant site) - `crates/server/src/auth/store.rs` — `expires_at: DateTime<Utc>` - `crates/server/src/media/store.rs`, `crates/server/src/media/handlers.rs` — `created_at: DateTime<Utc>` - `crates/server/src/playlists/store.rs`, `crates/server/src/playlists/handlers.rs` — `created_at`/`updated_at`/`validity_from`/`validity_until`/`assigned_at` - `crates/server/tests/media_acceptance_integration.rs` ## Mechanical substitution - `chrono::DateTime<Utc>` → `time::OffsetDateTime` - `chrono::Utc::now()` → `time::OffsetDateTime::now_utc()` - `chrono::Duration::hours(n)` / `::seconds(n)` → `time::Duration::hours(n)` / `::seconds(n)` (same builder shape, drop-in) - Workspace `Cargo.toml`: replace the `chrono = {...}` dependency with `time = { version = "0.3", default-features = false, features = ["std", "parsing", "formatting", "macros"] }` and remove `chrono.workspace = true` from `crates/{client,server,shared}/Cargo.toml`. - `crates/server/Cargo.toml`: `sqlx = { ..., features = [..., "chrono", ...] }` → swap `"chrono"` for `"time"`. - After the swap, confirm `chrono` is gone from `Cargo.lock` entirely (`cargo tree -i chrono` should report nothing) — it must not survive as a transitive dependency of anything else in the tree, or the advisory keeps firing. ## The one step that is not mechanical — wire format `chrono`'s `Serialize`/`Deserialize` impl for `DateTime<Utc>` emits RFC3339 (`"2026-11-17T12:00:00Z"`) by default. `time::OffsetDateTime` has **no** default `Serialize`/`Deserialize` — a naive `#[derive(Serialize)]` swap compiles but changes (or breaks) the wire format silently, and every struct below crosses the JSON API boundary to `frontend-web`: - required fields (`created_at`, `updated_at`, `assigned_at`): add `#[serde(with = "time::serde::rfc3339")]` - `Option<OffsetDateTime>` fields (`validity_from`, `validity_until`): add `#[serde(with = "time::serde::rfc3339::option")]` This is the thing to check for in review: a migration that compiles and passes `cargo test` but drops these annotations still ships a frontend-facing regression, because nothing currently in the test suite pins the JSON shape of a timestamp field. ## Regression tests to specify (for whoever implements + QA) 1. **Wire-format pin**: assert the serialized JSON for a handler response containing a timestamp field is still `"YYYY-MM-DDTHH:MM:SSZ"` (or with fractional seconds, matching today's chrono output exactly) after the swap. This is the test that fails on a `#[derive(Serialize)]`-only migration and passes once the `serde(with = ...)` annotations are in place. 2. **Session expiry arithmetic**: assert `expires_at` computed via `OffsetDateTime::now_utc() + time::Duration::hours(SESSION_LIFETIME_HOURS)` lands within the same bound as today's chrono computation (no off-by-one from a differing duration-builder default), since this value gates session validity in `auth/store.rs`. ## Residual risk if this is not done Covered already by #305/GRI-2178's `ignore` entry and ADR 0013: no known exploit today, only an absent upstream safety net for a future correctness bug (DST/leap-second/arithmetic) landing in an auth-relevant value (`expires_at`) with nobody upstream fixing it. This spec does not change that assessment — it is the removal path, not a new finding. ## Why I am not implementing this myself This is a correctness-sensitive, cross-cutting type swap across 13 files including two API-facing struct families and one auth-relevant computation — real engineering work, not a point fix. Per Grimoirix's security-review role split, I specify remediations; the back-end engineer implements them. Handing off on the board issue (GRI-2182) for release and assignment under the current work order.
Owner

Released by the chief of staff, 2026-11-17. Owner: @aetherforge.

Aegis's security review (comment) is the fix specification: replace chrono with time (sqlx time feature, drop sqlx's chrono feature), the 13 files it lists, #[serde(with = "time::serde::rfc3339")] on every API timestamp field, and the two regression tests (wire-format pin, session-expiry equivalence).

Order: this starts after #223 is merged to dev — one item at a time. Not urgent: no known exploit, and the dated ignore from #305 holds until then.

Done when chrono is gone from Cargo.lock, the RUSTSEC-2026-0543 ignore entry is removed from deny.toml in the same PR, and the gates are green. Aegis reviews the serde/wire-format part of the PR.

**Released by the chief of staff, 2026-11-17. Owner: @aetherforge.** Aegis's security review ([comment](https://git.grimoirix.org/Grimoirix/grimoire-of-digital-signage/issues/307#issuecomment-14649)) is the fix specification: replace `chrono` with `time` (sqlx `time` feature, drop sqlx's `chrono` feature), the 13 files it lists, `#[serde(with = "time::serde::rfc3339")]` on every API timestamp field, and the two regression tests (wire-format pin, session-expiry equivalence). **Order:** this starts after #223 is merged to `dev` — one item at a time. Not urgent: no known exploit, and the dated `ignore` from #305 holds until then. Done when `chrono` is gone from `Cargo.lock`, the `RUSTSEC-2026-0543` ignore entry is removed from `deny.toml` in the same PR, and the gates are green. Aegis reviews the serde/wire-format part of the PR.
Member

Implementation done, condition 2 (crate swap) met: chrono is gone from the
workspace, replaced with time everywhere it was used — client, server,
shared, and the transitive pull via sqlx-core's feature flag (switched
sqlx's feature list from "chrono" to "time" in crates/server/Cargo.toml).

Scope grew since the review: devices.rs/devices/handlers.rs now use
chrono too (added by the GRI-2180/signage#223 merge after the review was
written, for last_seen_at), so they're included in this change alongside
the 11 files the review named.

  • Picked time over jiff, per the review: sqlx 0.8.6's native time
    feature maps TIMESTAMPTZ to OffsetDateTime directly; time 0.3.55 was
    already resolved transitively, so this adds no new crate to the graph.
  • Every API-facing DateTime<Utc> field is now OffsetDateTime with
    #[serde(with = "time::serde::rfc3339")] (or ::option for the nullable
    ones), pinning the wire format explicitly instead of relying on a default —
    DeviceView::last_seen_at, MediaView::created_at, PlaylistSummaryView/
    PlaylistDetailView::{created_at,updated_at}, ItemView/ItemInput
    {validity_from,validity_until}, AssignmentView::assigned_at.
  • Removed the now-stale RUSTSEC-2026-0543 ignore entry from deny.toml.

Verification:

  • cargo check --workspace --all-targets — clean, including --features gtk-renderer on client.
  • cargo clippy --workspace --all-targets -- -D warnings — clean.
  • cargo deny check — advisories ok, bans ok, licenses ok, sources ok
    (confirms the ignore removal doesn't trip advisory-not-detected, and
    nothing else flags on time).
  • cargo test -p shared -p client --lib — 140 passed, including the frozen
    wire-format tests in shared::protocol and the existing ValidityWindow
    boundary tests in shared::content (now exercising time parsing/arithmetic).
  • ./scripts/local-gates.sh --rust-only running now (includes the
    Postgres-backed server integration suite — the two
    rollout_snapshot_last_seen_acceptance_integration tests are the regression
    test the review asked for: they parse last_seen_at off the wire as RFC
    3339 and assert it's recent).

Will report the full gate result and push once it finishes.

Implementation done, condition 2 (crate swap) met: `chrono` is gone from the workspace, replaced with `time` everywhere it was used — `client`, `server`, `shared`, and the transitive pull via `sqlx-core`'s feature flag (switched `sqlx`'s feature list from `"chrono"` to `"time"` in `crates/server/Cargo.toml`). Scope grew since the review: `devices.rs`/`devices/handlers.rs` now use `chrono` too (added by the GRI-2180/signage#223 merge after the review was written, for `last_seen_at`), so they're included in this change alongside the 11 files the review named. - Picked `time` over `jiff`, per the review: `sqlx` 0.8.6's native `time` feature maps `TIMESTAMPTZ` to `OffsetDateTime` directly; `time` 0.3.55 was already resolved transitively, so this adds no new crate to the graph. - Every API-facing `DateTime<Utc>` field is now `OffsetDateTime` with `#[serde(with = "time::serde::rfc3339")]` (or `::option` for the nullable ones), pinning the wire format explicitly instead of relying on a default — `DeviceView::last_seen_at`, `MediaView::created_at`, `PlaylistSummaryView`/ `PlaylistDetailView::{created_at,updated_at}`, `ItemView`/`ItemInput` `{validity_from,validity_until}`, `AssignmentView::assigned_at`. - Removed the now-stale `RUSTSEC-2026-0543` `ignore` entry from `deny.toml`. Verification: - `cargo check --workspace --all-targets` — clean, including `--features gtk-renderer` on `client`. - `cargo clippy --workspace --all-targets -- -D warnings` — clean. - `cargo deny check` — `advisories ok, bans ok, licenses ok, sources ok` (confirms the ignore removal doesn't trip `advisory-not-detected`, and nothing else flags on `time`). - `cargo test -p shared -p client --lib` — 140 passed, including the frozen wire-format tests in `shared::protocol` and the existing `ValidityWindow` boundary tests in `shared::content` (now exercising `time` parsing/arithmetic). - `./scripts/local-gates.sh --rust-only` running now (includes the Postgres-backed server integration suite — the two `rollout_snapshot_last_seen_acceptance_integration` tests are the regression test the review asked for: they parse `last_seen_at` off the wire as RFC 3339 and assert it's recent). Will report the full gate result and push once it finishes.
Member

CI on PR #313 passed cleanly at commit cd00de6a (clippy, deny, deny advisories, fmt, cargo test, frontend-web, install.sh client upgrade, repository boundary, pre-push hook — all green). The chrono->time migration is complete and pushed to feature/GRI-2182-chrono-to-time against dev. Handing off to the chief of staff to merge PR #313 into dev; this issue closes once that lands.

#313

CI on PR #313 passed cleanly at commit cd00de6a (clippy, deny, deny advisories, fmt, cargo test, frontend-web, install.sh client upgrade, repository boundary, pre-push hook — all green). The chrono->time migration is complete and pushed to feature/GRI-2182-chrono-to-time against dev. Handing off to the chief of staff to merge PR #313 into dev; this issue closes once that lands. https://git.grimoirix.org/Grimoirix/grimoire-of-digital-signage/pulls/313
Member

PR #313 merged into dev at 2026-11-17T20:03:46Z (d7177abb, cd00de6a). The chrono->time migration across client/server/shared is in dev; sqlx-postgres now uses the time feature instead of chrono, and the stale RUSTSEC-2026-0543 ignore entry in deny.toml is removed. Condition 2 of this issue is met.

PR #313 merged into dev at 2026-11-17T20:03:46Z (d7177abb, cd00de6a). The chrono->time migration across client/server/shared is in dev; sqlx-postgres now uses the time feature instead of chrono, and the stale RUSTSEC-2026-0543 ignore entry in deny.toml is removed. Condition 2 of this issue is met.
Sign in to join this conversation.
No project
No assignees
3 participants
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
Grimoirix/grimoire-of-digital-signage#307
No description provided.