Fix silent message corruption from absent/blank channel scripts (#344)#351
Open
e210 wants to merge 2 commits into
Open
Fix silent message corruption from absent/blank channel scripts (#344)#351e210 wants to merge 2 commits into
e210 wants to merge 2 commits into
Conversation
OpenIntegrationEngine#344) Signed-off-by: Ezio Caffi <ezio.caffi@gmail.com>
Signed-off-by: Ezio Caffi <ezio.caffi@gmail.com>
e210
force-pushed
the
fix/issue-344-undefined-preprocessor
branch
from
July 16, 2026 07:48
c0fd2d2 to
7642566
Compare
e210
marked this pull request as ready for review
July 16, 2026 07:50
e210
requested review from
a team,
NicoPiel,
gibson9583,
jonbartels,
kayyagari,
kpalang,
ssrowe and
tonygermano
July 16, 2026 07:50
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 the root cause behind #344:
POST /api/channelsaccepts a channel without<preprocessingScript>; the channel deploys "healthy" but corrupts every message to the literal stringundefinedon the wire.Root cause
Two independent defects in
JavaScriptUtil(full analysis in #344):JavaScriptBuilder.generateScriptstring-concatenates anullscript into the JS wrapper, producingfunction doScript() { null }.compileAndAddScriptcaches it as a "custom" preprocessor because its body differs from the default script.executePreprocessorScriptsguards results withresult != null, but Rhino'sUndefinedis not Javanull—Context.jsToJavacoerces it to the string"undefined", which becomes the processed raw and flows to every destination.Changes
compileAndAddScript: a null/blank script is now treated as absent — evict from the compiled-script cache and returnfalse(all callers already handlefalseas "no script").executePreprocessorScripts: both result checks (global + channel) now ignoreUndefined, the same idiomgetPostprocessorResponsealready uses.JavaScriptUtilTest: 5 tests exercising the real Rhino path (TDD — each fix developed against a failing test).Behavior change note
A user preprocessor with no
returnstatement previously corrupted the message body to"undefined"; it now passes the message through unchanged. This is footgun-removal: returning the literal string"undefined"as content is never intentional (return '';andreturn null;behave as before).Verification
:server:testsuite green.\x0bundefined\x1c\rThe broader ask in #344 — structural validation/normalization in
POST /api/channels— is deliberately out of scope here; it deserves its own design discussion. This PR removes the data corruption.