Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

fix: check username in signup

Steven606a30640db3
diff --git a/server/route/api/v2/auth_service.go b/server/route/api/v2/auth_service.go
index ef4b139ff..dd1959e57 100644
--- a/server/route/api/v2/auth_service.go
+++ b/server/route/api/v2/auth_service.go
@@ -189,6 +189,9 @@ func (s *APIV2Service) SignUp(ctx context.Context, request *apiv2pb.SignUpReques
Nickname: request.Username,
PasswordHash: string(passwordHash),
}
+ if !util.ResourceNameMatcher.MatchString(strings.ToLower(create.Username)) {
+ return nil, status.Errorf(codes.InvalidArgument, "invalid username: %s", create.Username)
+ }
hostUserType := store.RoleHost
existedHostUsers, err := s.Store.ListUsers(ctx, &store.FindUser{