-
Notifications
You must be signed in to change notification settings - Fork 242
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
Using new Function
violates common security practice
#91
Comments
If you're under CSP restrictions, don't use the |
@photonstorm any reason you decided to fork the library instead of just overriding the methods above? I think switching back to a direct dependency would be beneficial — you would get any potential bugfixes and performance improvements from upstream. function customRBush(maxEntries) {
var tree = rbush(maxEntries);
tree.compareMinX = compareMinX;
tree.compareMinY = compareMinY;
tree.toBBox = toBBox;
return tree;
}
function compareMinX(a, b) { return a.left - b.left; }
function compareMinY(a, b) { return a.top - b.top; }
function toBBox(a) {
return {
minX: a.left,
minY: a.top,
maxX: a.right,
maxY: a.bottom
};
} |
@mourner The main reason is because we needed a different way of requiring QuickSelect. You only release new versions once a year (if that) and they're generally really small updates, so it's trivial to manage from our end. If you were in a rapid development cycle then we'd do it differently, but I'm quite glad it's nice and stable and rarely changing. |
Note that RBush v3.0 eliminates eval and is fully CSP-compliant. See #93 |
This library uses
new Function
, which is equivalent to theeval
function. Under common sense security regimes, bothnew Function
andeval
are disallowed, including in the browser using CSP.The text was updated successfully, but these errors were encountered: