-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PersistedModel.updateAll() ignores validation #771
Comments
Yes thats seems a bug to me; the validation is not implemented for updateAll/ update |
Any updates on the issue? |
@dmitru IIRC |
This is still not implemented? Also, updateAttributes the same? |
Would like to note that this is a very serious issue, this makes it very easy to corrupt instances through the API. These instances will then fail to validate when they are partially updated with a different set of properties than the one(s) that were corrupted. It's even worse with NoSQL backends: I strongly suspect this issue prevents strict mode from being enforced with updateAll, and adding random properties outside of the model spec would prevent instances from ever being instance-updateable again (due to #759). I would even consider this a security issue since it allows users to sabotage app features for other users. |
This is really a consistency problem that will actually allow a malicious user to overcome the developer assertions about its data. Is there any update on this? |
@kjdelisle @strongloop/sq-lb-apex PTAL ☝️ |
The issue should be fixed on the upcoming version of juggler. Thank you for your patience! |
Hello, I think the solution landed via #771 is a breaking change, see #1445 (comment), and we should rework it to preserve backwards compatibility, before the new version of juggler is released. |
Essentially, we need to run a partial validation that will validate only properties affected by I am going to lock this issue down, in order to move the discussion to loopbackio/loopback-next#1872. |
I have this model:
If I create a new entry with a three character name, I get, as expected, a validation error. However if I create a new entry with a longer name and then update that name to three characters, there is no validation error and the change is written to the DB.
As far as I can tell the whole validation is not triggered when
updateAll()
is used.Steps to reproduce:
node .
server/boot/foo.js
.The text was updated successfully, but these errors were encountered: