Skip to content

Commit ece2c53

Browse files
committed
Fix HTML Injection in build output
1 parent 4480818 commit ece2c53

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

22
using System.Reflection;
33

4-
[assembly: AssemblyVersionAttribute("1.0.69.427")]
4+
[assembly: AssemblyVersionAttribute("1.0.69.456")]
55

BuildService/websocket.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@
228228
let text = await e.data.text()
229229
let split = text.split('\n')
230230
split[1] = JSON.stringify(JSON.parse(split[1]), null, '\t')
231-
writeToScreen(`<div><pre><h3>response</h3><code>${split.join('\n')}</code></pre></div>`);
231+
writeToScreen(`<div><pre><h3>response</h3><code>${split.join('\n').replace(/</g, "&lt;").replace(/>/g, "&gt;")}</code></pre></div>`);
232232

233233
let data = JSON.parse(split[1])
234234

@@ -269,7 +269,7 @@
269269
}
270270

271271
if (data.content != null && data.content.length > 0)
272-
parentElement.innerHTML += `<pre><code timestamp="${data.timestamp}" outputType="${data.outputType}">${data.content}</code></pre>\n`
272+
parentElement.innerHTML += `<pre><code timestamp="${data.timestamp}" outputType="${data.outputType}">${data.content.replace(/</g, "&lt;").replace(/>/g, "&gt;")}</code></pre>\n`
273273
break;
274274
case 'BuildService.Shared.Build.BuildInstanceStatus':
275275
if (data.Status == enumBuildStatus.Done && targetDictionary[data.Signature].CurrentBuildStatus != data.Status)

0 commit comments

Comments
 (0)