Skip to content

Commit 849f201

Browse files
Potential fix for code scanning alert no. 29: Log injection
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent bcebba2 commit 849f201

File tree

1 file changed

+2
-1
lines changed
  • other/ton-telegram-example/server/api

1 file changed

+2
-1
lines changed

other/ton-telegram-example/server/api/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ app.get("/test", (req, res) => {
6767
app.post("/auth/telegram", async (req, res) => {
6868
const { initDataRaw, isMocked, photoUrl } = req.body; // Extract photoUrl from request body
6969

70-
console.log("Received initDataRaw:", initDataRaw);
70+
const sanitizedInitDataRaw = initDataRaw ? initDataRaw.replace(/\n|\r/g, "") : initDataRaw;
71+
console.log("Received initDataRaw (sanitized):", sanitizedInitDataRaw);
7172
console.log("isMocked:", isMocked);
7273
const sanitizedPhotoUrl = photoUrl ? photoUrl.replace(/\n|\r/g, "") : photoUrl;
7374
console.log("photoUrl (sanitized):", sanitizedPhotoUrl); // Log the sanitized photoUrl for debugging

0 commit comments

Comments
 (0)