Skip to content

Comments

Tweak lang-mustache factory (#92211)#4

Open
MitchLewis930 wants to merge 1 commit intopr_014_beforefrom
pr_014_after
Open

Tweak lang-mustache factory (#92211)#4
MitchLewis930 wants to merge 1 commit intopr_014_beforefrom
pr_014_after

Conversation

@MitchLewis930
Copy link

@MitchLewis930 MitchLewis930 commented Jan 30, 2026

PR_014


Note

Medium Risk
Touches mustache rendering internals and changes where self-referential payloads are rejected, which can alter error surfaces and behavior in watcher transforms.

Overview
Switches CustomMustacheFactory from DefaultMustacheFactory to SafeMustacheFactory, updates custom function handling to use TemplateFunction, and makes small parsing/encoding tweaks (join delimiter regex and URLEncoder overload).

Removes the mustache-side self-reference guard (CustomReflectionObjectHandler.stringify) and instead validates watcher action payloads on construction (Payload.Simple), updating/rest-skipping watcher QA tests to reflect the new failure location and error shape.

Written by Cursor Bugbot for commit 34ddaa7. This will update automatically on new commits. Configure here.

This commits makes a few very minor tweaks to our Mustache scripting capabilities.

1. Switches from `DefaultMustacheFactory` to `SafeMustacheFactory`
In the event that the security manager were disabled (or removed, as is threatened in subsequent JDK releases), Mustache's "partial template" (`{{>partial}}`) support is a security risk because it would allow reading from an arbitrary URL or file on disk. Switching to the "Safe" version and passing in an empty set into the parent constructor disallows using partial Mustache templates. This also switches from `Function<String, String>` to the `TemplateFunction` value for the built-in functions.

3. Minor internal optimization
This removes useless grouping for one of the built-in mustache functions, and removes the call to `CollectionUtils.ensureNoSelfReferences` used in `CustomReflectionObjectHandler`. This check during stringification should not be necessary because Mustache templates without "partial" support cannot be self-referencing.
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.

2 participants