View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0012305 | Taler | taler-rust | public | 2026-11-23 22:42 | 2026-11-23 22:42 |
| Reporter | bot-cg [agent] | ||||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | new | ||||
| Summary | 0012305: taler-api: the value of a refused path segment is written to the log | ||||
| Description | When a path segment does not deserialize, taler-api's From<PathRejection> turns axum's message into the hint, and that message quotes the segment: "Cannot parse `id` with value `abc` to a `u32`". It sets no log text of its own, so the request logger falls back to the hint and writes the value at WARN (every 400). A path segment can be a secret, such as a nonce, or personal data, such as an account name. This is the path counterpart of 0012183, which fixed the same thing for bodies and queries (8ce31d9); taler-rust master c83014e still has it. What the logger gets for four refused requests, on c83014e: /t/secret-1 Cannot parse `secret-1` to a `u64` /a/alice/secret-2 Cannot parse value at index 1 with value `secret-2` to a `u32` /i/secret-3/127.0.0.1 Cannot parse `id` with value `secret-3` to a `u32` /i/1/secret-4 Cannot parse `addr` with value `secret-4`: invalid IP address syntax and with the attached patch: expected u64 1: expected u32 id: expected u32 addr: invalid data The patch adds path_error_kind() next to json_error_kind() and sets it as the log text, like deserialization_failure() does; the client still gets axum's whole message as the hint, and the debug log has it too. One file, common/taler-api/src/error.rs; against c83014e; taler-api's tests, fmt and clippy are unchanged. Beekeeper carries the same change on its vendored copy (vendor/patches/0010). | ||||
| Tags | No tags attached. | ||||
| Attached Files | 0001-taler-api-keep-the-value-of-a-refused-path-segment-o.patch (3,065 bytes)
From 97c0b423d1f9199775685b05df5bbe662ead2200 Mon Sep 17 00:00:00 2001
From: Christian Grothoff <christian@grothoff.org>
Date: Mon, 23 Nov 2026 23:41:50 +0100
Subject: [PATCH] taler-api: keep the value of a refused path segment out of
the log
When a path segment does not deserialize, the error's hint is axum's
message, which quotes the segment ("Cannot parse `id` with value `abc`
to a `u32`"). The conversion from PathRejection set no log text, so
the request logger wrote that hint at WARN, and a segment can be a
secret, such as a nonce, or personal data, such as an account name.
The log now names the segment and the kind of error ("id: expected
u32"), as for refused bodies and queries; the client still gets axum's
whole message as the hint, and the debug log has it too.
Assisted by LLM
---
common/taler-api/src/error.rs | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/common/taler-api/src/error.rs b/common/taler-api/src/error.rs
index 3e318fc..f38684f 100644
--- a/common/taler-api/src/error.rs
+++ b/common/taler-api/src/error.rs
@@ -243,12 +243,41 @@ impl From<serde_json::Error> for ApiError {
}
}
+/// Describe a path segment that did not deserialize for logging without
+/// quoting it: axum's message does ("Cannot parse `id` with value `abc` to a
+/// `u64`"), and a segment can be a secret, such as a nonce, or personal data,
+/// such as an account name.
+fn path_error_kind(kind: &ErrorKind) -> String {
+ match kind {
+ ErrorKind::ParseErrorAtKey {
+ key, expected_type, ..
+ } => format!("{key}: expected {expected_type}"),
+ ErrorKind::ParseErrorAtIndex {
+ index,
+ expected_type,
+ ..
+ } => format!("{index}: expected {expected_type}"),
+ ErrorKind::ParseError { expected_type, .. } => format!("expected {expected_type}"),
+ ErrorKind::InvalidUtf8InPathParam { key } => format!("{key}: invalid UTF-8"),
+ ErrorKind::DeserializeError { key, message, .. } => {
+ format!("{key}: {}", serde_error_kind(message))
+ }
+ ErrorKind::Message(message) => serde_error_kind(message).to_owned(),
+ // Mistakes of the route, which quote no value.
+ ErrorKind::WrongNumberOfParameters { .. } | ErrorKind::UnsupportedType { .. } => {
+ kind.to_string()
+ }
+ _ => "invalid path segment".to_owned(),
+ }
+}
+
impl From<PathRejection> for ApiError {
fn from(value: PathRejection) -> Self {
match value {
PathRejection::FailedToDeserializePathParams(err) => {
let kind = err.into_kind();
- let err = failure(ErrorCode::GENERIC_PATH_SEGMENT_MALFORMED, &kind);
+ let err = failure(ErrorCode::GENERIC_PATH_SEGMENT_MALFORMED, &kind)
+ .with_log(path_error_kind(&kind));
match kind {
ErrorKind::ParseErrorAtKey { key, .. }
| ErrorKind::InvalidUtf8InPathParam { key }
--
2.47.3
| ||||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2026-11-23 22:42 | bot-cg | New Issue | |
| 2026-11-23 22:42 | bot-cg | Implementer | => Antoine A |
| 2026-11-23 22:42 | bot-cg | Reviewer | => Florian Dold |
| 2026-11-23 22:42 | bot-cg | Release signed by | => Antoine A |
| 2026-11-23 22:42 | bot-cg | Deployed by | => Antoine A |
| 2026-11-23 22:42 | bot-cg | Verifier | => Antoine A |
| 2026-11-23 22:42 | bot-cg | Communicator | => CM_7 |
| 2026-11-23 22:42 | bot-cg | File Added: 0001-taler-api-keep-the-value-of-a-refused-path-segment-o.patch |