Skip to content

Commit

Permalink
Core/routes/ParkDev/parking/server: sanitization
Browse files Browse the repository at this point in the history
  • Loading branch information
No3Mc committed Mar 3, 2024
1 parent 46034f5 commit 0b73c93
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Core/routes/ParkDev/parking/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@
app.get('/book', async (req, res) => {
const { carno, name, email, no, markerId } = req.query;

// Validate markerId to ensure it's a valid ObjectId
if (!ObjectId.isValid(markerId)) {
return res.status(400).send('Invalid markerId');
}

try {
const client = await MongoClient.connect(uri, { useNewUrlParser: true });
const markersCollection = client.db("Parking").collection("marker");
Expand Down Expand Up @@ -171,7 +176,7 @@
console.error(err);
res.status(500).send(`We are facing an unexpected error ⚠️ ${err.message}`);
}
});
});



Expand Down

0 comments on commit 0b73c93

Please sign in to comment.