Skip to content

Support triple quote strings to disambiguate between String and EscapedJsonPointer#5655

Merged
kkondaka merged 6 commits into
opensearch-project:mainfrom
cwperks:raw-string
Jul 16, 2025
Merged

Support triple quote strings to disambiguate between String and EscapedJsonPointer#5655
kkondaka merged 6 commits into
opensearch-project:mainfrom
cwperks:raw-string

Conversation

@cwperks
Copy link
Copy Markdown
Member

@cwperks cwperks commented Apr 25, 2025

Description

Attempts to resolve an issue with Strings where the first character is a forward slash. Currently the grammar parses these as escaped JSON pointers which renders it impossible to match to any string that begins with a forward slash. The changes in this PR support triple quote for Strings to help with disambiguation from Escaped JSON Pointers.

I discovered this issue when trying to build a dashboard using audit logs generated from the security plugin and drop repeat events which sometimes includes the path of the request which always begins with a forward slash.

Issues Resolved

Resolves #1188

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Craig Perkins <cwperx@amazon.com>
@kkondaka
Copy link
Copy Markdown
Collaborator

Thank you for your contribution.

@kkondaka
Copy link
Copy Markdown
Collaborator

@cwperks please add some tests testing the conditionals in GenericExpressionEvaluator_ConditionalIT.java

Signed-off-by: Craig Perkins <cwperx@amazon.com>
@cwperks
Copy link
Copy Markdown
Member Author

cwperks commented Apr 30, 2025

Added a new IT in GenericExpressionEvaluator_ConditionalIT

Copy link
Copy Markdown
Member

@dlvenable dlvenable left a comment

Choose a reason for hiding this comment

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

Thanks @cwperks for the contribution! I have some thoughts on the syntax and approach to the grammar.

Comment thread data-prepper-expression/src/main/antlr/DataPrepperExpression.g4 Outdated
Comment thread data-prepper-expression/src/main/antlr/DataPrepperExpression.g4 Outdated
cwperks added 2 commits May 6, 2025 13:36
Signed-off-by: Craig Perkins <cwperx@amazon.com>
@cwperks cwperks changed the title Introduce RawString type to allow strings that begin with forward slash Support triple quote strings to disambiguate between String and EscapedJsonPointer May 6, 2025
Signed-off-by: Craig Perkins <cwperx@amazon.com>
dlvenable
dlvenable previously approved these changes May 7, 2025
Copy link
Copy Markdown
Member

@dlvenable dlvenable left a comment

Choose a reason for hiding this comment

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

Thanks @cwperks !

Signed-off-by: Craig Perkins <craig5008@gmail.com>
@cwperks
Copy link
Copy Markdown
Member Author

cwperks commented May 20, 2025

Resolved the conflicts

@kkondaka kkondaka merged commit 2fe41c3 into opensearch-project:main Jul 16, 2025
43 of 47 checks passed
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.

[BUG] Data Prepper Expression string starting in / is considered escaped Json Pointer

3 participants