Skip to:
Content

bbPress.org

Opened 6 years ago

Last modified 8 months 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 5 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 (11)

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


5 years ago

#2 @Otto42
5 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.


5 years ago

@Otto42
5 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
5 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
4 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.


4 years ago

This ticket was mentioned in Slack in #bbpress by stephdau. View the logs.


8 months ago

#8 @johnjamesjacoby
8 months ago

In 7126:

Akismet: add support for request headers.

This commit stops discarding the header information coming back from Akismet, and instead allows it to be filtered as needed.

In trunk, for 2.7.

Props Otto42.

See #2853.

#9 @johnjamesjacoby
8 months ago

In 7127:

Akismet: add support for request headers.

This commit stops discarding the header information coming back from Akismet, and instead allows it to be filtered as needed.

In branches/2.6, for 2.6.6.

Props Otto42.

See #2853.

#10 @stephdau
8 months ago

Happy dance (re: commit)!

Note: See TracTickets for help on using tickets.