Skip to:
Content

Opened 4 years ago

Last modified 2 years ago

#2853 new defect

Add Akismet "X-akismet-pro-tip" support

Reported by: netweb Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Extend - Akismet Keywords: needs-patch
Cc:

Description

Via #BuddyPress6594

See the "spam response example" on http://akismet.com/development/api/#comment-check and http://blog.akismet.com/2014/04/23/theres-a-ninja-in-your-akismet/

TL;DR: If the X-akismet-pro-tip header is set to discard, then Akismet has determined that the comment is blatant spam, and you can safely discard it without saving it in any spam queue.

Attachments (1)

2853.diff (1.4 KB) - added by Otto42 2 years ago.
First draft for a patch. Saves the header data, eliminates the useless do_action_ref_array call and replaces with a filter, adds post data to the spam check action

Download all attachments as: .zip

Change History (7)

This ticket was mentioned in Slack in #forums by netweb. View the logs.


2 years ago

#2 @Otto42
2 years ago

Part of the problem making this difficult is that the Akismet code in bbPress is silently discarding the header information coming from Akismet.

https://bbpress.trac.wordpress.org/browser/trunk/src/includes/extend/akismet.php#L429

The header information we want is in $response[0], which is not saved.

Additionally, the action hooks in this code are, well, kind of bizarre.

https://bbpress.trac.wordpress.org/browser/trunk/src/includes/extend/akismet.php#L193

I can think of no sane reason to call do_action_ref_array() here, while passing it the $post_data array. The post data will not be in array form and also will be in a random order. It can't really be manipulated at all this way. This needs to be a do_action, not a do_action_ref_array. As it stands, this filter is currently unusable.

If these were done correctly, then either a separate plugin or a simple check of the headers could set the post_status to "trash" before the post was inserted.

Header check would likely go here:
https://bbpress.trac.wordpress.org/browser/trunk/src/includes/extend/akismet.php#L196

Alternatively, if one wanted to wipe the post out entirely, before it ever saved to the database, then bbPress would need an alteration in these two places:

https://bbpress.trac.wordpress.org/browser/trunk/src/includes/topics/functions.php#L341
https://bbpress.trac.wordpress.org/browser/trunk/src/includes/replies/functions.php#L393

To allow something like a "false" coming back from this filter to bail and skip the wp_insert_post() call entirely.

This ticket was mentioned in Slack in #forums by netweb. View the logs.


2 years ago

@Otto42
2 years ago

First draft for a patch. Saves the header data, eliminates the useless do_action_ref_array call and replaces with a filter, adds post data to the spam check action

#4 @Otto42
2 years ago

First draft for a patch. Saves the header data, eliminates the useless do_action_ref_array call and replaces with a filter, adds post data to the spam check action. This would make it possible for another plugin to get the headers from the akismet call and take some kind of action based on them.

#5 @Kenshino
2 years ago

Hey @Otto42 @netweb,

Can we get some focus on this? Akismet is doing nothing for all the University Spam that we are getting at W.org and it seems we're simply using most of our time to handle that nowadays.

I can only imagine how hard they're spamming other bbPress sites.

This ticket was mentioned in Slack in #forums by macmanx. View the logs.


2 years ago

Note: See TracTickets for help on using tickets.