-
Notifications
You must be signed in to change notification settings - Fork 24
fix(kas): Fix kas panics on bad requests #2916
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
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
|
|
/gemini review |
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.
Pull Request Overview
This PR adds defensive nil-checking and error handling to prevent panics in the KAS rewrap service when processing malformed requests. The changes ensure that nil requests, policies, and key access objects are handled gracefully with appropriate error responses instead of causing service crashes.
Key Changes:
- Added comprehensive nil checks for requests, policies, and key access objects
- Updated
tdf3RewrapandnanoTDFRewrapfunctions to return errors instead of silently failing - Added validation for empty wrapped keys and unsupported key types
- Improved error handling in the
Rewrapmain handler
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| service/kas/access/rewrap.go | Added nil checks, error handling, and validation for requests, policies, and key access objects; updated function signatures to propagate errors |
| service/kas/access/rewrap_test.go | Added comprehensive test coverage for nil request handling in verifyRewrapRequests and verifyNanoRewrapRequests functions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Code Review
This pull request significantly improves the robustness of the Key Access Service by adding numerous checks to prevent panics on malformed requests. The changes are well-implemented and include comprehensive unit tests for the new error handling paths. My review includes a few suggestions to further refine the error handling logic for consistency and clarity, particularly regarding the return values on error paths in batch processing.
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
|
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
|
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
|
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
|
Proposed Changes
Checklist
Testing Instructions