parse-server
parse-server copied to clipboard
log the field that was the added during validatingPermission
New Feature / Enhancement Checklist
- [x] I am not disclosing a vulnerability.
- [x] I am not just asking a question.
- [x] I have searched through existing issues.
Current Limitation
Currently, when there's a newly added field to an object, we validate for permission if it can be added
if (newKeys.length > 0) {
// adds a marker that new field is being adding during update
runOptions.addsField = true;
const action = runOptions.action;
return schema.validatePermission(className, aclGroup, 'addField', action);
}
validatePermission
can throw an error depending on whether the field can be added or not.
Actual Error :- ParseError: Permission denied for action addField on class _User.
I think would be better to log the newly added field if in case validatePermission
throws error
Feature / Enhancement Description
Log the newly added field if the validation fields, as it provides better information on what went wrong.
Expected Error :- ParseError: Permission denied for action addField on class -User.
Thanks for opening this issue!
- 🎉 We are excited about your ideas for improvement!
@mtrezza any suggestions here? I can pick it up if required
Sure, if I understand that feature request correctly, the field name should be added to an existing error log.
Sure, if I understand that feature request correctly, the field name should be added to an existing error log.
Yes that's correct
I am thinking about what would be the best way to do it, validatePermisison
is a generic function that validates and throws error. one way would be to add adittional data to the static method validatePermission. other way would be to add a try catch handler on the top, mutate the error message and rethrow. @mtrezza what do you think