From 6db5ac496881b1f543559f8cc33341eff9f2a65f Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 14 Sep 2026 13:53:08 +0800 Subject: [PATCH] fix(connect): emit canonical top envelope time (#7836) --- rustfs/src/connect/diagnostics/top_api.rs | 6 +++++- rustfs/tests/connect_top_net.rs | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/rustfs/src/connect/diagnostics/top_api.rs b/rustfs/src/connect/diagnostics/top_api.rs index e4a50a511..cf63dcc2f 100644 --- a/rustfs/src/connect/diagnostics/top_api.rs +++ b/rustfs/src/connect/diagnostics/top_api.rs @@ -471,7 +471,11 @@ pub fn sign_top_export( classification: TOP_CLASSIFICATION, consent_uid: &request.scope.consent.uid, policy_revision: request.scope.policy_revision, - produced_at: now.format(&Rfc3339).map_err(|_| TopCaptureError::Serialization)?, + produced_at: now + .replace_nanosecond(0) + .map_err(|_| TopCaptureError::Serialization)? + .format(&Rfc3339) + .map_err(|_| TopCaptureError::Serialization)?, expires_at: OffsetDateTime::from_unix_timestamp(expires_at_unix) .map_err(|_| TopCaptureError::Expired)? .format(&Rfc3339) diff --git a/rustfs/tests/connect_top_net.rs b/rustfs/tests/connect_top_net.rs index 3856fc008..037288ebd 100644 --- a/rustfs/tests/connect_top_net.rs +++ b/rustfs/tests/connect_top_net.rs @@ -188,6 +188,7 @@ fn top_network_export_is_bounded_redacted_and_signed_over_exact_envelope_bytes() let envelope: serde_json::Value = serde_json::from_slice(&export.envelope_json).expect("envelope"); assert_eq!(envelope["toolId"], "top.net"); assert_eq!(envelope["classification"], "L3"); + assert_eq!(envelope["producedAt"].as_str().expect("producedAt").len(), 20); assert_eq!(envelope["payload"]["path"], "result.json"); assert_eq!(envelope["payload"]["sha256"], export.result_sha256); let result_text = String::from_utf8_lossy(&export.result_json);