Skip to content

Commit

Permalink
Fix a panic with invalid sharing
Browse files Browse the repository at this point in the history
When calling the admin route
/instances/:domain/sharings/:id/unxor/:doc-id for a sharing where the
XorID is missing in the credential, we should return an error instead of
a panic.
  • Loading branch information
nono committed Jan 20, 2025
1 parent 20a58fd commit 4275ac8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion web/instances/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ func unxorID(c echo.Context) error {
err := errors.New("it only works on a recipient's instance")
return jsonapi.BadRequest(err)
}
if len(s.Credentials) != 1 {
if len(s.Credentials) != 1 || len(s.Credentials[0].XorKey) == 0 {
err := errors.New("unexpected credentials")
return jsonapi.BadRequest(err)
}
Expand Down

0 comments on commit 4275ac8

Please sign in to comment.