PyMISP icon indicating copy to clipboard operation
PyMISP copied to clipboard

Adding a local tag to an event updates its last change timestamp

Open dragsu opened this issue 2 years ago • 8 comments

PyMISP Version 2.4.155.1

Issue I was trying to add a local tag to an event using misp.update_event call and it also updated the last change timestamp.

Expected outcome:

  • Changes to any local tags should not update the last change timestamp

dragsu avatar Nov 15 '22 00:11 dragsu

It looks like the server rejects the request if timestamp is not updated :(.

Have set the __force_timestamps = True and resubmit the request and received,

Event could not be saved. Event in the request not newer than the local copy.

Do we have plans to implement an update_event_tag method that hits the MISP /events/addTag endpoint?

dragsu avatar Nov 15 '22 05:11 dragsu

@Rafiot I would like to push a fix for this. Can you please add me as a contributor to the project?

dragsu avatar Nov 17 '22 00:11 dragsu

You can always do a pull request if you want to contribute to the project.

Have you tried this method: https://github.com/MISP/PyMISP/blob/main/pymisp/api.py#L3443 ? It should do all you need and can be used of attributes or events.

I'll play with it to make sure the timestamp isn't updated but if it is, it is a bug we'll fix.

Rafiot avatar Nov 17 '22 08:11 Rafiot

Yep, confirmed, you can use the tagmethod and if you pass local=True it won't update the timestamp.

Rafiot avatar Nov 17 '22 08:11 Rafiot

I just tested it too. It is working. Couldn't find that endpoint documented in https://www.misp-project.org/openapi

dragsu avatar Nov 17 '22 08:11 dragsu

Let's add @righel in the loop for that last point.

Rafiot avatar Nov 17 '22 08:11 Rafiot

@Rafiot When I try to push a branch remote: Permission to MISP/PyMISP.git denied to dragsu.

dragsu avatar Nov 17 '22 09:11 dragsu

yes, you need to make a fork, push to your own repository and then make a pull request

Rafiot avatar Nov 17 '22 09:11 Rafiot