I have a Meteor application and we run many simple search queries and I was wondering if there's a way a hacker would be able to exploit them. And, what's the best way to ensure a clean input? We use a Meteor package called check
which throws an error if the provided argument isn't a String. But, lots of articles recommend mongo-sanitize
!
check(search, String);
Location.find(
{
$text: {
$search: search
}
});
To sum it up, A) Is check
enough? or Should it be replaced/coupled with mongo-sanitize
?
B) If it's vulnerable to such attacks, could you please provide a simple example? Thanks!