Conversation
PR SummaryMedium Risk Overview Reviewed by Cursor Bugbot for commit f6e3a1f. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
|
||
| return fmt.Errorf("%s", strings.Join(msgs, "; ")) | ||
| }, | ||
| MultiErrorHandler: sharedauth.MultiErrorHandler, |
There was a problem hiding this comment.
Behavioral regression: the previous handler joined all errors from openapi3.MultiError; this replacement only processes me[0] and returns errors prefixed with SecurityErrPrefix for security failures. Unlike packages/api, the dashboard-api error handler does not strip these prefixes. Auth/security validation failures would now expose the raw internal error string in API responses.
|
|
||
| return fmt.Errorf("%s", strings.Join(msgs, "; ")) | ||
| }, | ||
| MultiErrorHandler: sharedauth.MultiErrorHandler, |
There was a problem hiding this comment.
Behavioral regression: the previous handler joined all errors from openapi3.MultiError; this replacement only processes me[0] and returns errors prefixed with SecurityErrPrefix for security failures.
Unlike packages/api, the dashboard-api error handler does not strip these prefixes (there is no equivalent to the api ErrorHandler that calls strings.CutPrefix on auth.SecurityErrPrefix). Auth/security validation failures would now expose the raw internal string "error in openapi3filter.SecurityRequirementsError: security requirements failed: ..." in API responses.
| func processCustomErrors(e *openapi3filter.SecurityRequirementsError) error { | ||
| // Return only one security requirement error (there may be multiple securitySchemes) | ||
| unwrapped := e.Errors | ||
| err := unwrapped[0] |
There was a problem hiding this comment.
Potential panic: unwrapped[0] is accessed without a bounds check. This risk already existed in packages/api, but it is now also reachable from dashboard-api, which previously used a simple join handler that never hit this code path. If a SecurityRequirementsError is ever produced with an empty Errors slice this will panic.
No description provided.