Code RoomWebhook signature verification timing
MediumPrep Room Coding #1784

Webhook signature verification timing

Code reviewAlgorithms & data structuresMid–Senior~20 min

Review this JavaScript webhook receiver.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.

0:00 of about 20 min
Mark a line and say what kind of problem it is.0 findings
1app.post('/webhook/stripe', express.json(), (req, res) => {
2 const sig = req.headers['stripe-signature'];
3 const event = req.body;
4 if (verifySig(JSON.stringify(req.body), sig)) {
5 handle(event);
6 return res.sendStatus(200);
7 }
8 res.sendStatus(400);
9});
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.