Parse Ethernet Frame HTML formatting fix (#2402)

This commit is contained in:
GCHQ Developer 85297
2026-05-18 11:54:13 +01:00
committed by GitHub
parent 1baef27e9b
commit 7ca4b3a13d
2 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -92,7 +92,7 @@ class ParseEthernetFrame extends Operation {
const packetData = input.slice(offset);
if (outputFormat === "Packet data") {
return Utils.byteArrayToChars(packetData);
return Utils.escapeHtml(Utils.byteArrayToChars(packetData));
} else if (outputFormat === "Packet data (hex)") {
return toHex(packetData);
} else if (outputFormat === "Text output") {
@@ -41,5 +41,16 @@ TestRegister.addTests([
"args": ["Hex", "Text output"]
}
]
},
{
name: "Parse Ethernet frame escapes packet data HTML",
input: "000000000000ffffffffffff08003c696d67207372633d78206f6e6572726f723d616c6572742831293e3c7363726970743e616c6572742832293c2f7363726970743e",
expectedOutput: "<img src=x onerror=alert(1)><script>alert(2)</script>",
recipeConfig: [
{
"op": "Parse Ethernet frame",
"args": ["Hex", "Packet data"]
}
]
}
]);