fix: fence sandbox creates after api key deletion#574
Conversation
Signed-off-by: Jayant <212013719+Jayant-kernel@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #574 +/- ##
==========================================
+ Coverage 79.78% 79.84% +0.06%
==========================================
Files 202 203 +1
Lines 14688 14734 +46
==========================================
+ Hits 11719 11765 +46
Misses 2544 2544
Partials 425 425
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:
|
Signed-off-by: Jayant <212013719+Jayant-kernel@users.noreply.github.com>
|
@AiRanthem |
Ⅰ. Describe what this PR does
This PR prevents sandbox create requests from leaving resources owned by an API key that has just been deleted.
The change adds a short-lived deleted API-key fence in the E2B controller. When an API key is deleted, its ID is recorded in the fence.
CreateSandboxchecks that fence before creating a sandbox and checks it again after claim/clone returns. If the key is deleted while creation is in flight, the newly created sandbox is cleaned up and the request returns unauthorized instead of leaving an inaccessible sandbox behind.The tests cover:
Ⅱ. Does this pull request fix one issue?
Fixes #570
Ⅲ. Describe how to verify it
gofmton the changed Go filesgit diff --checkThe focused Go test command could not be run locally because the local Go executable is blocked by the machine's application-control policy. The added tests are intended to run in repository CI:
Ⅳ. Special notes for reviews
The fence is intentionally bounded in memory. It closes the local race window around deletion and late create completion without changing persistent API-key storage semantics.