Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Aaron Powell
2026-06-12 12:20:13 +10:00
committed by GitHub
parent 78762a53a8
commit 71f771df51
+8 -3
View File
@@ -270,15 +270,20 @@ function toMarkdownReport(findings, scannedFiles, skippedFiles) {
: finding.severity === severityLevels.medium
? "🟠"
: "️";
const match = finding.match
const matchText = finding.match
.replace(/\\/g, "\\\\")
.replace(/`/g, "\\`")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/\|/g, "\\|")
.replace(/@/g, "@\u200b");
const backtickRuns = matchText.match(/`+/g);
const fenceLength = backtickRuns
? Math.max(...backtickRuns.map((run) => run.length)) + 1
: 1;
const fence = "`".repeat(fenceLength);
const match = `${fence}${matchText}${fence}`;
summary.push(
`| ${severity} | \`${finding.rule_id}\` | \`${finding.file}\` | ${finding.line} | \`${match}\` |`
`| ${severity} | \`${finding.rule_id}\` | \`${finding.file}\` | ${finding.line} | ${match} |`
);
}