Disable Mustache partial template resolution in CustomMustacheFactory - #22438
Merged
cwperks merged 1 commit intoJul 10, 2026
Merged
Conversation
Override getReader() in CustomMustacheFactory to throw MustacheException
when a partial template ({{>name}}) is encountered at compile time.
Search templates in OpenSearch are self-contained inline strings, so
partial resolution has no legitimate use.
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Contributor
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
andrross
approved these changes
Jul 10, 2026
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #22438 +/- ##
============================================
+ Coverage 73.34% 73.44% +0.09%
- Complexity 76017 76136 +119
============================================
Files 6076 6075 -1
Lines 345507 345456 -51
Branches 49732 49724 -8
============================================
+ Hits 253409 253712 +303
+ Misses 71869 71545 -324
+ Partials 20229 20199 -30 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
cwperks
added a commit
that referenced
this pull request
Jul 10, 2026
…#22438) (#22440) Override getReader() in CustomMustacheFactory to throw MustacheException when a partial template ({{>name}}) is encountered at compile time. Search templates in OpenSearch are self-contained inline strings, so partial resolution has no legitimate use. (cherry picked from commit e1fa8aa) Signed-off-by: Craig Perkins <cwperx@amazon.com> Signed-off-by: opensearch-ci-bot <opensearch-infra@amazon.com> Co-authored-by: Craig Perkins <cwperx@amazon.com>
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.
Description
Override
getReader()inCustomMustacheFactoryto throwMustacheExceptionwhen a partial template ({{>name}}) is encountered at compile time. Search templates in OpenSearch are self-contained inline strings, so partial resolution has no legitimate use.Changes
CustomMustacheFactory.java— addedgetReader()override that throwsCustomMustacheFactoryTests.java— added tests for file URL partial, relative path partial (both blocked), and inline template (still works)Testing
./gradlew :modules:lang-mustache:testpasses./gradlew :modules:lang-mustache:precommitpasses