Skip to content

fix: raise ParseException on malformed curly brace expression (#2377) - #2390

Merged
lbroudoux merged 2 commits into
microcks:masterfrom
aryarathoree:fix/expression-parser-brace-bounds
Oct 22, 2026
Merged

lbroudoux merged 2 commits into
microcks:masterfrom
aryarathoree:fix/expression-parser-brace-bounds

Conversation

@aryarathoree

Copy link
Copy Markdown
Contributor

Description

  • ExpressionParser: Validate that expressions wrapped in curly braces ({...}) have matching braces and non-empty inner content before substring slicing. Malformed expressions (e.g., {{{}}, {{{foo}}, {{{}}}) now raise a standard ParseException with a character offset instead of an unhandled StringIndexOutOfBoundsException.
  • Live Traces: In MockControllerCommons.unguardedRenderResponseContent(), log the failure message and record the exception along with a template_evaluation_failed span event on Span.current() for visibility in OpenTelemetry Live Traces.
  • TriggerWebhookTask: Handle template evaluation failures during webhook content rendering to prevent unchecked exceptions from disrupting background task execution.
  • Unit Tests: Added test cases in ExpressionParserTest covering unmatched closing braces, unclosed expressions, and empty or whitespace-only brace-wrapped expressions.

Related issue(s)

Fixes #2377

Test Results

image

Validate that curly brace wrapping has matching closing brace and non-empty content, raising ParseException instead of StringIndexOutOfBoundsException. Also record evaluation errors in live trace spans and guard webhook task.

Signed-off-by: Arya Rathore <[email protected]>
…n ExpressionParser

Verify ParseException is raised when encountering unmatched closing braces or empty expressions within curly brace delimiters.

Signed-off-by: Arya Rathore <[email protected]>
@github-actions

Copy link
Copy Markdown

👋 @aryarathoree

Welcome to the Microcks community! 💖

Thanks and congrats 🎉 for opening your first pull request here! Be sure to follow the pull request template or please update it accordingly.

Hope you have a great time there!

@lbroudoux lbroudoux left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It lloks great! Thnak you 🙏

@lbroudoux lbroudoux added this to the 1.16.0 milestone Oct 22, 2026
@lbroudoux
lbroudoux merged commit 0e0c0b4 into microcks:master Oct 22, 2026
4 of 5 checks passed
@github-actions

Copy link
Copy Markdown

🎉 @aryarathoree

You are now a Microcks community contributor! 💖

Thanks and congrats 🚀 on merging your first pull request! We are delighted and very proud of you! 👏

📢 If you're using Microcks in your organization, please add your company name to this list. 🙏 It really helps the project to gain momentum and credibility. It's a small contribution back to the project with a big impact.

If you need to know why and how to add yourself to the list, please read the blog post "Join the Microcks Adopters list and Empower the vibrant open source Community 🙌"

Kudos and please keep going, we need you 🙌

@aryarathoree

Copy link
Copy Markdown
Contributor Author

Thanks @lbroudoux ! Glad to contribute.

@aryarathoree
aryarathoree deleted the fix/expression-parser-brace-bounds branch October 30, 2026 19:55
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.

ExpressionParser: prevent StringIndexOutOfBoundsException on single "{" expression

2 participants