Permalink
Browse files

Initial naive pass at forking the validator

  • Loading branch information...
1 parent 289e398 commit ac8e0163f00ad1f989f4d08d59a6e8d51d5c6d2b @mattbasta mattbasta committed Aug 1, 2012
Showing with 13 additions and 656 deletions.
  1. +0 −3 .gitmodules
  2. +0 −2 MANIFEST.in
  3. +9 −130 README.rst
  4. 0 addon-validator → app-validator
  5. 0 {validator → appvalidator}/__init__.py
  6. 0 {validator → appvalidator}/app_versions.json
  7. 0 {validator → appvalidator}/chromemanifest.py
  8. 0 {validator → appvalidator}/compat.py
  9. 0 {validator → appvalidator}/constants.py
  10. 0 {validator → appvalidator}/contextgenerator.py
  11. 0 {validator → appvalidator}/decorator.py
  12. 0 {validator → appvalidator}/errorbundler.py
  13. 0 {validator → appvalidator}/loader.py
  14. 0 {validator → appvalidator}/main.py
  15. 0 {validator → appvalidator}/opensearch.py
  16. 0 {validator → appvalidator}/outputhandlers/__init__.py
  17. 0 {validator → appvalidator}/outputhandlers/shellcolors.py
  18. 0 {validator → appvalidator}/rdf.py
  19. 0 {validator → appvalidator}/specprocessor.py
  20. 0 {validator → appvalidator}/specs/__init__.py
  21. 0 {validator → appvalidator}/specs/webapps.py
  22. 0 {validator → appvalidator}/submain.py
  23. 0 {validator → appvalidator}/testcases/__init__.py
  24. 0 {validator → appvalidator}/testcases/chromemanifest.py
  25. 0 {validator → appvalidator}/testcases/conduit.py
  26. 0 {validator → appvalidator}/testcases/content.py
  27. 0 {validator → appvalidator}/testcases/hashes.txt
  28. 0 {validator → appvalidator}/testcases/installrdf.py
  29. 0 {validator → appvalidator}/testcases/javascript/__init__.py
  30. 0 {validator → appvalidator}/testcases/javascript/actions.py
  31. 0 {validator → appvalidator}/testcases/javascript/call_definitions.py
  32. 0 {validator → appvalidator}/testcases/javascript/entity_values.py
  33. 0 {validator → appvalidator}/testcases/javascript/instanceactions.py
  34. 0 {validator → appvalidator}/testcases/javascript/instanceproperties.py
  35. 0 {validator → appvalidator}/testcases/javascript/jstypes.py
  36. 0 {validator → appvalidator}/testcases/javascript/nodedefinitions.py
  37. 0 {validator → appvalidator}/testcases/javascript/predefinedentities.py
  38. 0 {validator → appvalidator}/testcases/javascript/spidermonkey.py
  39. 0 {validator → appvalidator}/testcases/javascript/traverser.py
  40. 0 {validator → appvalidator}/testcases/jetpack.py
  41. 0 {validator → appvalidator}/testcases/jetpack_data.txt
  42. 0 {validator → appvalidator}/testcases/l10n/__init__.py
  43. 0 {validator → appvalidator}/testcases/l10n/dtd.py
  44. 0 {validator → appvalidator}/testcases/l10n/properties.py
  45. 0 {validator → appvalidator}/testcases/l10ncompleteness.py
  46. 0 {validator → appvalidator}/testcases/langpack.py
  47. BIN {validator → appvalidator}/testcases/langpacks/fennec.xpi
  48. BIN {validator → appvalidator}/testcases/langpacks/firefox.xpi
  49. BIN {validator → appvalidator}/testcases/langpacks/mozilla.xpi
  50. BIN {validator → appvalidator}/testcases/langpacks/seamonkey.xpi
  51. BIN {validator → appvalidator}/testcases/langpacks/sunbird.xpi
  52. BIN {validator → appvalidator}/testcases/langpacks/thunderbird.xpi
  53. 0 {validator → appvalidator}/testcases/markup/__init__.py
  54. 0 {validator → appvalidator}/testcases/markup/csstester.py
  55. 0 {validator → appvalidator}/testcases/markup/markuptester.py
  56. 0 {validator → appvalidator}/testcases/packagelayout.py
  57. 0 {validator → appvalidator}/testcases/regex.py
  58. 0 {validator → appvalidator}/testcases/scripting.py
  59. 0 {validator → appvalidator}/testcases/targetapplication.py
  60. 0 {validator → appvalidator}/testcases/themes.py
  61. 0 {validator → appvalidator}/testcases/whitelist_hashes.txt
  62. 0 {validator → appvalidator}/textfilter.py
  63. 0 {validator → appvalidator}/typedetection.py
  64. 0 {validator → appvalidator}/unicodehelper.py
  65. 0 {validator → appvalidator}/validate.py
  66. 0 {validator → appvalidator}/version.py
  67. 0 {validator → appvalidator}/webapp.py
  68. 0 {validator → appvalidator}/xpi.py
  69. +0 −17 extras/build_whitelist.py
  70. +0 −42 extras/bundle.py
  71. +0 −305 extras/cover.py
  72. +0 −47 extras/unbundle.py
  73. +0 −72 extras/update_langpacks.py
  74. +0 −1 jetpack/addon-sdk
  75. +0 −25 jetpack/generate_jp_whitelist.sh
  76. +0 −6 jetpack/make_hash.py
  77. +0 −2 requirements.txt
  78. +4 −4 setup.py
