-
Notifications
You must be signed in to change notification settings - Fork 24
chore(core): Log kas URI on key index requests #2710
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
This is helpful for figuring out if the index is misconfigured
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Standard Benchmark Metrics Skipped or FailedBulk 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.
Code Review
This pull request improves the debuggability of key index requests by logging the KAS URI when a key cannot be found. This is achieved by implementing the fmt.Stringer interface for KeyIndexer and updating the error formatting in DelegatingKeyService. The changes are well-implemented and achieve the stated goal. I have one minor suggestion to improve the consistency of the new error messages.
| keyDetails, err := d.index.FindKeyByID(ctx, keyID) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("unable to find key by ID '%s': %w", keyID, err) | ||
| return nil, fmt.Errorf("unable to find key by ID '%s' within index %s: %w", keyID, d.index, err) |
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.
For consistency with the error message in DeriveKey on line 107, consider using in index instead of within index. This makes the error messages uniform, which is helpful for logging and monitoring.
| return nil, fmt.Errorf("unable to find key by ID '%s' within index %s: %w", keyID, d.index, err) | |
| return nil, fmt.Errorf("unable to find key by ID '%s' in index %s: %w", keyID, d.index, err) |
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 enhances error logging by including the KAS URI in key lookup error messages to aid in debugging index misconfigurations.
- Added a
String()method toKeyIndexerto format index information for logging - Updated error messages in
DecryptandDeriveKeymethods to include index details
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| service/kas/key_indexer.go | Implements String() method returning formatted KAS URI for logging |
| service/trust/delegating_key_service.go | Updates error messages to include index information using %s formatter |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Proposed Changes
Checklist
Testing Instructions