Skip to content

Commit e79dab7

Browse files
committed
fix(map-server): escape backslashes before pipes in markdown export
Fixes CodeQL js/incomplete-sanitization: input backslash could break pipe escaping in description column.
1 parent 3f8d40a commit e79dab7

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

examples/map-server/src/mcp-app.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,6 +1607,7 @@ function annotationsToMarkdown(annotations: TrackedAnnotation[]): string {
16071607
for (let i = 0; i < annotations.length; i++) {
16081608
const d = annotations[i].def;
16091609
const desc = (d.description || "")
1610+
.replace(/\\/g, "\\\\")
16101611
.replace(/\|/g, "\\|")
16111612
.replace(/\n/g, "<br>");
16121613
const base = `| ${i + 1} | ${d.type} | ${d.id} | ${d.label || ""} | ${annDetails(d)} | ${d.color || (d.type === "marker" ? "red" : "blue")} |`;

0 commit comments

Comments
 (0)