-
-
Notifications
You must be signed in to change notification settings - Fork 254
Delete ssh keys shouldn't be a POST & Cleanup routes #1934
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
Conversation
📝 WalkthroughWalkthroughRoute groupings were restructured (API keys and network allocations moved under nested prefixes) and the SSH key deletion endpoint was changed from POST with a fingerprint in the request body to DELETE with the fingerprint in the URL; the SSHKeyController method signature was updated accordingly and tests adjusted. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API
participant SSHController
participant DB
Note over Client,SSHController: SSH key deletion (new flow)
Client->>API: DELETE /api/client/account/ssh-keys/{fingerprint}
API->>SSHController: route -> delete(Request, fingerprint)
SSHController->>DB: find key where fingerprint = {fingerprint}
alt key found
SSHController->>SSHController: log activity (fingerprint)
SSHController->>DB: delete (soft-delete)
SSHController-->>API: 204 No Content
API-->>Client: 204 No Content
else key not found
DB-->>SSHController: not found -> firstOrFail() throws
SSHController-->>API: 404 Not Found
API-->>Client: 404 Not Found
end
Pre-merge checks✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used🧬 Code graph analysis (2)app/Http/Controllers/Api/Client/SSHKeyController.php (4)
tests/Integration/Api/Client/SSHKeyControllerTest.php (1)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
routes/api-client.php (1)
36-40: Critical: Route parameter doesn't match controller signature.The route defines
/{identifier}as a URL parameter, but theSSHKeyController::delete()method doesn't accept this parameter. The controller signature is:public function delete(ClientApiRequest $request): JsonResponseIt should be updated to match the pattern used in
ApiKeyController::delete():public function delete(ClientApiRequest $request, string $identifier): JsonResponseAdditionally, the controller still validates and reads the fingerprint from the request body (
$request->input('fingerprint')) instead of using the route parameter. This needs to be updated to use the$identifierparameter from the URL.See the detailed fix in the review comment for
tests/Integration/Api/Client/SSHKeyControllerTest.phplines 43-56.
🧹 Nitpick comments (1)
routes/api-client.php (1)
96-102: LGTM: Network allocations routes reorganization.The flattening of nested route groups into a single
/network/allocationsprefix is a good refactor. The final endpoint URLs remain unchanged, and this improves readability.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
routes/api-client.php(2 hunks)tests/Integration/Api/Client/SSHKeyControllerTest.php(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
routes/api-client.php (2)
app/Http/Controllers/Api/Client/ApiKeyController.php (1)
ApiKeyController(13-81)app/Http/Controllers/Api/Client/SSHKeyController.php (1)
SSHKeyController(12-78)
🔇 Additional comments (1)
routes/api-client.php (1)
30-34: LGTM: API keys routes properly grouped.The reorganization under the
/api-keysprefix is correct and consistent with the controller implementation. TheApiKeyController::delete()properly accepts the$identifierroute parameter.
BREAKING API CHANGE
POST client/account/ssh-keys/remove (fingerprint body) => DELETE client/account/ssh-keys/{fingerprint}