find always executed for updateAttributes, even if the ACL not allowing to access the updateAttributs remotemethod
setup the find logic as:
module.exports = function(Product) {
Product.on('dataSourceAttached', function(obj) {
var find = Product.find;
Product.find = function(filter, option, callback) {
console.log('find executed');
find.call(this, filter, option, callback);
}
});
};
The ACL: "acls": [ { "accessType": "*", "principalType": "ROLE", "principalId": "$everyone", "permission": "DENY" } ],
Try to put to /api/Products/anyid, and I can see the log: find executed. Would it be a security issue?
Hello @zkuang, thank you for reporting the issue. AFAIK, when you call invoke prototype.updateAttributes via REST API, we are calling find with a filter { where: { id: <id> } } to find the instance you would like to update. I don't see why it would be a security issue, but I may be wrong. Could you please elaborate little bit more on what is your thinking?
I'm not sure if this matters that much. The concern is this gives an unauthorized user the privilege to execute code that's not granted to him since the find method is not permitted to be executed for that user. At least, he would know some Product ID doesn't exist if he gets back a 404.
Hey @zkuang, I'm closing this issue in favor of strongloop/strong-remoting#311 as the fix must be made in that repository.
Thanks for contributing!
@bajtos regarding strongloop/loopback#2220 it is an information leak, where model ids can be iterated to check for model existence. this might be necessary information for further attack.
Thanks @michaelfreund . I'll follow up.