Error code 403 over remote event update using only local tags
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 491
- Forks
- 290
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 3
Description
Context
What: I enrich external organisation events using local tags to ensure that my semantic is not beeing propagated
Why: Those tags are used to pivot on if the IOC should enter a blacklist or not.
Code
How:
time_window: datetime = oldest_unriched_event_date + timedelta(days = 2)
results = self.misp_instance.search(
controller = "events",
date_from = oldest_unriched_event_date.strftime("%F"),
date_to = time_window.strftime("%F"),
include_correlations = False,
event_tags = ['!blacklist_tag'],
org = self.sekoia_uuid,
deleted = "0",
pythonify = True,
metadata = True,
)
# Events tagging
misp_event: MISPEvent
for counter_ev, misp_event in enumerate(results):
for tag in [My perfect tag list]:
misp_event.add_tag(name = tag, local = True)
misp_instance.update_event(misp_event)
Sadly I've been using a site admin user to do this stuff while POCing so yeah.. I was able to pretty free in term of perms.
This leads me to using a more appropriated role wich was sync user, thinking that local tags wouldn't be a bother since it was described as "The long awaited feature “local tags” is now finally available. You can create tags locally if you are a member of the given MISP instance’s host organisation, enabling “in-place” tagging for synchronisation and export filtering"
Alas when running the script I get thoses:
ERROR: Something went wrong (403): {'saved': False, 'name': 'Could not edit Event', 'message': 'Could not edit Event', 'url': '/events/edit/9085', 'errors': 'Event could not be saved: The user used to edit the event is not authorised to do so. This can be caused by the user not being of the same organisation as the original creator of the event whilst also not being a site administrator.', 'id': '9085'}
Event 9085 "as is":
With local tags added on GUI:
There is probably something i've missed while considering local tags: if this is an issue of not beeing in the same organisation why can I add those tags on the same event as a same role user from another organisation on GUI ?
Sorry for the delayed issue by the way I tried to bruteforce my way beforehand to not waste your time if this was just a perm issue..
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the shown search, add_tag, and update_event flow and reproduce it with a sync user on an event from another organisation. Compare the API request and response with the GUI operation, then inspect the relevant MISP REST API authorization behavior. Done means the local-tag update behavior and its permission requirements are confirmed and the issue is fixed or clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, authorization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100