Segmentation Fault
Analyzing the core
  • Home
  • About

addParser.py

addons Add comments

Synopsis :
python addonParser.py extension.xpi

Description :
A simple python script that lexically analysis Firefox extensions, trying to find any problems. Outputs any problems to the terminal.

Requires :
Python Image Library

Notes :
Writes any .jar files into the $PWD/temp/ directory.

Breakdown of output :
examing chrome/ (13)
examing chrome/content/ (13)
examing chrome/content/botOFF.png (13)
examing chrome/content/botON.png (13)
examing chrome/content/dowint.css (13)
examing chrome/content/dowint.js (13)
examing chrome/content/dowint.xul (13)
        WARNING: http://dowint.net/inc/js.php does not start with chrome:// and not a local file for file chrome/content/dowint.xul (5)
examing chrome/content/logo.gif (13)
        WARNING: Image chrome/content/logo.gif does not match it's extension. Expected GIF, got PNG (2)
examing chrome.manifest (13)
examing install.rdf (13)

Numbers in parentheses at the end of line are just for debugging use only.
Text in square parentheses is often the source of the problem (used when evaluating javascript files)

Types :
Warning – something is wrong or possibly needs some examining
Error – I don’t know how to evaluate this (eg. files that I wasn’t expecting, or files that I don’t know how to properly evaluate)

Quirks (some people call this bugs) :

  1. Sometimes it gives you information, but not enough context:
    WARNING: found XMLHttpRequest [var req = new XMLHttpRequest();] in file content/hrtoolbar.js (9)
  2. Sometimes the output is extremely long because the js file was minified:
    WARNING: found XMLHttpRequest [var CC=Components.classes;var CI=Components.interfaces;var … ]
  3. False positives can be quite common :
    WARNING: found reference to outside source [@namespace url(”http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul”);] in file skin/webwean.css. (8)
    (This is common false positive in CSS files. Though it has found a problem once)

Undecided Issues :

  • What to do about .dtd and .properties (should anything be done for these files?)
  • Should XHR throw up a warning? It’s fairly common, and we’re really just worried about eval.

Checks and Errors :

Error Problem
1 Image file is not an image file
2 Image file extension does not match its type
3 XUL file is invalid XML
4 Inline JS
5 The src for a script tag was not a chrome:// url nor a local file
6 Invalid keyboard shortcuts (Macs require alt + another modifier)
7 iframe content type is not content
8 CSS file has an outside reference
9 XHR found
10 Javascript eval keyword found :p
11 Javascript loadSubscript found
12 Javascript new Function()
13 Log message
14 RCS directory found. Could be sensitive to the author.
15 A binary component has been found

File :
Currently available here. Will upload repository later.

Please be advised that this tool is extremely stupid, and not a substitute for careful reviews :)

Tags: editor, tip


November 17th, 2008 |

Tags: editor, tip


Leave a Reply

  • Pages

    • About
  • Recent Posts

    • NSILHNFHDwxyz
    • deprecate this
    • Cross browser tidbits
    • A lot has changed in 4 years
    • addParser.py
  • Tags

    browser compatibility bug chrome editor extension fennec google chrome html5 ie intern jquery json konqueror lazy mozilla nsid opera personal prism python ria safari security seneca shaving sleep svg tinderbox tip toronto Web wildon
  • Archives

    • January 2009
    • November 2008
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
  • Blogroll

    • Andrew Smith
    • Anthony Hughes
    • Michael Mullin
  • Links

    • My Gallery
    • My Repository
RSS XHTML CSS Log in
Copyright © 2009 Segmentation Fault All Rights Reserved
Wp Theme by i Software Reviews
Proudly Powered by Wordpress