Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot update event org #744

Open
csirt-pj opened this issue May 17, 2021 · 7 comments
Open

Cannot update event org #744

csirt-pj opened this issue May 17, 2021 · 7 comments

Comments

@csirt-pj
Copy link

Hello
I try to update an event's org (not orgc):

event = misp.get_event(519, pythonify=False)
event['Event']['Org']['uuid']='5dfb7cb3-19c0-421e-a120-768ebca539c9'
event['Event']['Org']['name']="REDACTED"
event['Event']['Org']['id'] = '11'
event['Event']['org_id'] = '11'
misp.update_event(event, 519)

But all I get is:

{'errors': (403,
  {'saved': False,
   'name': 'Could not edit Event',
   'message': 'Could not edit Event',
   'url': '/events/edit/519',
   'errors': 'Event could not be saved: Event in the request not newer than the local copy.'})}
@Rafiot
Copy link
Member

Rafiot commented May 17, 2021

So two things there:

  1. the timestamp isn't changed if you modify the json manually so you have to delete the timestamp key from the dict before you push it. Alternatively, use PyMISP and it will be taken care of when needed.
  2. the parameters you're changing are ignored on MISP side because they're all set by the platform itself.

@csirt-pj
Copy link
Author

arf, so I cannot change them ?
I need to recreate the event with a different org ?
we have some org issues, people not being able to modify events they should.

@Rafiot
Copy link
Member

Rafiot commented May 17, 2021

You can change the Orgc (creator org), but not the org:

from pymisp import MISPOrganisation
orgc = MISPOrganisation()
orgc.name = 'bazbaz'
orgc.id = 15
orgc.uuid = '5888a98d-a7e8-4183-94bb-4d19950d210f'
# NOTE: Pushing this object will only work if the user has sync right (if not, the orgc key will be ignored)
event.Orgc = orgc

print(event.to_json())

That should still do the trick for allowing edits. But it should only be used if you have no other way to do it.

@csirt-pj
Copy link
Author

It seems MISPi s not accepting it:

from pymisp import MISPOrganisation
orgc = MISPOrganisation()
orgc.name = 'babar'
orgc.id = 11
orgc.uuid = '5dfb7cb3-19c0-421e-a120-768ebca539c9'
event = misp.get_event(519, pythonify=True)
# NOTE: Pushing this object will only work if the user has sync right (if not, the orgc key will be ignored)
event.Orgc = orgc
event.timestamp=''
result = misp.update_event(event, pythonify=True)
result.orgc.name

Anyway, I think I will duplicate/recreate events, it may be simpler.
Thanks !

@Rafiot
Copy link
Member

Rafiot commented May 18, 2021

The user needs to be sync or admin. And what was the response from MISP?
Creating duplicate events will cause issues if you want to share the events in the future.

@csirt-pj
Copy link
Author

Actually nothing: it answers the same event in dict format with orgc unchanged.

@Rafiot
Copy link
Member

Rafiot commented Jun 1, 2021

Right, that thing was definitely working int he past, but as I never implemented a test case, we didn't caught the regression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants