fix: filter client get/delete by client_id client-side - #34
Conversation
GET /realms/{realm}/clients ignores the clientId query filter and
always returns the full list, so get_client kept whatever the server
happened to return first — usually not the requested client. client
delete resolved its target the same way, making the mismatch
destructive: 'client delete zukquote-realm' could delete an unrelated
client instead.
Filter the list client-side by client_id, error when nothing matches,
and move delete's confirmation prompt after resolution so it names the
client actually about to be deleted.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe CLI now performs exact client ID matching from the full realm client list. Client deletion uses the resolved client UUID and ID for lookup, confirmation, deletion, and success output. ChangesClient resolution
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: 🔵 Low · up to Client lookup and deletion now target the exact requested client and show the resolved identity before deletion. The change is mergeable with owner awareness that correctness still depends on the backend returning a complete, uniquely identifiable client list. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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 |
Bug
client getandclient deleteacted on the wrong client:GET /realms/{realm}/clientsignores theclientIdquery filter and always returns the full list, soget_clientkept the first element regardless of what was asked for.delete_clientresolves its target UUID through the same call, making the mismatch destructive — e.g.client delete zukquote-realmcould deletesecurity-admin-consoleinstead.Fix
get_clientnow fetches the full client list and matchesclient_idclient-side, instead of trusting the (ignored) server-side filter. Still errors withClientNotFoundwhen nothing matches.delete_client's confirmation prompt now runs after resolving the client, and names the resolvedclient_id+ uuid — so what's shown is what gets deleted, not just what was typed.Issue
Closes #20.
Verification
Reproduced live against a local FerrisKey server: created two throwaway clients (
smoke-client-a,smoke-client-b) in a realm wheresecurity-admin-consolesorts first — confirmedclient get smoke-client-bused to matter (would have returnedsecurity-admin-consolebefore the fix, per the bug report's exact mechanism). After the fix:client get smoke-client-breturns the right client,client delete smoke-client-b --forcedeletes only that one,security-admin-console/smoke-client-a/others untouched. Cleaned up both test fixtures afterward.Test plan
cargo build --workspacecargo test --workspace(68 passed)cargo clippy --workspace --all-targets --all-features -- -D warningsSummary by CodeRabbit