Skip to content

Non-java clients identity pool extension comma parsing #5001

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

PratRanj07
Copy link
Contributor

@PratRanj07 PratRanj07 commented Mar 24, 2025

This PR intends to implement CSV format parsing for SASL OAuthbearer Extensions.

Supported extension format examples:

'sasl.oauthbearer.extensions':'logicalCluster=l1_value,identityPoolId=i1_value'
'sasl.oauthbearer.extensions':'logicalCluster=l1_value,"identityPoolId=i1_value,i2_value",myOtherExtension=myExtensionValue'

@Copilot Copilot AI review requested due to automatic review settings March 24, 2025 13:54
@PratRanj07 PratRanj07 requested a review from a team as a code owner March 24, 2025 13:54
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.

Files not reviewed (3)
  • src/rdkafka_sasl_oauthbearer_oidc.c: Language not supported
  • src/rdstring.c: Language not supported
  • src/rdstring.h: Language not supported

@confluent-cla-assistant
Copy link

🎉 All Contributor License Agreements have been signed. Ready to merge.
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

src/rdstring.c Outdated
* @returns The parsed fields in an array. The number of elements in the
* array is returned in \p cntp.
*/
char **rd_string_split_csv(const char *input,
Copy link
Member

Choose a reason for hiding this comment

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

I think we should return error code and also handle the cases where input string is invalid, like " started but no ending " present.

src/rdstring.c Outdated
Comment on lines 775 to 837
{
"extension1:extension1val,\"extension2:extension2val1,"
"extension2val2\"",
',',
rd_true,
2,
{"extension1:extension1val",
"extension2:extension2val1,extension2val2"},
},
{
"extension1:extension1val,extension2:extension2val1",
',',
rd_true,
2,
{"extension1:extension1val", "extension2:extension2val1"},
},
Copy link
Member

Choose a reason for hiding this comment

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

Can we also add other edge cases like empty string, string with just a single k:v pair, and using escape sequences. And also test for invalid strings.

@anchitj
Copy link
Member

anchitj commented Mar 25, 2025

Thanks @PratRanj07. Some minor comments, but overall looks good. Let's verify manually with a cluster too.

@anchitj
Copy link
Member

anchitj commented Apr 4, 2025

Also verify if the extensions have spaces can they be parsed correctly and interpreted by the broker. Like identityPoolId=p1, p2

src/rdstring.c Outdated

*cntp = 0;

// Count approximate field count (ignore sep inside quotes)
Copy link
Member

Choose a reason for hiding this comment

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

Please place comments in /* */ blocks

@PratRanj07 PratRanj07 changed the title NONJAVACLI-3632: Non-java clients identity pool extension comma parsing Non-java clients identity pool extension comma parsing Apr 9, 2025
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