Repository navigation
apiserver: accept a bouncer whose auto-created row a concurrent request inserted - #4775
Conversation
|
@somaz94: There are no 'kind' label on this PR. You need a 'kind' label to generate the release automatically.
DetailsI am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository. |
|
@somaz94: There are no area labels on this PR. You can add as many areas as you see fit.
DetailsI am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository. |
|
/kind fix |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4775 +/- ##
==========================================
+ Coverage 72.23% 72.25% +0.01%
==========================================
Files 549 549
Lines 37607 37615 +8
==========================================
+ Hits 27166 27178 +12
+ Misses 10440 10436 -4
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Hi @blotus, gentle ping on this one when you have time. It is ready for review, and the description notes the two jobs that fail the same way on master. |
What and why
When bouncers share one API key and the first two requests from a new IP arrive at the same time, both miss
SelectBouncerWithIPand both try to create thename@iprow. The loser got a unique constraint error fromCreateBouncer, andauthPlainanswered 403 for a valid key;authTLShad the same pattern.CreateBouncernow returns a typedBouncerExistsErroron that error, with the same message socscli bouncers addoutput does not change, and both paths re-read the row the other request just created and authenticate against it. A row with that name but another key, or an API key row on the TLS path, is still rejected.Fixes #4774
How it was tested
I read the diff line by line. Claude Code ran the checks below while I watched, and I checked their output.
TestAPIKeyMiddlewareAutoCreatedBounceruses an ent hook to insert the row right before the middleware creates it, on the API key and the TLS path, plus the two cases that must still be rejected. On master the two concurrent cases fail withbouncer test@4.3.2.1 already existsand a 403; with this change all six pass.The Windows
Build + testsjob (TestStreamingAcquisitionMTLStimeout inpkg/acquisition/modules/http) andhub / Functional tests(socket path too long) fail the same way on master.Checklist
cscli -o json|rawoutput.AI assistance used: mostly