mozilla / scanjs

[DEPRECATED] Static analysis tool for javascript code.
Other
429 stars 38 forks source link

[testing][false positive] - variable named same as object #72

Closed pwnetrationguru closed 10 years ago

pwnetrationguru commented 10 years ago

A lot of our rules flag variables named the same as the object as dangerous, when the shouldn't.

Currently, we have the following failing test cases:

     CustomEvent -> good.CustomEvent = "CustomEvent";
     addEventListener -> var addEventListener = "variable with name";
     addIdleObserver -> addIdleObserver = "static string";
     addIdleObserver -> something.addIdleObserver = "static string";
     escapeHTML -> var escapeHTML = "just a string";
     localStorage -> var localStorage = "asdf";
     message -> var message = "static string";
     MozActivity -> var MozActivity = "static MozActivity";
     MozChromeEvent -> var mozChromeEvent = "string mozChromeEvent";
     mozPermissionSettings -> var mozPermissionSettings = "just a string, not mozPermissionSettings";
     mozPower ->  var mozPower = "just a string, window.navigator.mozPower;";
     mozSettings -> var mozSettings = "window.navigator.mozSettings;";
     mozSms -> var mozSms = "window.navigator.mozSms;";
     somethingNotNavigator.mozWifiManager;

The following rules need be updated:

mozfreddyb commented 10 years ago

this appears to be resolved