Skip to content

Disable Mustache partial template resolution in CustomMustacheFactory - #22438

Merged
cwperks merged 1 commit into
opensearch-project:mainfrom
cwperks:fix/disable-mustache-partial-resolution
Jul 10, 2026
Merged

Disable Mustache partial template resolution in CustomMustacheFactory#22438
cwperks merged 1 commit into
opensearch-project:mainfrom
cwperks:fix/disable-mustache-partial-resolution

Conversation

@cwperks

@cwperks cwperks commented Jul 10, 2026

Copy link
Copy Markdown
Member

Description

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.

Changes

  • CustomMustacheFactory.java — added getReader() override that throws
  • CustomMustacheFactoryTests.java — added tests for file URL partial, relative path partial (both blocked), and inline template (still works)

Testing

  • ./gradlew :modules:lang-mustache:test passes
  • ./gradlew :modules:lang-mustache:precommit passes

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>
@cwperks
cwperks requested a review from a team as a code owner July 10, 2026 16:57
@github-actions

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@github-actions

Copy link
Copy Markdown
Contributor

✅ Gradle check result for 03874f2: SUCCESS

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.44%. Comparing base (1e31adf) to head (03874f2).
⚠️ Report is 36 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cwperks
cwperks merged commit e1fa8aa into opensearch-project:main Jul 10, 2026
21 checks passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants