chrono is unmaintained (RUSTSEC-2026-0543): migrate to jiff or time #307
Labels
No labels
Area/Backend
Area/Database
Area/Docs
Area/Frontend
Area/Infra
Area/Security
Area/Tests
Area/Tooling
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Lang/Python
Lang/Rust
Lang/Shell
Lang/SQL
Lang/TypeScript
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Routing
Auto
Routing
Hold
Routing
Human
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grimoirix/grimoire-of-digital-signage#307
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
RUSTSEC-2026-0543(chrono is unmaintained, issued 2026-11-17, INFO category,no CVE, no exploit, no patched version) is accepted as a dated
ignoreentryin
deny.tomlby forge issue #305 / GRI-2178, under the product owner's ruleon unmaintained advisories (ADR 0013, GRI-2051): accepted only because no safe
upgrade exists —
cargo deny's own advisory data lists no fixed version, andthe advisory's "solution" is a crate replacement, not a version bump.
This issue is that removal condition. The
ignoreentry becomes stale(and the gate goes red on
advisory-not-detected) the day either of thesehappens, so this issue is done when one of them does:
chronoclears the advisory, orchronois replaced withjiffortime(the advisory's ownrecommendation) across
client,serverandshared, and thetransitive pull via
sqlx-core'schronofeature is dropped too(check whether
sqlx'stimefeature can replace it, sincesqlx-corepulls
chronoin on our behalf independently of our own direct use).Why this is more than a label swap
chronois not confined to display formatting here.crates/server/src/auth/handlers.rsuses 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
ignoreentry 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.rscrates/client/src/playback.rs,crates/client/src/player.rscrates/server/src/auth/handlers.rs,crates/server/src/auth/store.rscrates/server/src/devices.rs,crates/server/src/devices/handlers.rscrates/server/src/media/handlers.rs,crates/server/src/media/store.rscrates/server/src/playlists/handlers.rs,crates/server/src/playlists/store.rscrates/shared/src/content.rssqlx-core'schronofeature (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/DateTimecolumn mapping changes with it) queued behind whatever theback-end engineer is already doing, per the GRI-559 work order.
Removal condition checked: condition 1 (upstream fix) is not met
Fetched the advisory straight from
advisory-dbrather than trusting a cachedread:
patched = []confirms there is no version to bump to, and a web search for amaintained fork turned up nothing current. So condition 1 is closed: the only
path off the
deny.tomlignoreentry is condition 2, the crate swap. Belowis the concrete specification for it, scoped against current
dev(not theissue's original file list, which was close but not exact — see corrections).
Recommendation:
time, notjiffEvery site in this codebase uses exactly one shape:
chrono::DateTime<Utc>plus
chrono::Durationfor interval arithmetic. No local/naive dates, nocalendar math, no timezone conversion beyond UTC. That shape maps directly
onto
time::OffsetDateTime+time::Duration, and:sqlx0.8.6 (already the workspace version) has a native"time"feature that binds Postgres
TIMESTAMPTZtoOffsetDateTimedirectly —no custom
Encode/Decode/Typeimpls, no migration file changes.time0.3.55 is already inCargo.lock, pulled in transitively. Movingto it as a direct dependency adds no new crate to the tree.
jiffhas nosqlxintegration. Adopting it would mean converting throughtime(orchrono) at every DB round-trip — more surface, not less, and itwould not let us drop the
sqlx"chrono"feature that pullschronoinon our behalf regardless of our own direct use.
timeis the only one of the advisory's two suggested replacements thatactually removes
chronofrom the dependency graph end to end.Scope, confirmed against
devbygrep -rn chronoDirect
use chrono::/chrono::sites, 13 files (the issue's list named 11and two of those —
crates/server/src/devices.rsandcrates/server/src/devices/handlers.rs— do not currently usechronoatall; 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,Durationin testscrates/client/src/bin/grimoirix_signage_client.rs—Utc::now()crates/client/src/player.rs—DateTime<Utc>param + test call sitescrates/client/src/playback.rs—DateTime<Utc>param + test helperat()crates/client/tests/sync_survives_restart.rscrates/server/src/auth/handlers.rs—Utc::now() + chrono::Duration::hours(SESSION_LIFETIME_HOURS)for sessionexpires_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_atcrates/server/tests/media_acceptance_integration.rsMechanical substitution
chrono::DateTime<Utc>→time::OffsetDateTimechrono::Utc::now()→time::OffsetDateTime::now_utc()chrono::Duration::hours(n)/::seconds(n)→time::Duration::hours(n)/::seconds(n)(same builder shape, drop-in)Cargo.toml: replace thechrono = {...}dependency withtime = { version = "0.3", default-features = false, features = ["std", "parsing", "formatting", "macros"] }and remove
chrono.workspace = truefromcrates/{client,server,shared}/Cargo.toml.crates/server/Cargo.toml:sqlx = { ..., features = [..., "chrono", ...] }→ swap"chrono"for"time".chronois gone fromCargo.lockentirely (cargo tree -i chronoshould 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'sSerialize/Deserializeimpl forDateTime<Utc>emits RFC3339(
"2026-11-17T12:00:00Z") by default.time::OffsetDateTimehas nodefault
Serialize/Deserialize— a naive#[derive(Serialize)]swapcompiles but changes (or breaks) the wire format silently, and every struct
below crosses the JSON API boundary to
frontend-web: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 testbut drops these annotations still ships a frontend-facingregression, because nothing currently in the test suite pins the JSON shape
of a timestamp field.
Regression tests to specify (for whoever implements + QA)
containing a timestamp field is still
"YYYY-MM-DDTHH:MM:SSZ"(or withfractional seconds, matching today's chrono output exactly) after the
swap. This is the test that fails on a
#[derive(Serialize)]-onlymigration and passes once the
serde(with = ...)annotations are in place.expires_atcomputed viaOffsetDateTime::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
ignoreentry and ADR 0013: no knownexploit 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 thatassessment — 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.
Released by the chief of staff, 2026-11-17. Owner: @aetherforge.
Aegis's security review (comment) is the fix specification: replace
chronowithtime(sqlxtimefeature, drop sqlx'schronofeature), 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 datedignorefrom #305 holds until then.Done when
chronois gone fromCargo.lock, theRUSTSEC-2026-0543ignore entry is removed fromdeny.tomlin the same PR, and the gates are green. Aegis reviews the serde/wire-format part of the PR.Implementation done, condition 2 (crate swap) met:
chronois gone from theworkspace, replaced with
timeeverywhere it was used —client,server,shared, and the transitive pull viasqlx-core's feature flag (switchedsqlx's feature list from"chrono"to"time"incrates/server/Cargo.toml).Scope grew since the review:
devices.rs/devices/handlers.rsnow usechronotoo (added by the GRI-2180/signage#223 merge after the review waswritten, for
last_seen_at), so they're included in this change alongsidethe 11 files the review named.
timeoverjiff, per the review:sqlx0.8.6's nativetimefeature maps
TIMESTAMPTZtoOffsetDateTimedirectly;time0.3.55 wasalready resolved transitively, so this adds no new crate to the graph.
DateTime<Utc>field is nowOffsetDateTimewith#[serde(with = "time::serde::rfc3339")](or::optionfor the nullableones), 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.RUSTSEC-2026-0543ignoreentry fromdeny.toml.Verification:
cargo check --workspace --all-targets— clean, including--features gtk-rendereronclient.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, andnothing else flags on
time).cargo test -p shared -p client --lib— 140 passed, including the frozenwire-format tests in
shared::protocoland the existingValidityWindowboundary tests in
shared::content(now exercisingtimeparsing/arithmetic)../scripts/local-gates.sh --rust-onlyrunning now (includes thePostgres-backed server integration suite — the two
rollout_snapshot_last_seen_acceptance_integrationtests are the regressiontest the review asked for: they parse
last_seen_atoff the wire as RFC3339 and assert it's recent).
Will report the full gate result and push once it finishes.
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
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.