openclarity / apiclarity

An API security tool to capture and analyze API traffic, test API endpoints, reconstruct Open API specification, and identify API security risks. 
https://apiclarity.io
Apache License 2.0
501 stars 64 forks source link

event_annotations batch insert fails #285

Open xudj14 opened 1 year ago

xudj14 commented 1 year ago

What happened:

CreateAPIEventAnnotations sometimes fails due to unique constraint violation.

On event_annotations, there's a unique key api_event_ann_idx_model on (module_name, event_id, name). When trying to insert multiple rows this constraint could be violated, and the whole insert operation fails.

What you expected to happen:

Deduplication before trying to batch insert?

How to reproduce it (as minimally and precisely as possible):

Not sure so far. But the problem seems clear.

Are there any error messages in API Clarity logs?

(e.g. kubectl logs -n apiclarity --selector=app=apiclarity) image

Thanks in advance!

FrimIdan commented 1 year ago

@klyr can you take a look?

klyr commented 1 year ago

Hi @xudj14,

Thank you for the report.

We'll be working on it. My first guess is that we may remove the constraint.