Repository navigation
Description
Problem / Background
cargo deny check advisories reports RUSTSEC-2026-0543: chrono is unmaintained, all versions are affected, and no safe upgrade exists (announcement: chronotope/chrono#1768). The advisory recommends jiff or time. There is no known vulnerability, so this is maintenance work. Ignoring the advisory in .cargo/audit.toml (currently ignore = []) is not an acceptable fix.
bssh depends on chrono directly (Cargo.toml:52, chrono = { version = "0.4.45", features = ["serde"] }) and transitively through russh-sftp 3.0.1 (src/utils.rs and src/protocol/file.rs there use DateTime<Utc>). russh-util 0.52.0 also lists chrono, but only for cfg(target_arch = "wasm32"). Removing the direct dependency therefore does NOT remove chrono from Cargo.lock or clear the advisory; that requires an upstream change in russh-sftp, tracked as an optional task below. No upstream russh-sftp issue about chrono exists today.
Current usage (all real call sites)
src/server/audit/event.rs:20,35,188:AuditEvent.timestamp: DateTime<Utc>, serde-serialized, set withUtc::now(). Serialized by the file and logstash exporters, and converted toSystemTimeinsrc/server/audit/otel.rs:144(event.timestamp.into()).src/ui/tui/log_buffer.rs:20,43,53,85:LogEntry.timestamp: DateTime<Local>, rendered as%H:%M:%Sin local time.src/utils/output.rs:34:chrono::Local::now().format("%Y%m%d_%H%M%S")for output file names.src/executor/parallel.rs:1772:chrono::Utc::now().format("%Y%m%d_%H%M%S")for output file names (UTC, unlikeoutput.rs; keep each as-is).src/commands/interactive/multiplex.rs:19,265:use chrono;andchrono::Local::now().format("%H:%M:%S")for interactive timestamps.
Other grep hits for "chrono" (e.g. "synchronous" in server/shell.rs, server/mod.rs, ssh/tokio_client/*) are false positives.
Recommended crate: jiff
Recommend jiff (with serde feature). bssh needs local-time formatting in a multi-threaded tokio process, and time's OffsetDateTime::now_local() returns an error on multi-threaded Unix processes unless the unsound opt-out is enabled, so three of the five call sites would break or silently fall back to UTC. jiff reads the system time zone itself (Zoned::now()), supports strftime-style strftime("%H:%M:%S"), serializes jiff::Timestamp as RFC 3339 with Z, and converts to SystemTime. time 0.3 is already in the tree via hickory, which is the main argument for it; the implementer may choose time only if local time works correctly under tokio without unsound flags.
Tasks
- Replace
chronowith the chosen crate inCargo.tomland all five call sites above; removeuse chrono;frommultiplex.rs. -
AuditEvent.timestamp: usejiff::Timestamp(UTC instant), keeping the serialized JSON field a RFC 3339 UTC string withZsuffix; keep the otelSystemTimeconversion. -
LogEntry.timestampand themultiplex.rs/output.rstimestamps: keep local time;parallel.rsstays UTC. - Confirm the crate's MSRV fits
rust-version = "1.97"and that static musl release builds and the vendored Launchpad PPA build still work. (MSRV confirmed: jiff 1.0.1 needs 1.85; musl and PPA builds pending CI/release, PR update: replace unmaintained chrono with jiff #364) - Optional: file an upstream issue (or PR) on russh-sftp to replace chrono, and link it here.
Acceptance Criteria
-
chronois no longer a direct dependency of bssh (cargo tree -i chrono -e normalshows only russh-sftp/russh-util as dependents). - A test asserts
AuditEventJSONtimestampis RFC 3339 UTC withZ, and that JSON written by the current chrono-based code (e.g."2026-11-20T01:02:03.123456789Z"and"2026-11-20T01:02:03Z") still deserializes. - Output file names keep the
%Y%m%d_%H%M%Sformat and TUI/interactive timestamps keep%H:%M:%Sin local time; existinglog_buffer.rstests pass. -
cargo fmt --check,cargo clippy -- -D warnings, and the test suite pass. - The advisory status is reported honestly in the PR: still present via russh-sftp until upstream changes.
Verification
cargo fmt --check
cargo clippy -- -D warnings
cargo test --lib
cargo test --tests -- --skip integration_test
cargo tree -i chrono -e normal
cargo deny check advisories
Activity
test: cover log entry timestamp formatting after the jiff migration