Skip to content

When updating the user password, the password is stored in not hashed #2029

@LoicMahieu

Description

@LoicMahieu
Step to reproduce:
  • Create a sample app slc loopback
  • Expose User model with public: true
  • Create a new user: POST /Users { "password": "foo", "email": "foo@bar.com" }
  • Try to authenticate with password foo
  • It success
  • Update the user with new password: PUT /Users/1 { "password": "bar" }
  • Try to authenticate with password bar
  • It fails
Diagnostic:

It seems that the setter results (see UserModel.setter.password) is not used as "data" for the connector, see: DataAccessObject.prototype.updateAttributes . So I think that setter results is never saved in db.

It is really critic because it causes the User model not usable.

Versions:
├─┬ loopback@2.26.2
│ ├── loopback-connector-remote@1.0.3
│ ├── loopback-phase@1.3.0
│ └── strong-remoting@2.25.0
├── loopback-boot@2.16.0
├── loopback-component-explorer@2.3.0
├── loopback-connector-mysql@2.2.0
└── loopback-datasource-juggler@2.45.0

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions