-
Notifications
You must be signed in to change notification settings - Fork 20
Surface DID resolution errors in VP verification failures #3979
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: reinkrul <1481228+reinkrul@users.noreply.github.com>
Co-authored-by: reinkrul <1481228+reinkrul@users.noreply.github.com>
|
Coverage Impact This PR will not change total coverage. Modified Files with Diff Coverage (2)
🛟 Help
|
auth/api/iam/openid4vp.go
Outdated
| // Check error messages directly since ErrDeactivated and ErrNoActiveController both implement deactivatedError | ||
| if strings.Contains(errMsg, "no active controllers") { | ||
| return "presentation(s) or contained credential(s) are invalid: DID document has no active controllers" | ||
| } |
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.
this is a legacy did:nuts error message, you can remove this case
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.
Removed in a9b37f2
auth/api/iam/openid4vp.go
Outdated
| if strings.Contains(errMsg, "deactivated") { | ||
| return "presentation(s) or contained credential(s) are invalid: DID document has been deactivated" | ||
| } |
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.
this is a legacy did:nuts error message, you can remove this case
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.
Removed in a9b37f2
| // verificationErrorDescription returns a more specific error description when DID resolution fails, | ||
| // otherwise returns the generic error message. This improves user experience by providing actionable | ||
| // error information for common DID resolution issues while maintaining security for other errors. | ||
| func verificationErrorDescription(err error) string { |
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.
instead of making a new error message, just use
"presentation(s) or contained credential(s) are invalid: " + err.Error()
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.
Updated in a9b37f2 to use err.Error() directly
- Remove legacy did:nuts error checks (deactivated, no active controllers) - Simplify to just append err.Error() for DID resolution errors - Update tests to match simplified implementation Co-authored-by: reinkrul <1481228+reinkrul@users.noreply.github.com>

Plan: Improve Client Error Message for DID Resolution Failures
Summary of Changes
Problem: Currently, when the server can't resolve a DID document during VP verification, it returns a generic error: "presentation(s) or contained credential(s) are invalid". This makes troubleshooting difficult for clients.
Solution Implemented:
Created
verificationErrorDescription()helper (auth/api/iam/openid4vp.go):errors.Is()and string pattern matchingUpdated error handling in two locations:
auth/api/iam/openid4vp.go- OpenID4VP HandleAuthorizeResponse flowauth/api/iam/s2s_vptoken.go- Service-to-service VP token verification flowAdded comprehensive tests (
auth/api/iam/openid4vp_test.go):New Error Messages:
Review Feedback Addressed:
err.Error()directly instead of custom messagesTesting Results:
Security Considerations:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.