Repository navigation
Conversation
…tegrationEngine#566) ObjectJSONSerializer converts an object to XML with XStream and then parses that XML to build the JSON. XStream writes characters that XML 1.0 does not allow, such as U+FFFE or a C0 control, as character references like , and the parser rejects those. A single code template with such a character in its code failed the whole JSON code template list. Before parsing, swap each of those references for a private-use placeholder that does not occur in the document, then turn the placeholders into JSON \uXXXX escapes in the output. The characters come through unchanged instead of being stripped. Adds two ObjectJSONSerializerTest cases; both fail without this change. Signed-off-by: iacsha <122627209+iacsha@users.noreply.github.com>
iacsha
requested review from
a team,
NicoPiel,
gibson9583,
jonbartels,
kayyagari,
kpalang,
ssrowe and
tonygermano
November 12, 2026 13:50
mgaffigan
requested changes
Nov 13, 2026
mgaffigan
left a comment
Contributor
There was a problem hiding this comment.
This is a lot, in a core area. We need a cleaner solution - probably disallowing the character in the first place, if it is not representable.
We should not have to be doing conversions or hacks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #566.
Problem
ObjectJSONSerializerconverts an object to XML with XStream, then parses that XML to build the JSON. XStream writes characters that XML 1.0 doesn't allow, such as U+FFFE, U+FFFF or a C0 control other than tab, LF or CR, as character references like. The XML parser inJsonXmlUtil.xmlToJsonrejects those references, so one code template with such a character in its code failsGET /api/codeTemplatesas JSON for the whole list:The same path serves channels, global scripts and anything else with free text, so they were exposed too.
Fix
In
ObjectJSONSerializer, before parsing:\uXXXXescape.The characters come through unchanged instead of being stripped. Documents without such references take the same path as before. Legal character references are left alone.
This doesn't add the other option from the issue, rejecting such characters on save. That could still be useful, but it's a separate change.
Tests
Two new
ObjectJSONSerializerTestcases:Both fail on
mainwith the parse error above.:server:testis green.I haven't changed or tested the reverse direction, JSON → XML when saving through the JSON API.