fix(reports): grow the markdown fence past backticks in the message - #1306
Merged
Conversation
The failure message is fenced unescaped because a fence renders its contents literally -- true only while the fence is longer than any run of backticks inside it. A hook printing a bare fence closed the block early: the text after it rendered as prose and the trailing fence opened a new, unterminated one, swallowing every later section of a report that is appended to $GITHUB_STEP_SUMMARY. CommonMark closes a fence only with one at least as long, so the opener grows past the longest run present. Fork-free and terminating: the message is finite, and testing containment rather than equality finds the longest run, since a message holding four backticks contains three too. The diffed case survived by luck -- assert_same wraps changed lines as [-...-], which is not a bare delimiter. Undiffed messages (hook and source failures) reach the report intact. Closes #1305
…njection # Conflicts: # CHANGELOG.md
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.
🤔 Background
Related #1305
--report-mdfences each failure message unescaped, because a fence renders its contents literally — true only while the fence is longer than any run of backticks inside it. A hook printing a bare fence closed the block early, so the text after it rendered as prose and the trailing fence opened a new, unterminated one. Every later section of the report was swallowed.That report is auto-appended to
$GITHUB_STEP_SUMMARY, so it corrupts the Actions job summary — the page the report exists to be read on.💡 Changes
🔍 Notes
The diff-rendered case survived by luck —
assert_samewraps changed lines as[-...-], which is not a bare delimiter. Undiffed messages (hook failures, source failures) reach the report intact, which is why this showed up in a hook fixture.HTML was swept at the same time and is clean:
<script>is escaped and there are no stray ampersands. The Markdown summary table has no message column, so no|injection either.