github(summary): escape HTML when printing build error

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2024-06-20 11:20:16 +02:00
parent c330895cef
commit e0007fb5cd
3 changed files with 23 additions and 2 deletions

View File

@@ -16,6 +16,7 @@
import crypto from 'crypto';
import fs from 'fs';
import he from 'he';
import jsyaml from 'js-yaml';
import os from 'os';
import path from 'path';
@@ -284,7 +285,7 @@ export class GitHub {
// prettier-ignore
sum
.addRaw(`<details><summary><strong>Error</strong></summary>`)
.addCodeBlock(buildError, 'text')
.addCodeBlock(he.encode(buildError), 'text')
.addRaw(`</details>`);
} else {
// prettier-ignore
@@ -292,7 +293,7 @@ export class GitHub {
.addRaw(`<strong>Error</strong>`)
.addBreak()
.addRaw(`<p>`)
.addCodeBlock(buildError, 'text')
.addCodeBlock(he.encode(buildError), 'text')
.addRaw(`</p>`);
}
sum.addRaw(`</blockquote>`);