Skip to content
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

parser/keyvalue: handle escaped quotes when parsing #36176

Conversation

jadams41
Copy link
Contributor

@jadams41 jadams41 commented Nov 4, 2024

Description

Currently, the keyvalue parser does handle escaped quotes and instead will parse this as independent '', '"' characters. This results in unexpected breakages between fields for strings like:

="...\" ..."
Here, the backslash will be appended to the result pair, while the (now un-)escaped quotation will result in the pair being terminated early.

Add handling of escaped quotation marks (for both ", ') in the keyvalue parser along with a testcase to exercise this functionality.

@jadams41 jadams41 requested review from djaglowski and a team as code owners November 4, 2024 18:58
Copy link

linux-foundation-easycla bot commented Nov 4, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

Currently, the SplitString parser does not handle escaped quotes and instead
will parse these as independent '\', '"' characters. This results in
unexpected breakages between fields for strings like:
> <key>="...\" ..."
Here, the backslash will be appended to the result pair, while the
(now un-)escaped quotation will result in the pair being terminated early.

Add handling of escaped quotation marks (for both ", ') in the
keyvalue parser along with a testcase to exercise this functionality.

Signed-off-by: Ethan Adams <eadams@netflix.com>
@jadams41 jadams41 force-pushed the eadams/escaped-quotes-in-keyvalue-parser branch from b5342fd to b87144c Compare November 5, 2024 15:35
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Nov 23, 2024
@jadams41
Copy link
Contributor Author

jadams41 commented Dec 2, 2024

This PR was marked stale due to lack of activity. It will be closed in 14 days.

Hello - wondering if there is anything I should be doing to drive this? If this is just pending review, I can bump on a newer main to try to avoid this getting closed as stale.

@github-actions github-actions bot removed the Stale label Dec 3, 2024
Copy link
Member

@djaglowski djaglowski left a comment

Choose a reason for hiding this comment

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

Thanks @jadams41. Sorry for the delayed review.

@djaglowski djaglowski merged commit 2b7db84 into open-telemetry:main Dec 4, 2024
158 checks passed
@github-actions github-actions bot added this to the next release milestone Dec 4, 2024
shivanthzen pushed a commit to shivanthzen/opentelemetry-collector-contrib that referenced this pull request Dec 5, 2024
…6176)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Currently, the keyvalue parser does handle escaped quotes and instead
will parse this as independent '\', '"' characters. This results in
unexpected breakages between fields for strings like:
> <key>="...\\" ..."
Here, the backslash will be appended to the result pair, while the (now
un-)escaped quotation will result in the pair being terminated early.

Add handling of escaped quotation marks (for both ", ') in the keyvalue
parser along with a testcase to exercise this functionality.

---------

Signed-off-by: Ethan Adams <eadams@netflix.com>
Co-authored-by: Daniel Jaglowski <jaglows3@gmail.com>
ZenoCC-Peng pushed a commit to ZenoCC-Peng/opentelemetry-collector-contrib that referenced this pull request Dec 6, 2024
…6176)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Currently, the keyvalue parser does handle escaped quotes and instead
will parse this as independent '\', '"' characters. This results in
unexpected breakages between fields for strings like:
> <key>="...\\" ..."
Here, the backslash will be appended to the result pair, while the (now
un-)escaped quotation will result in the pair being terminated early.

Add handling of escaped quotation marks (for both ", ') in the keyvalue
parser along with a testcase to exercise this functionality.

---------

Signed-off-by: Ethan Adams <eadams@netflix.com>
Co-authored-by: Daniel Jaglowski <jaglows3@gmail.com>
sbylica-splunk pushed a commit to sbylica-splunk/opentelemetry-collector-contrib that referenced this pull request Dec 17, 2024
…6176)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
Currently, the keyvalue parser does handle escaped quotes and instead
will parse this as independent '\', '"' characters. This results in
unexpected breakages between fields for strings like:
> <key>="...\\" ..."
Here, the backslash will be appended to the result pair, while the (now
un-)escaped quotation will result in the pair being terminated early.

Add handling of escaped quotation marks (for both ", ') in the keyvalue
parser along with a testcase to exercise this functionality.

---------

Signed-off-by: Ethan Adams <eadams@netflix.com>
Co-authored-by: Daniel Jaglowski <jaglows3@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants