Proposal: Revert bot for restoring the OSM Israel map

The vandalism against the OSM map in Israel does not seem to go away. We could expect it lo last for weeks if not more, similar to the on-going vandalism that still takes place in Ukraine.

To be able to recover from such attack in a systemic repeatable approach I would like to propose an algorithm for a revert bot.

This proposal is inspired by the recent reverts performed by @SomeoneElse and @woodpeck.
Thank you !!!

Feedback and comments are highly appreciated.

The problem:

Malicious accounts perform massive random modifications in the OSM data:

  • Moving nodes
  • Deleting and modifying tags
  • Performing the above multiple times in different changesets
  • Deleting elements
  • Adding new elements (I didn’t see such activity in the recent attacks)

The proposal

Create a bot that will revert all edits performed by a set of blocked malicious accounts.

The bot will be used to define a “revert version” for modified and deleted elements which would be the newer of:

  • The version created by a known revert account, if any.
  • The version just before the earliest un-reverted edit by a malicious accounts.


  • List of blockedmalicious accounts”.
  • List of known “revert accounts


  1. Determine a “earliest time” of the run by the minimal “created_at” tag of all changesets created by the malicious accounts
  2. Create the list of elements included in the changesets of the malicious accounts
  3. For each modified or deleted such element, determine the “revert version” by scanning the element’s versions from new to old
    1. Set the revert version to “unnecessary”
    2. If an edit was done by a malicious user, set the revert version to the previous version and continue with it
    3. If the version timestamp is before the earliest time or this version was created by a revert account , store the revert version found earlier and move to the next element.
    4. continue to the next version
  4. Restore modified and deleted elements to their revert version, unless it is unnecessary: nodes, then ways, and then relations
  5. Delete elements added by the malicious accounts, if still exist: relations, then ways, and then nodes


11 posts - 4 participants

Read full topic

Ce sujet de discussion accompagne la publication sur