View
@@ -1,3 +0,0 @@
-[submodule "jetpack/addon-sdk"]
- path = jetpack/addon-sdk
- url = git://github.com/mozilla/addon-sdk.git
View
@@ -1,4 +1,2 @@
include validator/testcases/hashes.txt
-include validator/app_versions.json
-include validator/testcases/jetpack_data.txt
include validator/testcases/whitelist_hashes.txt
View
@@ -1,10 +1,9 @@
-==============================
- addons.mozilla.org Validator
-==============================
+===================================
+ marketplace.mozilla.org Validator
+===================================
-The AMO Validator is a tool designed to scan Mozilla add-on packages for
-problems such as security vulnerabilities, exploits, spamware and badware,
-and lots of other gunk. By using a combination of various techniques and
+The Apps Validator is a tool designed to scan open web apps for
+problems and invalid code. By using a combination of various techniques and
detection mechanisms, the validator is capable of being both efficient as well
as thorough.
@@ -19,7 +18,6 @@ Python Libraries:
- argparse
- cssutils
-- rdflib
- fastchardet
Python Libraries for Testing:
@@ -86,12 +84,10 @@ your environment.
Run the validator as follows ::
- python addon-validator <path to xpi> [-t <expected type>] [-o <output type>] [-v] [--boring] [--selfhosted] [--determined]
+ python app-validator <path to app> [-o <output type>] [-v] [--boring] [--selfhosted] [--determined]
The path to the XPI should point to an XPI file.
--t The type that you expect your add-on to be detected as. The
- list of types is listed below.
-o The type of output to generate. Types are listed below.
-v Enable verbose mode. Extra information will be displayed in
verbose mode, namely notices (informational messages),
@@ -105,44 +101,6 @@ The path to the XPI should point to an XPI file.
tier has failed. Certain high-tiered tests may
inadvertently fail when this option is enabled for badly
malformed add-ons.
---target-appversion Accepts a JSON string containing an object whose keys
- are GUIDs and values are lists of version strings. In the
- targetApplication and compatibility tests, the add-on's
- predefined ``<em:targetApplication>`` values will be
- overridden if its GUIDs match thoes from the JSON. E.g.:
- ``{"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}": "5.*"}``
---for-appversions Accepts a JSON string containing an object whose keys are
- GUIDs and values are lists of version strings. If this
- list is specified, non-inlinecompatibility tests will only
- be run if they specifically target the applications and
- veresions in this parameter. E.g.:
- ``{"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}": ["6.*"]}``
-
-
-Expected Type:
-==============
-
-The expected type should be one of the following values:
-
-any (default)
- Accepts any extension
-extension
- Accepts only extensions
-theme
- Accepts only themes
-dictionary
- Accepts only dictionaries
-languagepack
- Accepts only language packs
-search
- Accepts only OpenSearch XML files (unpackaged)
-multi
- Accepts only multi-item XPI packages
-
-Specifying an expected type will throw an error if the validator
-does not detect that particular type when scanning. All addon type
-detection mechanisms are used to make this determination.
-
Output Type:
============
@@ -180,16 +138,11 @@ sample document below.
::
{
- "detected_type": "extension",
+ "detected_type": "packaged_app",
"errors": 2,
"warnings": 1,
"notices": 1,
"success": false,
- "compatibility_summary": {
- "errors": 1,
- "warnings": 0,
- "notices": 0
- },
"ending_tier": 4,
"message_tree": {
"module": {
@@ -223,26 +176,17 @@ sample document below.
"message": "This is the error message text.",
"description": ["Description of the error message.",
"Additional description text"],
- "file": ["chrome/foo.jar", "bar/zap.js"],
+ "file": "chrome/foo.bar",
"line": 12,
"column": 50,
"context: [
" if(foo = bar())",
" an_error_is_somewhere_on_this_line.prototy.eval("whatever");",
null
],
- "compatibility_type": "error",
- "for_appversions": {
- "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}": ["5.0a2", "6.0a1"]
- },
"tier": 2
}
- ],
- "metadata": {
- "name": "Best Add-on Evar",
- "version": "9000",
- "guid": "foo@bar.com"
- }
+ ]
}
@@ -371,40 +315,13 @@ or, after setting the proper python path: ::
nosetests
-However, to turn run unit tests with code coverage, the appropriate
-command would be: ::
-
- nosetests --with-coverage --cover-package=validator --cover-skip=validator.outputhandlers.,validator.main,validator.constants,validator.constants_local --cover-inclusive --cover-tests
-
-Note that in order to use the --cover-skip nose parameter, you must
-install the included patch for nose's coverage.py plugin: ::
-
- extras/cover.py
-
-This file should overwrite the standard nose coverage plugin at the
-appropriate location: ::
-
- ~/.virtualenvs/[virtual environment]/lib/pythonX.X/site-packages/nose/plugins/cover.py
- /usr/lib/pythonX.X/site-packages/nose/plugins/cover.py
-
-
----------
Updating
----------
Some regular maintenance needs to be performed on the validator in order to
make sure that the results are accurate.
-App Versions
-============
-
-A list of Mozilla ``<em:targetApplication>`` values is stored in the
-``validator/app_versions.json`` file. This must be updated to include the latest
-application versions. This information can be found on AMO:
-
-https://addons.mozilla.org/en-US/firefox/pages/appversions/
-
-
JS Libraries
============
@@ -422,41 +339,3 @@ regenerated with each new library version. To update: ::
To add new libraries to the mix, edit ``extras/jslibfetcher.py`` and add the
version number to the appropriate tuple.
-
-Jetpack
-=======
-
-In order to maintain Jetpack compatibility, the whitelist hashes need to be
-regenerated with each successive Jetpack version. To rebuild the hash library,
-simply run: ::
-
- cd jetpack
- ./generate_jp_whitelist.sh
-
-That's it!
-
-
-Language Packs
-==============
-
-With every version of every app that's released, the language pack references
-need to be updated.
-
-We now have an automated tool to ease this tedious process. It is currently
-designed to work on OS X with the OS X versions of Mozilla applications, though
-it could conceivably run on any \*NIX platform against the OS X application
-packages.
-
-To run the tool, first create a new directory: ``extras/language_controls/``
-
-Put the ``.app`` packages for each updated product into this directory. Once
-this is ready, simply run: ::
-
- cd extras
- python update_langpacks.py
-
-That should be it. Note that this tool will fail horribly if any of the teams
-change the locations that the various language files are stored in.
-
-Also note that this tool should only be run against the en-US versions of these
-applications.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
@@ -1,17 +0,0 @@
-import sys
-import os
-import os.path as pth
-import hashlib
-
-output = open("whitelist_hashes.txt", mode="w")
-
-for root, dirs, files in os.walk(sys.argv[1]):
- for filename in files:
- path = pth.join(pth.dirname(pth.abspath(sys.argv[0])),
- root, filename)
- hash = hashlib.sha1(open(path).read()).hexdigest()
- print path, hash
- output.write(hash + "\n")
-
-output.close()
-
View
@@ -1,42 +0,0 @@
-import sys
-import os
-
-import zipfile
-from zipfile import ZipFile
-from StringIO import StringIO
-
-source = sys.argv[1]
-target = sys.argv[2]
-zf = ZipFile(target, 'w')
-
-def _build_directory(source, zip, root):
- for item in os.listdir(source):
-
- if item in ("__MACOSX",
- ".DS_Store"):
- continue
-
- if item.startswith("__"):
- continue
-
- item = "%s/%s" % (source, item)
- print item
-
- if os.path.isdir(item):
- if item.startswith("_") and item.endswith(".jar"):
- zipbuffer = StringIO()
- subzip = ZipFile(zipbuffer, "w")
- _build_directory(item, subzip, item)
- subzip.close()
-
- zip.writestr(item[len(root) + 2:], zipbuffer.getvalue())
- else:
- _build_directory(item, zip, root)
- else:
- print item[len(root) + 1:]
- zip.write(item, item[len(root) + 1:])
-
-
-
-_build_directory(source, zf, source)
-zf.close()
Oops, something went wrong.

0 comments on commit ac8e016

Please sign in to comment.