fix: Prevent context attributes from influencing judge template parsing (SEC-8020)#361
Merged
Conversation
jsonbailey
approved these changes
Apr 9, 2026
jsonbailey
reviewed
Apr 9, 2026
Co-authored-by: Jason Bailey <jbailey@launchdarkly.com>
jsonbailey
pushed a commit
that referenced
this pull request
May 12, 2026
🤖 I have created a release *beep* *boop* --- ## [0.9.0](ldai/v0.8.1...ldai/v0.9.0) (2026-05-11) ### ⚠ BREAKING CHANGES * Tracker no longer returned alongside AI Configs, use Config.CreateTracker() instead * Add per-execution runId, at-most-once tracking, and cross-process tracker resumption ([#363](#363)) ### Features * Add per-execution runId, at-most-once tracking, and cross-process tracker resumption ([#363](#363)) ([c11294f](c11294f)) * Rename TrackUsage to TrackTokens ([#364](#364)) ([9b0863a](9b0863a)) * Tracker no longer returned alongside AI Configs, use Config.CreateTracker() instead ([c11294f](c11294f)) ### Bug Fixes * Prevent context attributes from influencing judge template parsing (SEC-8020) ([#361](#361)) ([a14fc86](a14fc86)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low code risk since this PR only bumps version metadata and changelog entries, but it publishes a new `ldai` release that includes documented breaking changes for consumers. > > **Overview** > Bumps the `ldai` package release from `0.8.1` to `0.9.0` by updating the release manifest and `ldai` version constant. > > Updates `ldai/CHANGELOG.md` with the `0.9.0` release notes, including **breaking changes** around tracker creation/return behavior plus new tracking semantics and a `TrackUsage`→`TrackTokens` rename, and a judge template parsing fix. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 7582350. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.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.
Requirements
Related issues
Provide links to any issues in this repository or elsewhere relating to this pull request.
Describe the solution you've provided
Provide a clear and concise description of what you expect to happen.
Describe alternatives you've considered
Provide a clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context about the pull request here.
Note
Medium Risk
Changes judge message rendering logic to avoid Mustache parsing on user-controlled content, which can affect evaluation prompts and is security-adjacent. Risk is limited to judge prompt construction but could change output text in edge cases.
Overview
Prevents user-controlled context attributes containing Mustache control sequences from affecting judge prompt construction by replacing the pass-2 Mustache render with literal placeholder string substitution in
Judge.buildMessages.Centralizes the reserved judge placeholders (
{{message_history}},{{response_to_evaluate}}) as shared constants inldaiand updatesJudgeConfigto inject those constants. Adds regression tests covering Mustache injection variants, multiple placeholder occurrences, and preserving Mustache-like syntax in history/response text.Reviewed by Cursor Bugbot for commit 1793aa5. Bugbot is set up for automated code reviews on this repo. Configure here.