El Rancho San Benito Community Resource Website
San Benito County Community Resource Website

--Paul McNett, Earthling
Home
XML

Revert Trac Spam Comments and Ticket Changes - Jul 12, 2007 14:14
Trac is an excellent issue tracker and wiki used by many open source projects
for efficient collaboration. We use it in our Dabo project, to keep track of
open issues, provide a place for people to browse our source code, and the 
like.

One of the nicest features is the simplicity of it all, including the ticket
submission process. You don't need to log in to submit a new ticket or to 
comment on an existing one. 

However, that openness is also a vulnerability, and spammers are starting to
experiment with posting crap comments in our Trac instances. I don't really 
want to lock down the submission of tickets to only authenticated users,
because that just doesn't jive with my worldview that the Internet should be
open, loving, and caring. :)  Not to mention efficient and non-annoying.

So, I tweaked the spam filters a bit. But more importantly, I wrote a little
utility to help weed out changes that should never have been applied. I call
the tool trac_revert_ticket_changes.py. You put it in your filesystem alonside
your Trac instances, and then issue commands like:

  # Review changes within last 10 days:
  trac_revert_ticket_changes.py -n 10 dabo

  # Review explicit tickets:
  trac_revert_ticket_changes.py dabo 1002 1004

For each ticket in the set, the most recent change will be shown, and you'll
be asked if you want to revert the change. Answer no, and we'll move on to the
next ticket. Answer yes, and the change will be reverted, and you'll get to 
choose to revert the next most recent change.

I was able to remove about 30 spammed ticket changes within just a few minutes
with this tool, and figured others may benefit from it, too.

Download from here:
http://paulmcnett.com/pkm_software/trac_revert_ticket_changes.py
Enjoy!
  

© 2007 Paul McNett       [/Computing/Python] permanent link

Feel free to link to a story by using the 'permanent link' feature. Please do not reprint a substantial part of a story without permission. Please make sure to have some fun every day, because time keeps on ticking away.