Render Javadoc descriptions safely and ignore block tags#1258
Merged
Conversation
pratushnyi
reviewed
Apr 1, 2026
...criptions-javadoc/src/main/java/io/qameta/allure/description/JavaDocDescriptionRenderer.java
Outdated
Show resolved
Hide resolved
pratushnyi
reviewed
Apr 1, 2026
...criptions-javadoc/src/main/java/io/qameta/allure/description/JavaDocDescriptionRenderer.java
Show resolved
Hide resolved
pratushnyi
reviewed
Apr 1, 2026
...criptions-javadoc/src/main/java/io/qameta/allure/description/JavaDocDescriptionRenderer.java
Show resolved
Hide resolved
pratushnyi
approved these changes
Apr 1, 2026
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.
Context
This fixes #1039 by changing how
@Description(useJavaDoc = true)is resolved. Instead of taking raw Javadoc text and treating it like HTML, we now render the main Javadoc body into safe plain text / markdown and stop at block tags such as@param,@return,@throws,@see,@since,@version, and friends. In practice, that means Javadoc descriptions stay useful in the report, but they no longer leak metadata sections or create an XSS surface throughdescriptionHtml.The new renderer supports the parts of Javadoc people actually use in descriptions:
{@code},{@literal},{@link},{@linkplain}, paragraphs, line breaks, lists, code spans, entities, and Unicode text. Unsupported or malformed constructs are intentionally degraded to safe text instead of being interpreted as markup. Javadoc-backed descriptions now go todescription, notdescriptionHtml, while explicit HTML descriptions remain unchanged. Theallure.description.javadoc.separateLinesoption is still supported and now uses markdown-friendly line breaks.I also added broader regression coverage around the processor and adapters, including negative cases, malformed HTML, Unicode, multiline inline tags, unsupported standard tags, and a more realistic modern Javadoc example. The current runtime coverage is in place for JUnit 4, JUnit Platform, and TestNG, and the renderer itself now has focused unit tests so future changes are easier to review.
Example:
Now the report description contains only the useful body content, rendered safely, and does not include the
@throwssection or raw HTML.Checklist