Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
if (!integration.site) {
log.error(
"akismet integration was enabled but the site configuration was missing"
);
return;
}
// If the comment doesn't have a body, it can't be spam!
if (!comment.body) {
return;
}
// Create the Akismet client.
const client = new Client({
key: integration.key,
blog: integration.site,
});
// Grab the properties we need.
const userIP = req.ip;
if (!userIP) {
log.debug("request did not contain ip address, aborting spam check");
return;
}
const userAgent = req.get("User-Agent");
if (!userAgent || userAgent.length === 0) {
log.debug("request did not contain User-Agent header, aborting spam check");
return;
}