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.
Inputs
- List of blocked “malicious accounts”.
- List of known “revert accounts”
Algorithm
- Determine a “earliest time” of the run by the minimal “created_at” tag of all changesets created by the malicious accounts
- Create the list of elements included in the changesets of the malicious accounts
- For each modified or deleted such element, determine the “revert version” by scanning the element’s versions from new to old
- Set the revert version to “unnecessary”
- If an edit was done by a malicious user, set the revert version to the previous version and continue with it
- 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.
- continue to the next version
- Restore modified and deleted elements to their revert version, unless it is unnecessary: nodes, then ways, and then relations
- Delete elements added by the malicious accounts, if still exist: relations, then ways, and then nodes
Notes
- Restoring nodes enables restoring ways and restoring also the ways allows the restoring of relations
- Deleting added relations allows deletions of ways and deleting also the ways allows the deletion of nodes.
- The order of restoring and deleting relations of relations should addressed
- The revert bot should be run by dedicated revert account, so it can be included in the list of known revert accounts
- Edits, including attempted reverts, done by other accounts, after a malicious edit will also be reverted
11 posts - 4 participants
Ce sujet de discussion accompagne la publication sur https://community.openstreetmap.org/t/proposal-revert-bot-for-restoring-the-osm-israel-map/105317