Skip to content

Commit b21ff8d

Browse files
authored
Merge pull request #4 from freifunkMUC/alert-autofix-1
Potential fix for code scanning alert no. 1: Type confusion through parameter tampering
2 parents 33c0c20 + 5f75f9c commit b21ff8d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,12 @@ router.get("/mail/config-v1.1.xml", async (ctx) => {
105105
router.get("/email.mobileconfig", async (ctx) => {
106106
let email = ctx.request.query.email;
107107

108-
if (!email) {
108+
// Ensure email is a single string value, not an array, to avoid type confusion issues
109+
if (Array.isArray(email)) {
110+
email = email[0] || "";
111+
}
112+
113+
if (!email || typeof email !== "string") {
109114
ctx.status = 400;
110115
return;
111116
}

0 commit comments

Comments
 (0)