Fix orphaned tags and empty tables in PR comments - #322
Open
lelia wants to merge 1 commit into
Open
Conversation
A whitespace-only line closes a CommonMark HTML block. Optional sections that rendered as empty left one behind inside the alerts table, so the indented closing tags after it were rendered as a literal code block reading `</blockquote></details>` instead of markup. - Drop blank lines from generated comment markup and keep indentation below the four spaces that start a code block. - Collapse alert descriptions, suggestions and license findings onto a single line so multi-line API text cannot break the table either. - Replace the comment body with a short confirmation when no alerts are left to report, instead of keeping the caution banner above a table with no rows. The comment marker is preserved so the same comment is updated later. - Apply ignore-all to the pre-2.0.55 Markdown table format. The check was made once per ignore command and an ignore-all comment produces none, so no rows were removed. Bumps to 2.6.8.
Eric Hibbs (flowstate)
approved these changes
Aug 28, 2026
Eric Hibbs (flowstate)
left a comment
Contributor
There was a problem hiding this comment.
LGTM!
oh and we should add a lint:fix via ruff somewhere in our automation, main is carrying around like 75 formatting issues, nothing major
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
Security comments posted on pull requests could render orphaned
</blockquote></details>tags as a literal code block, and could leave the "Caution" banner sitting above an alerts table with no rows.A whitespace-only line closes a CommonMark HTML block. Optional sections that rendered as empty left one behind inside the alerts table, and because the closing tags after it are indented four or more spaces they were rendered as an indented code block rather than markup. The empty table appeared separately, when a comment's alerts were all resolved by a later commit or ignored by comment.
Changes
@SocketSecurity ignore-allnow applies to comments in the pre-2.0.55 Markdown table format. The check was made once per ignore command, and an ignore-all comment produces none, so no rows were removed.Bumps to 2.6.8.
Testing
tests/unit/test_pr_comment_rendering.pycovers both artifacts, the ignore round trips, and the collapsed body./markdownAPI to confirm the tags are gone; 417 unit and 87 core tests pass.Fixes CE-381
Note
Low Risk
Changes are limited to PR comment string generation and ignore reprocessing; no scan, auth, or API behavior changes. Risk is mainly cosmetic/regression in SCM comment display.
Overview
Fixes CE-381 by hardening how Socket security PR comments are generated and rewritten so GitHub/GitLab CommonMark renderers do not break the alerts table or leave a misleading Caution banner with no rows.
Comment markup now drops whitespace-only lines and caps indentation below four spaces (via
normalize_comment_html), and flattens multi-line alert titles, descriptions, suggestions, and license findings (inline_html_text) so embedded newlines cannot close the HTML block early—addressing the literal</blockquote></details>code-block artifact when ignore instructions were empty (--disable-ignore).When every alert is resolved on a later scan or removed via ignore comments, the body switches to a short no alerts confirmation while keeping
<!-- socket-security-comment-actions -->and the report link, so the same comment is updated instead of posting a second one.Ignore handling fixes
@SocketSecurity ignore-allfor legacy Markdown table comments (pre-2.0.55) by evaluatingignore_alloutside the per-command loop, and applies the same collapse + HTML normalization when processing updated HTML-table comments.Release 2.6.8 with regression tests in
tests/unit/test_pr_comment_rendering.py.Reviewed by Cursor Bugbot for commit c4f5c80. Configure here.