-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Remove h from ESCAPED_CHARS in JsonMapObjectReaderWriter #1872
Conversation
Signed-off-by: Craig Perkins <cwperx@amazon.com>
@reta Could you take a look? This is related to an issue in the OpenSearch security plugin. |
@@ -49,7 +49,6 @@ public class JsonMapObjectReaderWriter { | |||
chars.add('/'); | |||
chars.add('b'); | |||
chars.add('f'); |
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.
chars.add('n');
I believe it was a typo (https://datatracker.ietf.org/doc/html/rfc8259#section-7)L
string = quotation-mark *char quotation-mark
char = unescaped /
escape (
%x22 / ; " quotation mark U+0022
%x5C / ; \ reverse solidus U+005C
%x2F / ; / solidus U+002F
%x62 / ; b backspace U+0008
%x66 / ; f form feed U+000C
%x6E / ; n line feed U+000A
%x72 / ; r carriage return U+000D
%x74 / ; t tab U+0009
%x75 4HEXDIG ) ; uXXXX U+XXXX
escape = %x5C ; \
quotation-mark = %x22 ; "
unescaped = %x20-21 / %x23-5B / %x5D-10FFFF
Thanks a lot @cwperks !
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.
Changed this to n
. Good catch!
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.
@coheigea could you please take a look? very minor change, thank you (I think a typo sneaked in during https://issues.apache.org/jira/browse/CXF-8555)
Signed-off-by: Craig Perkins <cwperx@amazon.com>
@coheigea Could you review this change? |
* Remove h from ESCAPED_CHARS in JsonMapObjectReaderWriter Signed-off-by: Craig Perkins <cwperx@amazon.com> * Change to n Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Craig Perkins <cwperx@amazon.com> (cherry picked from commit 7dcafef)
* Remove h from ESCAPED_CHARS in JsonMapObjectReaderWriter Signed-off-by: Craig Perkins <cwperx@amazon.com> * Change to n Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Craig Perkins <cwperx@amazon.com> (cherry picked from commit 7dcafef)
* Remove h from ESCAPED_CHARS in JsonMapObjectReaderWriter Signed-off-by: Craig Perkins <cwperx@amazon.com> * Change to n Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Craig Perkins <cwperx@amazon.com> (cherry picked from commit 7dcafef) (cherry picked from commit 311ce17)
The JsonMapObjectReaderWriter class maintains a list of ESCAPED_CHARS which includes special characters that need to be escaped like the newline (
\n
) and tab (\t
) characters. This list also includes\h
, but I can't find any links to official documentation about this character needing to be escaped.According to this SO post which details escaped characters in JSON, it also does not include
\h
in this list.I'm opening a PR to discuss removing this from the list.
Issue in OpenSearch where this issue is discussed: opensearch-project/security#2531 (comment)
Simple test case which demonstrates the difference:
Output:
jwt2 has an invalid payload.