-
Notifications
You must be signed in to change notification settings - Fork 122
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
Should we allow custom populate params? #311
Comments
In fact, caller can change return from {
"fields": "user.username", // only return username on user populate
} but if {
populate: [{
populate: "user",
fields: ["username", "name"]
}, "another-old-style-populate"]
} will amazing :D |
I planned it sometimes about it in the past but always dropped the idea because it can leak sensitive data if the user can change the returned fields. E.g. you have a posts service that has a populated field "author". The author's email address is sensitive data, so posts listing action must not access this field. So it can work only if there is an "allowed populate fields" which contains all available fields and the caller can't add fields which is not allowed. |
Please check my code |
Is this bug? Rule does not have populate , if user want to populate, he must put it in params.populate
Document https://moleculer.services/docs/0.14/moleculer-db.html#Populating |
Hi @icebob,
Currently, how
populate
receive & send params, is predefined onsettings.populates
, I wonder if we can make it more flexible. Instead ofpopulate: string[]
, we can accept populate as object likeExample: I only need populate
user.get
with fieldname
but sometime need fieldusername
The text was updated successfully, but these errors were encountered: