Repository navigation
update: replace unmaintained chrono with jiff - #364
Conversation
chrono is unmaintained (RUSTSEC-2026-0543). jiff reads the system time zone itself, so local timestamps keep working in the multi-threaded tokio process, unlike time's now_local(). If the zone cannot be determined it behaves like UTC, as chrono's Local did. Audit event timestamps are now jiff::Timestamp with a serde helper that writes the same RFC 3339 UTC form chrono wrote (Z suffix, 0/3/6/9 fractional digits), so audit files and Logstash output are byte-compatible. The otel exporter converts with SystemTime::try_from. TUI log, interactive, and output file name timestamps keep their strftime formats and local-vs-UTC choice. Tests cover the serialized format and deserializing chrono-written records. chrono remains in Cargo.lock through russh-sftp, so the advisory stays open until that crate changes. Refs #363
Implementation Review SummaryIntent
Findings Addressed
Remaining Items
Verification
I checked serialization against chrono 0.4.45 serde output side by side for 0, 1, 3, 6, and 9 digit fractions across several epochs: the bytes are identical. Inputs with |
|
Security and performance review of the chrono to jiff migration: no CRITICAL, HIGH, or MEDIUM findings, no fixes pushed.
LOW: in Verified: clippy with |
LogEntry::format_with_time now formats through jiff strftime and had no test. Pin the timestamp to a fixed UTC instant and assert the HH:MM:SS prefix so the output stays stable independent of the local time zone. Validation: - cargo test --all-features --lib log_buffer: 8 passed - cargo fmt --check and cargo clippy --all-targets --all-features -- -D warnings clean Refs #363
Summary
Replaces the direct
chronodependency withjiff1.0.1 (MSRV 1.85, pure Rust) at all five call sites.jiffwas chosen overtimebecausetime'snow_local()fails in multi-threaded processes without the unsound opt-out, which would break three local-time call sites.jiffreads the system zone itself (TZ, then /etc/localtime) and falls back to a UTC-equivalent zone without panicking, matching chrono'sLocalfallback.AuditEvent.timestampis nowjiff::Timestamp. A small serde helper (src/server/audit/timestamp.rs) writes exactly what chrono wrote: RFC 3339 UTC,Zsuffix, 0/3/6/9 fractional digits (shortest exact width, chrono'sSecondsFormat::AutoSi). Before and after are byte-identical, for example2026-11-20T01:02:03Z,2026-11-20T01:02:03.123Z,2026-11-20T01:02:03.123456789Z. jiff's default printer would have trimmed to 1-9 digits, hence the helper. Deserialization accepts any RFC 3339 input with up to 9 fractional digits.SystemTime::try_from(jiff's conversion is fallible), falling back to now.%H:%M:%Slocal time;output.rsfile names keep local%Y%m%d_%H%M%Sandparallel.rskeeps UTC.docs/audit-logging.mddocuments the timestamp format (no Korean counterpart exists).Advisory status
RUSTSEC-2026-0543 remains open:
cargo tree -i chrono -e normalnow shows onlyrussh-sftp3.0.1 as a dependent, andcargo deny check advisoriesstill reports the advisory through it. Clearing it needs an upstream russh-sftp change, which this PR does not attempt.Test plan
Z; chrono-written records (.123456789Z,.123456Z,.123Z, no fraction) deserialize and re-serialize to the identical stringLogEntry::format_with_timetest pins a fixed instant and passes under both UTC andTZ=Asia/Seoulcargo test --all-features --no-fail-fast: 2743 passed; the 4tests/integration_test.rsfailures need a localhost SSH agent identity and fail identically on maincargo check --all-targets --all-features,cargo clippy --all-targets --all-features -- -D warnings,cargo fmt --checkjiff-coreandserde_core(pure Rust; the bundled tzdb crates are Windows/wasm only)Closes #363