5 ms·
Having thought about what you meant... Even with namespacing you still have a global object that can be maliciously overridden or modified
by ruethewhirled 15y ago
Having thought about what you meant...
Even with namespacing you still have a global object that can be maliciously overridden or modified
- knieveltech 15y agoIf an attacker is in a position to make malicious modifications 1) You've got a larger problem than optional language features on your hand and 2) locking down a few properties (or the entire object) isn't going to save you.
- ruethewhirled 15y agoFrom your example below: think of one of those ad network scripts (or any other 3rd party script you include on your page) you have no control over what that code is doing. It could override any of your global objects
- knieveltech 15y agoThis is accurate regardless of language features. You can't control 3rd party code. Using generic object names greatly increases the odds that at some point you're going to run into a namespace collision and something important will be overwritten. Proper object namespacing your objects vastly decreases the odds of this happening with benign 3rd party scripts, no additional language features required.