Skip to content

Commit

Permalink
fixed name injection
Browse files Browse the repository at this point in the history
  • Loading branch information
gnehs committed Jun 16, 2024
1 parent e617ed6 commit f1ba814
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion components/stepstep.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ bot.command("stepstep", async ({ reply, message }) => {
rank.forEach((item, index) => {
let distance = item.distance.toFixed(2);
let steps = item.steps.toLocaleString();
responseText += `<code>${index + 1}. </code>${item.user.name}\n`;
let name = item.user.name
.replaceAll("<", "&lt;")
.replaceAll(">", "&gt;")
.replaceAll("&", "&amp;");

responseText += `<code>${index + 1}. </code>${name}\n`;
responseText += `<code> ${distance} 公里 - ${steps} 步</code>\n`;
});

Expand Down

0 comments on commit f1ba814

Please sign in to comment.