Repository navigation
Conversation
Objects like Contributte\Translation\Wrappers\Message were dropped from the output. They now go through the translator like plain strings, as in Nette's DefaultFormRenderer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012jmXrhsCDpW1PebtBnDxhy
Stringable descriptions such as translation messages may carry user input in their parameters, so render them with setText() like Nette's DefaultFormRenderer does. Plain strings keep the raw HTML behaviour and an empty result renders no description element. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012jmXrhsCDpW1PebtBnDxhy
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #136 +/- ##
============================================
+ Coverage 97.54% 97.64% +0.09%
- Complexity 340 344 +4
============================================
Files 25 25
Lines 1019 1019
============================================
+ Hits 994 995 +1
+ Misses 25 24 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
Closes #48.
BootstrapRenderer::renderDescription()translated a description only when it was a plain string. Any other value that was notHtml, for example aContributte\Translation\Wrappers\Messageor anotherStringable, became'', so the description disappeared without an error. Group labels had the same problem. The same code works in Nette'sDefaultFormRenderer, as the reporter says.Changes
src/BootstrapRenderer.php,renderDescription():HtmlStringable(includingHtml) → rendered raw, as trusted HTML (the same as Nette).string→ unchanged:setHtml($control->translate(...)), kept for BC.Stringable→setText($control->translate(...)), which escapes it. If the translator returns anHtmlStringable, it stays raw, like in Nette.<small>).Stringablelabel is now translated and rendered, escaped withsetText()as before, instead of being dropped.tests/Rendering/VerticalTest.php,tests/Rendering/GroupRenderingTest.php, new fixturetests/data/vertical/text_description_translated.html):<b>and of a translated user parameter such as<img onerror>;HtmlStringable;Security note
The first version of this change sent Stringable descriptions to
setHtml()without escaping. The independent review found that this was an XSS path: a translationMessagewith a user-supplied parameter rendered as raw HTML. This is fixed in the second commit, and tests cover it. The reviewer checked the fix again with an XSS script and approved.Test evidence
--prefer-lowest.src, the description and group-label tests fail (the output has no<small class="form-text text-muted">);src, the 3 escaping/empty tests fail.Reviewer notes
setHtml(), so they are not escaped. Nette escapes them. Some users may use HTML in string descriptions. A change here should be a separate issue.🤖 Generated with Claude Code
https://claude.ai/code/session_012jmXrhsCDpW1PebtBnDxhy