-
Notifications
You must be signed in to change notification settings - Fork 1.8k
cmake: kafka: fix OAuth Bearer detection on Windows #11294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,8 +28,19 @@ else() | |
| endif() | ||
| endif() | ||
|
|
||
| # OAuth Bearer is built into librdkafka when SASL is available | ||
| set(FLB_SASL_OAUTHBEARER_ENABLED ${FLB_SASL_ENABLED}) | ||
| # OAuth Bearer support: | ||
| # - Windows: Built-in SASL, only needs SSL (no Cyrus SASL required) | ||
| # - Linux/macOS: Needs both SSL and Cyrus SASL | ||
| if(WIN32) | ||
| if(WITH_SSL) | ||
| set(FLB_SASL_OAUTHBEARER_ENABLED ON) | ||
|
Comment on lines
+34
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In the new Windows branch the condition Useful? React with 👍 / 👎.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bp-cheng can you resolve the comments raised by the bot? Either it is an issue to be fixed or something that can be ignored with justification. |
||
| else() | ||
| set(FLB_SASL_OAUTHBEARER_ENABLED OFF) | ||
| endif() | ||
| else() | ||
| # Non-Windows platforms: require Cyrus SASL | ||
| set(FLB_SASL_OAUTHBEARER_ENABLED ${FLB_SASL_ENABLED}) | ||
| endif() | ||
|
Comment on lines
+34
to
+43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Find kafka.cmake and examine its content
find . -name "kafka.cmake" -o -name "CMakeLists.txt" | head -5
# Check cmake/kafka.cmake
if [ -f "cmake/kafka.cmake" ]; then
echo "=== cmake/kafka.cmake ==="
wc -l cmake/kafka.cmake
echo ""
echo "=== Lines 30-55 of cmake/kafka.cmake ==="
sed -n '30,55p' cmake/kafka.cmake
fi
# Check main CMakeLists.txt for WITH_SSL and kafka.cmake inclusion order
if [ -f "CMakeLists.txt" ]; then
echo ""
echo "=== Looking for WITH_SSL and kafka.cmake in CMakeLists.txt ==="
grep -n "WITH_SSL\|kafka.cmake" CMakeLists.txt | head -20
fiRepository: fluent/fluent-bit Length of output: 1184 🏁 Script executed: #!/bin/bash
# Check where WITH_SSL is first defined in CMakeLists.txt
echo "=== Searching for WITH_SSL definition in CMakeLists.txt ==="
grep -n "WITH_SSL\|FLB_TLS" CMakeLists.txt | head -30
echo ""
echo "=== Lines around line 808 where kafka.cmake is included ==="
sed -n '800,815p' CMakeLists.txt
echo ""
echo "=== Full kafka.cmake to understand the context ==="
head -80 cmake/kafka.cmakeRepository: fluent/fluent-bit Length of output: 3185 🏁 Script executed: #!/bin/bash
# Check if WITH_SSL is defined elsewhere or if FLB_OPTION creates cache variables
echo "=== Checking for FLB_OPTION macro definition ==="
grep -r "macro.*FLB_OPTION\|function.*FLB_OPTION" cmake/ 2>/dev/null | head -5
echo ""
echo "=== Checking all references to WITH_SSL in kafka.cmake ==="
grep -n "WITH_SSL" cmake/kafka.cmake
echo ""
echo "=== Checking if FLB_TLS should be used instead ==="
grep -n "FLB_TLS" CMakeLists.txt | head -10
echo ""
echo "=== Checking the flow: is kafka.cmake included after FLB_TLS is set? ==="
sed -n '737,808p' CMakeLists.txtRepository: fluent/fluent-bit Length of output: 2360 🏁 Script executed: #!/bin/bash
# Check the FLB_OPTION macro definition to understand what it does
echo "=== FLB_OPTION macro definition ==="
grep -A 5 "macro(FLB_OPTION" cmake/macros.cmake
echo ""
echo "=== Check what variables are actually defined/used ==="
echo "Variables defined in CMakeLists.txt:"
grep -n "^option\|^set.*ON\|^set.*OFF" CMakeLists.txt | grep -i "ssl\|tls" | head -20
echo ""
echo "=== Verify: Does WITH_SSL exist as a CMake variable? ==="
grep -r "^option.*WITH_SSL\|set(WITH_SSL" CMakeLists.txt cmake/*.cmake 2>/dev/nullRepository: fluent/fluent-bit Length of output: 481 Verify that FLB_TLS is used instead of WITH_SSL for OAuth Bearer logic. The condition at line 35 checks The claim about librdkafka OAuth Bearer support on Windows is accurate: librdkafka supports OAUTHBEARER, and Windows provides built-in SASL capabilities through SSPI, so only SSL is required for token endpoint verification. 🤖 Prompt for AI Agents
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I agree with this one, I think we use FLB_TLS There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @patrick-stephens, thanks for confirming! You're absolutely right. The code should use # OAuth Bearer support:
# - Windows: Built-in SASL, only needs SSL (no Cyrus SASL required)
# - Linux/macOS: Needs both SSL and Cyrus SASL
if(WIN32)
if(FLB_TLS)
set(FLB_SASL_OAUTHBEARER_ENABLED ON)
else()
set(FLB_SASL_OAUTHBEARER_ENABLED OFF)
endif()
else()
# Non-Windows platforms: require Cyrus SASL
set(FLB_SASL_OAUTHBEARER_ENABLED ${FLB_SASL_ENABLED})
endif()The key change is on line 35: 🧠 Learnings used |
||
|
|
||
| # MSK IAM requires OAuth Bearer support | ||
| set(FLB_KAFKA_MSK_IAM_ENABLED ${FLB_SASL_OAUTHBEARER_ENABLED}) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cosmo0920 should this be FLB_WINDOWS or something similar?