feat(uptime): kafka extended configuration for SASL auth & TLS#425
feat(uptime): kafka extended configuration for SASL auth & TLS#425
Conversation
| impl std::fmt::Display for KafkaSecurityProtocol { | ||
| fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
| let serialized = serde_json::to_string(self).unwrap(); | ||
| write!(f, "{}", serialized) | ||
| } | ||
| } |
There was a problem hiding this comment.
Bug: Kafka security protocol Display implementation serializes enum variants as JSON-quoted strings, which are rejected by the Kafka configuration library.
Severity: CRITICAL | Confidence: 0.99
🔍 Detailed Analysis
The Display implementation for KafkaSecurityProtocol at src/app/config.rs:61-66 uses serde_json::to_string(self).unwrap(). This serializes enum variants into JSON-quoted string literals, such as "sasl_plaintext". However, the Kafka configuration library expects unquoted values like sasl_plaintext. When kafka_security_protocol.to_string() is used in src/manager.rs:218, the Kafka library receives a quoted string, leading to rejection and runtime initialization failure.
💡 Suggested Fix
Modify the Display implementation for KafkaSecurityProtocol to directly output the unquoted string representation of the enum variant, instead of using serde_json::to_string().
🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: src/app/config.rs#L61-L66
Potential issue: The `Display` implementation for `KafkaSecurityProtocol` at
`src/app/config.rs:61-66` uses `serde_json::to_string(self).unwrap()`. This serializes
enum variants into JSON-quoted string literals, such as `"sasl_plaintext"`. However, the
Kafka configuration library expects unquoted values like `sasl_plaintext`. When
`kafka_security_protocol.to_string()` is used in `src/manager.rs:218`, the Kafka library
receives a quoted string, leading to rejection and runtime initialization failure.
Did we get this right? 👍 / 👎 to inform future reviews.
3c24c37 to
4769f92
Compare
No description provided.