Skip to content

Commit fe0d544

Browse files
Potential fix for code scanning alert no. 6: Exception text reinterpreted as HTML
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent ecf3d6a commit fe0d544

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

server/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"discord.js": "^14.14.1",
1717
"dotenv": "^16.4.5",
1818
"express": "^4.18.3",
19-
"node-fetch": "^2.7.0"
19+
"node-fetch": "^2.7.0",
20+
"he": "^1.2.0"
2021
},
2122
"devDependencies": {
2223
"nodemon": "^3.1.0"

server/src/AuthServer.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const express = require('express');
22
const fetch = require('node-fetch');
33
const cors = require('cors');
4+
const he = require('he');
45

56
class AuthServer {
67
constructor(discordBot) {
@@ -93,7 +94,7 @@ class AuthServer {
9394
const errorData = Buffer.from(JSON.stringify({ error: message })).toString('base64');
9495
return res.redirect(`${clientRedirectUri}?error=${errorData}`);
9596
} else {
96-
return res.status(400).send(`Authentication error: ${message}. Please close this window and try again.`);
97+
return res.status(400).send(`Authentication error: ${he.encode(message)}. Please close this window and try again.`);
9798
}
9899
};
99100

0 commit comments

Comments
 (0)