Skip to content

Conversation

@klochek
Copy link
Contributor

@klochek klochek commented Nov 10, 2025

No description provided.

@klochek klochek requested a review from a team as a code owner November 10, 2025 21:42
@linear
Copy link

linear bot commented Nov 10, 2025

Comment on lines 61 to 67
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)
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@klochek klochek force-pushed the christopherklochek/new-540-feat-kafka-extended-configuration-for-sasl-auth-tls branch from 3c24c37 to 4769f92 Compare November 10, 2025 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants