harmony-one / pump.fun.backend

1 stars 3 forks source link

User profile update unintended username collision #4

Closed polymorpher closed 1 week ago

polymorpher commented 1 week ago

In https://github.com/harmony-one/pump.fun.backend/blob/ab2b9d998192af015d2ab2f520e9711f93f0e645/src/user/user.controller.ts#L187, username is checked indiscriminately. A validation should be performed first, and skip checking / just using current username, if none is provided

ArtemKolodko commented 1 week ago

username validations is performed in UpdateUserDto

Link to line in code: https://github.com/harmony-one/pump.fun.backend/blob/67c3234b6ab810faf79de51315b76b31415930c9/src/dto/user.dto.ts#L30

Checking for string type, min and max length If validation failed, error will be thrown before entering method in UserController

More about validations: https://docs.nestjs.com/techniques/validation

polymorpher commented 1 week ago

Okay