Skip to content

Commit cad0fbf

Browse files
committed
fix: guard checkHoneypot against undefined body (req.body before body parsers)
1 parent 36d8999 commit cad0fbf

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

services/security.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@ export function isKnownBotIp(ip) {
588588
}
589589

590590
export function checkHoneypot(body) {
591+
if (!body || typeof body !== 'object') return { triggered: false };
591592
const honeypotFields = ['website', 'url', 'homepage', 'message2', 'confirm_email', 'fax', 'phone2'];
592593
for (const field of honeypotFields) {
593594
if (body[field] !== undefined && body[field] !== '' && body[field] !== null) {

0 commit comments

Comments
 (0)