Skip to content
This repository was archived by the owner on Jun 18, 2026. It is now read-only.

Commit 9d54235

Browse files
security: fix XSS in NetworkFlowExporter — escape node labels in JS output (CWE-79)
NetworkFlowExporter.export() injected node labels directly into JavaScript string literals without escaping. A node label containing single quotes or script-breaking characters (e.g. '); alert(1);//) would break out of the JS string and execute arbitrary code when the exported HTML file is opened in a browser. Replace unescaped string interpolation with ExportUtils.jsonString() which properly escapes backslashes, quotes, newlines, and control characters, and uses double-quoted JSON strings instead of single-quoted JS literals.
1 parent 87c92e6 commit 9d54235

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Gvisual/src/gvisual/NetworkFlowExporter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public void export(String filePath) throws IOException {
116116
for (int i = 0; i < nodes.size(); i++) {
117117
FlowNode nd = nodes.get(i);
118118
if (i > 0) nodesJson.append(",");
119-
nodesJson.append(String.format("{id:%d,x:%.0f,y:%.0f,label:'%s'}", i, nd.x, nd.y, nd.label));
119+
nodesJson.append(String.format("{id:%d,x:%.0f,y:%.0f,label:%s}", i, nd.x, nd.y, ExportUtils.jsonString(nd.label)));
120120
}
121121
nodesJson.append("]");
122122

0 commit comments

Comments
 (0)