{"record":{"id":"090b377b7e3fb54a","repo":"Pumpkin-MC/Pumpkin","slug":"invalid-timestamp-string-format","errorCode":null,"errorMessage":"Invalid timestamp string format","messagePattern":"Invalid timestamp string format","errorType":"error_code","errorClass":"TelemetryVerificationError","httpStatus":null,"severity":"warning","filePath":"crates/pumpkin/src/telemetry.rs","lineNumber":121,"sourceCode":"\n/// Signs telemetry message data using an Ed25519 signing key and returns `(public_key_hex, signature_hex)`.\n#[must_use]\npub fn sign_telemetry_payload(\n    signing_key: &SigningKey,\n    timestamp_str: &str,\n    body_bytes: &[u8],\n) -> (String, String) {\n    let signed_data = compute_signed_data(timestamp_str, body_bytes);\n    let signature = signing_key.sign(&signed_data);\n    let pubkey_hex = hex::encode(signing_key.verifying_key().to_bytes());\n    let sig_hex = hex::encode(signature.to_bytes());\n    (pubkey_hex, sig_hex)\n}\n\n/// Errors that can occur during telemetry request signature verification.\n#[derive(Debug, thiserror::Error, PartialEq, Eq)]\npub enum TelemetryVerificationError {\n    #[error(\"Invalid timestamp string format\")]\n    InvalidTimestamp,\n    #[error(\n        \"Timestamp drift exceeded: drift was {drift}s (max allowed is {MAX_CLOCK_DRIFT_SECS}s)\"\n    )]\n    ClockDriftExceeded { drift: u64 },\n    #[error(\"Invalid public key hex encoding\")]\n    InvalidPublicKeyHex,\n    #[error(\"Invalid public key bytes: {0}\")]\n    InvalidPublicKey(String),\n    #[error(\"Invalid signature hex encoding\")]\n    InvalidSignatureHex,\n    #[error(\"Invalid signature bytes: {0}\")]\n    InvalidSignature(String),\n    #[error(\"Signature verification failed: {0}\")]\n    VerificationFailed(String),\n}\n\n/// Verifies a signed telemetry request against an Ed25519 public key and timestamp.","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin/src/telemetry.rs#L103-L139","documentation":"TelemetryVerificationError::InvalidTimestamp is returned during telemetry request signature verification when the timestamp string extracted from the request cannot be parsed into a valid timestamp. Signature verification requires a well-formed timestamp to bind the request to a point in time before checking drift and signature; a malformed string fails fast with this error.","triggerScenarios":"A telemetry client sends a request whose timestamp header/field is absent-of-format — wrong date format, empty string, non-numeric epoch, or a string with unexpected characters — and verification attempts to parse it.","commonSituations":"Client and server agreeing on different timestamp formats after an API change; manually crafted or replayed requests with hand-written timestamps; a proxy stripping or rewriting the timestamp header; misconfigured custom telemetry clients.","solutions":["Send the timestamp in the exact format the verifier expects (check the client implementation for the canonical format, e.g. RFC 3339 or epoch string)","Update/upgrade the telemetry client library so it produces the current timestamp format","Inspect the raw request (proxy logs) to confirm the timestamp field is not stripped or rewritten in transit","If testing manually, generate the timestamp programmatically rather than typing it"],"exampleFix":"// before\nheaders.insert(\"x-timestamp\", \"09/09/2026 12:00\");\n// after\nheaders.insert(\"x-timestamp\", &chrono::Utc::now().to_rfc3339());","handlingStrategy":"validation","validationCode":"fn valid_timestamp(ts: &str) -> bool {\n    chrono::DateTime::parse_from_rfc3339(ts).is_ok()\n}\n// call before signing/sending: assert!(valid_timestamp(&ts))","typeGuard":null,"tryCatchPattern":"match verify_signature(&req) {\n    Err(TelemetryVerificationError::InvalidTimestamp) => {\n        reject(400, \"timestamp must be RFC 3339\");\n    }\n    other => other?,\n}","preventionTips":["Always generate timestamps with a standard library formatter (RFC 3339)","Never hand-type timestamps in test requests","Check proxies/gateways don't rewrite the timestamp header","Keep client telemetry libraries up to date with the server's expected format"],"tags":["telemetry","signature-verification","timestamp","parsing"],"backgroundTag":"invalid-date-format","analyzedSha":"8d4639e25a57c15e47448ec327c780d41bbf2356","analyzedAt":"2026-09-09T15:32:22.916Z","contentChangedAt":"2026-09-09T15:32:22.916Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}