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

I use add_attribute but i have a error in this func. #983

Open
yilmazdincer opened this issue May 2, 2023 · 3 comments
Open

I use add_attribute but i have a error in this func. #983

yilmazdincer opened this issue May 2, 2023 · 3 comments

Comments

@yilmazdincer
Copy link

line 779, in add_attribute
if ('errors' in new_attribute and new_attribute['errors'][0] == 403
KeyError: 0

@yilmazdincer
Copy link
Author

I add attributes in multiple using add_attribute (I give a list to value) and I get the error I show above. I show the reason for this below.

Something went wrong (403): {'saved': False, 'name': 'Could not add Attribute', 'message': 'Could not add Attribute', 'url': '/attributes/add', 'errors': {'attribute_0': {'value': ['A similar attribute already exists for this event.']}, 'attribute_1': {'value': ['A similar attribute already exists for this event.']}, 'attribute_2': {'value': ['A similar attribute already exists for this event.']}, 'attribute_3': {'value': ['A similar attribute already exists for this event.']}}}

@github-germ
Copy link

github-germ commented May 2, 2023

Do you have duplicate attributes in your list? If so, you might want to check out this on https://www.misp-project.org/2023/04/13/MISP.2.4.170.released.html/ which was requested in MISP/MISP#5257

Fixes

  • Add support for a breakOnDuplicate named parameter on /attributes/add endpoint, default value is true which keeps the current behavior of throwing an error when the user tries to add duplicate attribute to an event. When set to false the endpoint will work as an upsert, updating the attributes timestamp and any other properties provided in the payload, no error logs will be written.

@yilmazdincer
Copy link
Author

TY!

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