Control chars breaks JSON serialization on CFEngine version 3.24.2 #5965
Closed
m4rtinh4rt
started this conversation in
General
Replies: 1 comment 2 replies
-
|
Hi @m4rtinh4rt, thanks for reporting this issue. I created a ticket in our bug tracker (see CFE-4616). Feel free to make a contribution if you want to :) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Control chars breaks JSON serialization on CFEngine version 3.24.2
As specified in section 7 of RFC 7159, the control characters (U+0000 through U+001F) must be escaped.
Example using a Python implementation with the control character 'escape' (ASCII: 27, Unicode: U+001B):
Outputs:
"{ \"msg\": \"\u001b[1;31mSome red text\n\u001b[39;49m\" }"Minimal example in CFEngine to reproduce the bug:
The created
/tmp/datastate.jsoncontains unescaped U+001B and therefore is not valid JSON.$ jq '.' /tmp/datastate.jsonoutputs:
jq: parse error: Invalid string: control characters from U+0000 through U+001F must be escaped at line 125, column 51Beta Was this translation helpful? Give feedback.
All reactions