Граф коммитов

557 Коммитов

Автор SHA1 Сообщение Дата
Christopher Grebs bfd4d6cc44
Fix esprima import, fix css tests run 2019-03-25 09:27:41 +01:00
Luca Greco 5df2b4ecce fix(static-themes): Warn on LWT aliases used in a static theme manifest. (#2283)
This PR introduces a new `MANIFEST_THEME_LWT_ALIAS` rule, which is meant to warn the static themes authors of the incoming deprecation of the LWT alias properties.

In this PR this rule is currently considered a warning, which should be turned into an error once we want to prevent new theme submission from using this LWT aliases.
2019-03-11 13:15:13 +01:00
Mathieu Pillard 01c1743b6f
Raise an error and not a notice when no manifest is found (#2481)
Raise an error and not a notice when no manifest is found
2019-03-05 12:30:39 -06:00
Andreas Wagner 50c4a1e586
Fix syntax for jest 2019-01-30 12:52:10 +01:00
Andreas Wagner 4fad513171
Fix broken test on Windows 2019-01-30 10:48:40 +01:00
Christopher Grebs e300062af1
Port to fluent-syntax 0.10.0, switch to warnings.
Fixes #2313
Fixes #2305
2019-01-16 12:34:27 +01:00
Christopher Grebs 9160d1d9a9
Don't ignore files and folders with a leading dot. (#2316)
Fixes bug 1511836
2018-12-11 11:29:09 +01:00
Martin Giger fc1ddbcb36 feat: detect API and manifest key incompatibilities with strict_min_version (#1493) (#2290)
Fixes #1493

This is a first attempt at integrating the browser-compat-data from the MDN compatibility tables with the linter.
It currently checks for manifest keys, permissions and APIs to be supported by the given `strict_min_version` in the manifest for both Firefox and Firefox for Android. All produced messages are warnings. However, no warning is shown if Firefox or Firefox for Android do not implement an API and that is documented in the compat data. This is to avoid a lot of Firefox for Android spam, plus the totally unsupported APIs should be caught by the schemas.

I'm not quite happy with the amount of duplication of logic, even though it's subtly different for all cases, so improvement suggestions welcome! Further I'll happily add more tests, these are just the ones I could come up with.
2018-12-11 08:41:36 +01:00
Luca Greco b9437ad5ba
fix: Add browser_specific_settings as alias for applications in manifest (#2296)
* add browser_specific_settings as alias for applications in manifest
* .browser_specific_settings takes preference over .applications
* have browser_specific_settings override only if .gecko exists
* Manifest's applications key overridden with browser_specific_settings after schema validation
2018-11-27 17:00:23 +01:00
Christopher Grebs 9bbffb362b
Update logger.createLogger test for most recent pino version 2018-11-27 12:46:44 +01:00
Luca Greco 3bf8309ccc test: Set an higher jest timeout on appveyor jobs 2018-11-12 21:29:44 +01:00
Luca Greco f810d6186a fix: Detect unsupported images used in static themes manifest 2018-11-12 21:29:44 +01:00
Christopher Grebs c47afc30d6
Import Firefox 63 schema (#2181)
* First import of Firefox 63b14 schema
* Implement manifestShortcutKey format validation.
* Simplify our custom deepmerge implementation a bit, remove external is-mergeable-object
* Add firefox schema import docs
2018-10-17 16:36:10 +02:00
Mathieu Pillard 9f410673d7
Throw an error for dictionaries without an id (#2195)
Throw an error for dictionaries without an id
2018-09-24 16:24:30 +02:00
greenkeeper[bot] 225c9130df Update eslint-config-amo, integrate Prettier and addons-frontend inspired configuration (#2144)
* chore(package): update eslint-config-amo to version 1.8.0

* chore(package): update lockfile

https://npm.im/greenkeeper-lockfile

* Update to eslint-config-amo 1.8.3
* Integrate prettier and addons-frontend inspired configs
* Run prettier
* Fix some more docs inconsistencies
* Some more eslint/prettier config cleanups
* Reformat bin/
* Fix dependency updates
* Fix readme
* Keep es5 trailing comma support

Fixes #2084
2018-09-04 13:18:45 +02:00
Peter Simonyi 4b70c978c4 Search whole file for ES6 module detection
_getSourceType was not walking the whole AST, so it would only detect
import/export statements if they were the first in the file.  This fixes
the recursion to walk the whole AST.
2018-08-11 06:07:22 -04:00
Christopher Grebs 42170c160b
Add ES6 module support (#2078)
* Add support for es6 modules.

Fixes #1775

This parses JavaScript files and tries to figure out their sourceType
from how the AST is structured.

We default to `module` but if there are syntax errors fall back to
`script`. We do not read the `<script type="module"` part of HTML files
anymore.

* Fix guid
2018-08-07 21:43:54 +02:00
Christopher Grebs af03fa63fc
Use emcaVersion 2019 to support optional catch bindings.
Actually fixes #1958
2018-08-07 11:58:32 +02:00
Mathieu Pillard 271c73cf0e Validate that there is one and only one dictionary in each dictionary add-on 2018-08-03 16:47:59 +02:00
Mathieu Pillard a96feb2d6a Prevent strict_max_version from being set in dictionaries 2018-08-03 15:14:15 +02:00
Mathieu Pillard 15b8cad1e6 Throw a warning on additional properties in dictionaries 2018-08-03 14:54:39 +02:00
Mathieu Pillard 8c30419193 Fix eslint errors 2018-08-02 16:44:05 +02:00
Mathieu Pillard aea91d5cc0 Add basic support for WebExtension dictionaries 2018-08-02 16:44:05 +02:00
Mathieu Pillard 765d7d1636
Merge pull request #2123 from diox/validate-langpacks-without-command-line-flag
Validate langpacks without command line flag
2018-08-02 16:41:42 +02:00
Mathieu Pillard a07476696d Prevent language packs from having additional webextension properties 2018-08-02 13:40:57 +02:00
Mathieu Pillard 9622916d1c Do not warn on strict_max_version for langpacks 2018-08-02 13:17:30 +02:00
Mathieu Pillard 5c81485a7f Always validate language packs if langpack_id is present in manifest
Previously we would only validate them if the --langpack flag was
passed.
2018-08-02 13:06:58 +02:00
Andreas Wagner 7feba0fe77
Fix tests 2018-07-31 15:07:06 +02:00
Christopher Grebs b4f1107150
Cleanup README.md and rules.md (#2060)
* Cleanup README.md and rules.md

Fixes #2034
Fixes #1560

* Sort by severity, change title
2018-06-26 07:26:27 +02:00
Linus Unnebäck ec9bd1f88b
Move to npm and update lock-file 2018-06-19 11:06:29 +01:00
Natalia Milovanova c71099f3c0 test(integration): Added integration test suite
This patch adds a new integration test suite, which runs on both travis and appveyor in an
npm "production"-like environment (to be able to catch the kind of issues/regressions that
a regular user may experience by installing the npm package globally.
2018-05-07 15:06:47 +02:00
Christopher Grebs aa291beaab
Switch on tests for node 10, drop node 6 support. Version 1.0.0 (#1973)
* Switch on tests for node 10, drop node 6 support. Version 1.0.0

* Updates package-lock.json
* Updates yarn.lock

* Update appveyor to run on node 10 too

* Fix sinon deprecation warning

* Fix fs.exists call without callback

Fixes #1257
2018-05-07 12:46:19 +02:00
Mark Striemer bb29ca1b29
Use mozilla-unified to download and import Firefox schemas
* Ignore bash scripts in bin for eslint
* Update download-import-tag and add some docs

Fixes #1811
2018-04-06 10:55:03 +02:00
Hiroyuki Ikezoe 2b49632fb1 fix: Don't call getConfig() to set default value 2018-04-03 19:10:47 +09:00
Christopher Grebs 1e3c4a6c27
Fix absent content script detection. (#1923)
* Fix absent content script detection.

Fixes #1902

This essentially always tries to resolve the `file` based on `dirname`
but properly normalizes absolute paths.

I hope this fixes most of the edge-cases we've seen.

* Don't validate relative files, add and update tests

* Spelling

* Simplify the code a bit

* Fix eslint, remove unused dirname

* Move existing file name normalizing to create

* Simplify tests a bit

* Improve docs a bit

* Fix eslint
2018-03-21 13:33:51 +01:00
Christopher Grebs 3952fe5711
Remove explicit property linting from messages.json parsing. (#1919)
* Remove explicit property linting from messages.json parsing.

Fixes #1918

* Detect i18nPlaceholder and i18nMessage again but don't validate
* Add test for empty message
* More tests, allow empty message name
* Remove unused if branch
2018-03-20 20:30:02 +01:00
Christopher Grebs 0c7870c6af
Refactor ftl parsing to use fluent-syntax/compat. (#1888)
* Refactor ftl parsing to use fluent-syntax.

This now got rebased to fluent-syntax 0.6.5 which re-adds node 6 LTS
compatibility.

Fixes #1789

* Use upstream lineOffset and columnOffset
2018-03-13 19:05:32 +01:00
Christopher Grebs 053bb7a515
Add support for static theme linting (#1883)
* Implement static theme support.

* Adds initial support to lint and detect static themes
* Adds additional property validation on top of regular schema validation

Fixes #1587

* Simplify selection of correct validator

* Fix eslint issues

* Fix nits, add comment, move isStaticTheme to the constructor

* Add some more valid color variations
2018-03-13 17:47:34 +01:00
Christopher Grebs 12d12c2678
Merge pull request #1873 from pardeepshokeen/content-script-bug
fixes relative path in content script rule
2018-03-13 17:37:55 +01:00
pardeep c925da2050 add tests 2018-03-06 16:19:52 +05:30
Ravneet 0600ded57f Added tests for sprintf 2018-03-05 22:36:23 +05:30
Christopher Grebs d386baea58 Don't reset modules on a global bases 2018-03-03 17:54:58 +05:30
Christopher Grebs c734bcfd97 Fix unicode test 2018-03-03 17:54:58 +05:30
Christopher Grebs 52b3ea040a Clear and reset all jest mocks after each test 2018-03-03 17:54:58 +05:30
Christopher Grebs f3e70bb08c Fix eslint, add more tests 2018-03-03 17:54:58 +05:30
Christopher Grebs a09261ef3f Fix messages tests 2018-03-03 17:54:58 +05:30
Christopher Grebs c1b99a13f2 Fix utils module 2018-03-03 17:54:58 +05:30
Christopher Grebs bb510ed107 Adapt all code to use i18n module 2018-03-03 17:54:58 +05:30
Christopher Grebs 17beb39f70 Get i18n object to work 2018-03-03 17:54:58 +05:30
Christopher Grebs f5915af019 Try firefox-schema 'inner' trick a bit more explicit in tests 2018-03-03 17:54:58 +05:30
Christopher Grebs b877e7c8b9 Experiment 2018-03-03 17:54:58 +05:30
Ravneet 95c42cd76c Fixed linting errors 2018-03-03 17:54:31 +05:30
Ravneet 112dd6484f Added test 2018-03-03 17:54:29 +05:30
greenkeeper[bot] e6902bdb65 Update ajv to the latest version 🚀 (#1868)
fix(package): update ajv to version 6.2.0
2018-03-01 17:48:32 +01:00
Milovanova Natalia 23bdc4909c Async/await refactoring for scanners tests (#1805)
* refactors scanners test files until test.filename.js

* refactors rest of the files in test scanners folder

* converts expect.toBeTruthy into sinon assertions

* fixes additional test

* moves spyes back to the beginning of the tests

* fixes wrong test
2018-03-01 15:16:28 +01:00
Milovanova Natalia c506483b13 Async/await refactoring tests/test.linter.js (#1822)
* refactors test.linter.js

* removes empty lines and replaces try with rejects

* fixes lint error

* adds error messages validation
2018-03-01 15:16:19 +01:00
Natalia Milovanova d9453c9591 refactors test.firefox-schemas-import.js 2018-02-14 22:16:56 -05:00
Natalia Milovanova 302d40a4f1 refactors test.utils.js 2018-02-14 22:00:03 -05:00
Milovanova Natalia 0d7362fc6c Async/await refactoring tests/rules/js folder (#1790)
* async/await changes until test.no_new_func.js

* refactors tests/rules/js

* refactors files after first round of questions
2018-02-12 17:00:34 +01:00
Christopher Grebs 119813cf36
fix(package): update eslint to version 4.17.0 (#1824)
* fix(package): update eslint to version 4.17.0

Closes #1778

* Fix eslint failure, fix yarn
2018-02-12 10:55:44 +01:00
Milovanova Natalia 914921dffa Removes mozIndexedDB rules and related tests, fixes #1814 (#1815)
* removes mozIndexedDB rules, tests, translations

* reverts translations

* removes forgotten locale from PR
2018-02-10 07:34:05 +01:00
Martin Giger 3923b399f8 Rules for messages.json (#1801)
Fixes #1666

This adds a parser for messages.json files. The parser is called from the JSON scanner. It has a JSON schema for the messages.json files, which is currently just in the schema's directory, since it is neither imported nor a patch of an existing schema. I'm pretty sure that's not where it should be, though.

It also warns about missing placeholders and when using reserved message names (which are potentially inaccessible).

I think the naming regexp as it is documented is not enforced like this by Firefox, so it may be demoted to a warning, since the extension will still work, even with characters other than [A-Za-Z0-9_@] in message names. I don't know about placeholders, not something I have violated myself.

The errors are kind of annoying currently, since you have no position or reference to which message they happen at. I haven't really found precedent for how to handle that though.

And lastly, the documentation links should probably be shortened, so they're actually clickable.

* Rules for messages.json
* Add lowercase handling and add locale perfix for messages.json
* Add test for getLowercasePlaceholders when there are no placeholders
2018-02-06 15:11:28 +01:00
Mark Striemer 8e7f2bc9d7
Firefox schema 59 import (#1798)
Fixes #1378
2018-01-30 15:33:40 -06:00
Milovanova Natalia 99f2e5b8a9 Async/await refactoring manifestjson.js (#1744)
* refactors manifestjson.js

* changes arg names in validateIcon function

* renames args and groups tests for validateIcon function

* adds log.debug to validateIcon and changes icon32 to icon33 in the size mismatch test

* changes debug message
2018-01-30 19:40:22 +01:00
Christopher Grebs dfd9bb9339
Merge pull request #1742 from hameleonka/1536-io-test-xpi-refactoring
Async/await refactoring for tests/io folder - test.xpi.js
2018-01-24 17:48:19 +01:00
Natalia Milovanova c270387ba8 refactors tests for css rules 2018-01-20 20:42:57 -05:00
Natalia Milovanova da2affe4ff adds readStringFromStream function from helpers.js 2018-01-17 19:36:03 -05:00
Natalia Milovanova 9bb12efe9d Merge branch 'master' into 1536-io-test-xpi-refactoring 2018-01-17 15:18:44 -05:00
Christopher Grebs cc9f3e23c5
Initial attempt to warn about coin miners. (#1763)
* Initial attempt to warn about coin miners.

This does not attempt to detect all of them but primarily focuses on
detecting CoinHive for now.

There's a whole bunch to explore and block when looking at NoCoin but
I'd rather see how many false positives we get in the real world with
this code first.

Fixes #1643 but might need a few follow up issues to add more miners.

* Fix eslint for coinminer fixtures

* Remove urls from blocklist

* Fix tests

* Fix typo in fixture filename

* Add docs

* Fix filename blocklist, update tests to add more coverage.
2018-01-17 19:34:44 +01:00
Luca Greco 69431eff68
Fix Jest issues and update it to version 22.1.1 (#1762)
This pull request fixes #1751, #1752 and #1758
2018-01-17 14:53:11 +01:00
Milovanova Natalia 40402549ad Async/await refactoring for tests/io folder - test.directory.js (#1733)
* refactors test.directory.js in tests/io folder

* moves function readStringFromStream outside of the test function

* changes try/catch block to rejects.toThrow

* adds readStringFromStream to helpers.js

* adds resolves.toBe method
2018-01-17 12:09:27 +01:00
Luca Greco a71e33f3c7 Fix some incompatibilities with jest > 22.0.3
This patch fix some incompatibilities of the test suite with recent Jest versions.

In particular:

- Jest doesn't accept a directory parameter anymore (a regex that match a group of test or a single test file is accepted instead)

-  Some of the unit tests are implicitly using getConfig (exported by the cli.js module), which is parsing the process.argv array with yargs, unfortunately process.argv is controlled by jest when the tests are running and  so some of the tests are failing (exiting with 1 as exit value and no message printed in the console) when running alone, and get stuck when running with a group of other tests.

This patch introduces the set of changes needed to fix the second issue, which prepare the test suite to be able to complete successfully on the updated Jest releases.
2018-01-17 11:56:53 +01:00
Natalia Milovanova c363cd98de changes try/catch block to rejects.toThrow and adds resolves method 2018-01-14 19:21:26 -05:00
Natalia Milovanova 4e14822479 refactors test.xpi.js in tests/io folder 2018-01-08 21:32:42 -05:00
Milovanova Natalia d6ee6ea256 Async/await refactoring for tests/io folder - test.utils.js refactoring (#1734)
* refactors test.utils.js in tests/io folder

* reverts yarn.lock
2018-01-08 12:32:54 +01:00
Milovanova Natalia 082d73ed89 refactors test.crx.js in tests/io folder (#1731) 2018-01-08 12:32:47 +01:00
asamuzaK (Kazz) 329497595b Add tests 2018-01-07 18:15:17 +09:00
Luca Greco 409db18337 fix: prevent Object properties to be detected as existent files by tabs.executeScript rule (#1707) 2018-01-05 16:16:58 -06:00
Luca Greco 2811e0bf90 Convert scanned and collected file paths to unix path separator (#1730) 2018-01-05 13:58:59 -06:00
Milovanova Natalia c43b6713a0 refactors test.base.js in tests/io folder (#1726) 2018-01-03 16:31:07 +01:00
Milovanova Natalia 2025658d73 Babel setup for async/await (#1692)
* adds babel support for async/await with transpilation to ES2015 generators for backward compatibility with node 6 + working example of function converted to async/await syntax in linter.js

* rewrites run, scan, scanFile, getAddonMetadata and extractMetadata functions

* refactors the rest of the promises in linter.js

* fixes comments from second of review

* reverts unnecessary chahges from third round of review
2017-12-19 16:29:01 +01:00
asamuzaK (Kazz) 567d3f0f35 Replace svg path (#1698) 2017-12-19 16:04:31 +01:00
pardeepshokeen 1798c739b8 error for missing messages.json in language directory (#1684)
* error for missing messages.json in language directory
* Fixes #1585 at the top of this PR.
2017-12-19 15:59:45 +01:00
Luca Greco d4384013be
fix: addons-linter is reporting png file as corrupted when using io.directory module (#1714) 2017-12-19 15:56:18 +01:00
Milovanova Natalia 195f9a9bcb fixes #1640 adds missing content scripts file rule for static strings (#1661)
* adds content script files existance validator, when files requested as a static string from js code

* fixes tests

* adds tests for new eslint rule

* fixes linter errors

* updates validation rule to match only static strings in file property of options object in executeScript call

* updates content_scripts_file_absent validator according to the comments in PR, adds some tests

* removes yarn.lock

* updates if conditions in content_scripts_file_absent validator, refactors test suites

* reduces nesting in the validator code, removes eslint exceptions and merges similar tests into one

* adds additional validation if browser.tabs.executeScript actually a call and test for it, plus minor comments to tests

Fixes #1640
2017-12-05 14:47:35 +01:00
asamuzaK (Kazz) c64b941a31 Switch dependency to probe-image-size (#1689)
* Add probe-image-size

* Fix function

* Remove sharp

* Add fix for svg icon size mismatch
2017-12-05 09:35:53 +01:00
greenkeeper[bot] eda3be2ad9 Update eslint-config-amo to the latest version 🚀 (#1639)
* chore(package): update eslint-config-amo to version 1.0.0

* Fix lint errors

* Fix typo

* Make eslint happy
2017-12-01 10:35:18 +01:00
Andreas Wagner e99876550e
Merge pull request #1665 from wagnerand/csp
More precise CSP evaluation
2017-11-23 18:02:45 +01:00
Andreas Wagner 83c3d4bcc5
Clean up code, moke check even more precise 2017-11-22 18:43:11 +01:00
Mark Striemer c00b125115
chore(package): update deepmerge to version 2.0.1
Update deepmerge but use the old array merge
Fixes #1633
2017-11-22 11:14:42 -06:00
Andreas Wagner 4e147a31ca
More precise CSP evaluation 2017-11-22 16:14:22 +01:00
Christopher Grebs e3b2a726cf
Block specific content script match patterns. (#1652)
* Block specific content script match patterns.

Fixes #1650

* shorten code a bit

* even shorter code :-/

* Add docs to rules

* Fix build, update yarn

* update message and description

* ...

* Fix test
2017-11-14 18:03:32 +01:00
Milovanova Natalia 2979610241 fixes #1590 for scripts/css files declared in manifest.json (#1630)
* fixes #1590 for scripts/css files declared in manifest.json

* reverts background script related changes and adds more specific error description for missing content scripts files
2017-11-14 10:00:15 +01:00
Christopher Grebs f1c12de0de
Merge pull request #1634 from mozilla/1632-add-object-spread-support
Add support for object spreads.
2017-11-02 12:45:15 +01:00
Christopher Grebs fe56dc6275
Fix regression in icon validation.
Fixes #6806

* icon size and format functions did not open the correct file
  directly from the XPI
* tests didn't use the actual test-fixtures
  and thus validated the wrong thing
* file path was not correctly fowarded to warning

This was a regression from #1581 and #1558
2017-11-02 06:52:51 +01:00
Christopher Grebs ac4f888c81
Add support for object spreads (experimental).
Fixes #1632
2017-11-02 04:29:11 +01:00
Milovanova Natalia 94f5c6d491 fixes #1436 (#1623)
* fixes #1436

* fixes cli param name

* fixes comments
2017-11-01 17:23:13 +01:00
Christopher Grebs 935cc8c4a0 Add support for WebExtension Langpack (#1613)
Fixes #1526

* Adds `.properties` and `.doctype` parsers for potential completeness tests or at least very basic validation if those files look fine
  * Once all language packs moved to FTL we can drop them
* Adds a new `validateLangPack` validator, rewrites a few schemas to now explicitly grab the correct validator type (webext/langpack)
* Adds a new command line option that explicitly switches the mode to langpack and verifies against `#/types/WebExtensionLangpackManifest` instead of `WebExtensionManifest`
* Added support for FTL files, they are the first ones to throw proper warnings, yeay!

it's not 100% complete, it adds basic validation against the schema but doesn't do anything with the actual l10n files yet. That'll come in another iteration
2017-10-21 17:10:09 +02:00
Ravneet 738cbad16c Added check to add warning in case of corrupt image file (#1581)
* Added Sharp as a dependency

* Added an error message to manifestjson.js

* Added getImageMetadata function

* Added check to throw warning for corrupted images

* Added rule to rules.md

* Fixes Tests and Linting errors

* Modified tests, Added default svg and png files

* Fixed tests

* Shifted to metadata function for detecting corrupt files

* Fixed tests

* Added Test

* Added comma

* Added tests to validate width and height of image

* Fixed Tests

* Added Tests

* Added test to check if image size is correct

* Added path parameter to test

* Fixed typos

* Added default corrupted file

* Fixed linting errors

* Shifted validateIcon image to a promise

* Fixed tests and linting errors

* Fixed test

* Added icons to webextension.zip
2017-10-18 13:25:56 +02:00
Milovanova Natalia 511b4aa5b6 removes all rdf related code and tests (#1607)
* removes all rdf related code and tests

* renames fake test files to manifest.json and removes install.rdf from rules.md
2017-10-17 09:35:18 +02:00
asamuzaK (Kazz) 57bc2b052f SVG fragment identifier support 2017-10-16 01:44:24 +09:00
Christopher Grebs c06c0753bb Merge pull request #1578 from mstriemer/schema-57
Firefox 57 schema import (fixes #1577)
2017-10-06 19:49:04 +02:00
Mark Striemer 0c9b65ef90 Firefox 57 schema import (fixes #1577) 2017-09-29 13:19:03 -05:00
Andy McKay 6bae32bf6c Merge pull request #1562 from andymckay/check-files
check that files in the background script actually exist
2017-09-28 16:21:56 -07:00
Ravneet d3e429fba9 Added check to make sure icon has a valid extension (#1558)
Fixes #1328 

* Added check to make sure icon has a valid extension
* Added rule in rules.md
* Added new extensions
* Changed comparision logic to lowercase
* Added test
* Removed extra padding
* Shifted from sprintf
* Added new icon in tests with correct extension
* Changed content of message
* Removed legacyCode parameter
* Changed content of test message
2017-09-28 07:18:59 +02:00
Andy 78e96e1597 feedback from cgrebs 2017-09-26 17:39:02 -07:00
Andy 20c2c32964 because the eslint god said so 2017-09-26 17:33:45 -07:00
Andy 6ee63f992f check that files in the background script actually exist 2017-09-26 17:33:45 -07:00
Ravneet 46dde63476 Removed test 2017-09-25 21:59:01 +05:30
Christopher Grebs ee500637f5
Don't count and scan flagged or binary files for badwords.
Fixes #1552
Fixes #1551
2017-09-19 17:42:16 +02:00
Christopher Grebs 36e0d9ae0e First version of detecting minified code. (#1525)
* First version of detecting minified code.

Fixes #1323 

* Update comment

* Add source map detection

* Rename property, add test for no-nl code, add docs

* Fix typo

* Fix tests to always read a string instead of a buffer to match what getFileAsString does.

* Fix huge line detection, add minified but > 20% indented test.
2017-09-13 12:51:38 +02:00
Christopher Grebs 6147f0408e Merge pull request #1528 from harry-7/warnonjs
Added a check for type of script in warn-on-js
2017-09-12 07:15:52 +02:00
Christopher Grebs e223b1ac10 Add CSP warning for unsafe-eval. (#1524)
* Add CSP warning for unsafe-eval.

Fixes #1506

* Add more detailed error message for unsafe-eval

* Add missing rules.md entry
2017-09-08 12:12:43 +02:00
Hemanth Kumar Veeranki 7b9b873e30 Added a check for type of script in warn-on-js
Signed-off-by: Hemanth Kumar Veeranki <hemanthveeranki@gmail.com>
2017-09-07 21:46:01 +05:30
Christopher Grebs ed6dc2fea7 Merge pull request #1513 from mozilla/1459-fix-perm-test
Fix fixme, fix matching pattern tests.
2017-09-06 13:29:02 +02:00
Andreas Wagner cc63ff61c4
Fix eslint (indentation) errors 2017-09-05 22:29:49 +02:00
Andreas Wagner 9d4f45bb7c
Fix code and tests 2017-09-05 22:20:30 +02:00
Christopher Grebs 496ff99127
Partially revert "Fix version format regexp (#1507)"
This reverts commit 7dc81ce726, reversing
changes made to 92cdd8c6ec.

This adds the same fix to invalidate '0.1.12dev-cb31c51' and '4.1.1dev-abcdef1' though.

Might need another follow-up to (partially) fix mentioned issues from #1439 or #1172.
2017-09-05 15:14:40 +02:00
Christopher Grebs 275e39015a Limit version string length. (#1514)
* Limit version string length.

Fixes bug 1393644.

* Use template strings

* Rebase on new version refactor, add comment
2017-09-05 14:11:43 +02:00
Stuart Colville 244c9a62ac Add lint to CI (#1518)
* Add lint to CI

* Fix lint

* Fix errant space
2017-09-05 12:02:28 +01:00
Christopher Grebs 7dc81ce726 Fix version format regexp (#1507)
* Fix version format regexp

* Add tests for isToolkitVersionString()

* Fix missing comma

* Add more test patterns

Closes #1439 
Closes #1172
2017-09-05 10:23:02 +02:00
asamuzaK (Kazz) b5bc4f0eae Add more test patterns 2017-09-05 16:21:55 +09:00
Christopher Grebs a6733afa83
Fix fixme, fix matching pattern tests.
Fixes #1459
2017-09-05 06:59:50 +02:00
Christopher Grebs 237851a477 Don't check badwords on binary files such as PNGs. (#1508)
* Don't check badwords on binary files such as PNGs.

Fixes #1504

* Split up tests and add test that makes sure that js libs are also not matched.

* Use jquery 3.2.1
2017-09-05 06:13:48 +02:00
asamuzaK (Kazz) fe5fff4247 Fix missing comma 2017-09-04 16:29:57 +09:00
asamuzaK (Kazz) a9fb841731 Add tests for isToolkitVersionString() 2017-09-04 16:20:57 +09:00
asamuzaK (Kazz) aa5a00c48a Fix version format regexp 2017-09-03 15:37:08 +09:00
Christopher Grebs b625b85efd
Flag Mozilla conditions of use violation.
Fixes #1285

Less greedy version than last time, should not match partial matches
anymore.

This reverts commit 18c6979520.
2017-08-28 08:40:20 +02:00
Christopher Grebs 18c6979520
Revert "Flag Mozilla conditions of use violation. (#1446)"
This reverts commit 91a89f5341.
2017-08-22 15:51:51 +02:00
Hemanth Kumar Veeranki 1fcb79d95d Replace singleLineString with common-tags equivalent
Signed-off-by: Hemanth Kumar Veeranki <hemanthveeranki@gmail.com>
2017-08-12 11:30:15 +05:30
Stuart Colville 6109428a06 Configure amo eslint config (#1451)
* Sync lockfile

* Add and setup amo eslint config

* Use Array.prototype.some instead of loop

* Make test command compare with addons-frontend

* Update README to refer to yarn over npm
2017-08-11 16:49:06 +02:00
Christopher Grebs 91a89f5341 Flag Mozilla conditions of use violation. (#1446)
* Flag Mozilla conditions of use violation.

Fixes #1285

* Performance optimization: initialize regex only once.

This also forwards _console and silents test output.

* Don't match on empty strings

* Fix comment

* Refactor badwords matching to be more performant and simpler.

* Remove trim
2017-08-11 12:58:40 +02:00
Andy McKay 9173fcd80c warn on max_strict_version 2017-08-04 17:50:50 -07:00
Christopher Grebs 37b1dd7ca8 Parse and validate CSP rules more properly. (#1434)
* First take on #1298 , parse and validate CSP rules more properly.

This needs much more test-values, best from real-life add-ons.

* Add a few more tests

* Fix parseCspPolicy tests

* Update message a bit

* Make sure other rules like style-src are unaffected

* Move url validation inside try/catch block

* Generally avoid loading anything from a host

* Refactor parsing logic a bit to be more explicit with host matches.

* Add two more invalid values

* Add one more invalid example

* Be a bit less strict, there are a few scenarios that we might not be able to match properly...

* More bugfixes, don't match plain host names for now

* Refactor matching again to properly match all crappy things...

* Small cleanups

* More tests, lint worker-src too, forbid unsafe-eval.

* Forbid unsafe-inline too

* Fix tests

* Update message

* re-add unsafe-eval and unsafe-inline based on @wagnerand request.

Fixes #1298
2017-08-04 13:46:08 +02:00
Christopher Grebs dd8f8935bd
re-add unsafe-eval and unsafe-inline based on @wagnerand request. 2017-08-04 11:01:12 +02:00
Christopher Grebs 4d4dd66840
Fix tests 2017-08-03 18:32:16 +02:00
Christopher Grebs b4bdbaa75d
Forbid unsafe-inline too 2017-08-03 18:31:34 +02:00
Christopher Grebs 9ebd376348
More tests, lint worker-src too, forbid unsafe-eval. 2017-08-03 18:30:45 +02:00
Christopher Grebs 402bd8135c
Small cleanups 2017-08-03 17:40:12 +02:00
Christopher Grebs f5f2c1ba03 Warn when detecting a <script> tag with a remote URL. (#1429)
* Warn when detecting a <script> tag with a remote URL.

Fixes #1321

* Respect moz-extension

* Update messages

* Add rule

* Add schema-less uri as test.
2017-08-03 17:34:52 +02:00
Christopher Grebs 645fc239a0
Refactor matching again to properly match all crappy things... 2017-08-03 17:04:01 +02:00
Christopher Grebs 4fd337ae3e
More bugfixes, don't match plain host names for now 2017-08-02 20:17:05 +02:00
Christopher Grebs 21c3a7bd44
Be a bit less strict, there are a few scenarios that we might not be able to match properly... 2017-08-02 19:53:46 +02:00
Christopher Grebs 43550c1c82
Add one more invalid example 2017-08-02 19:29:09 +02:00
Christopher Grebs 98b0e3b516
Add two more invalid values 2017-08-02 19:25:59 +02:00
Christopher Grebs f570d82927
Generally avoid loading anything from a host 2017-08-02 19:04:21 +02:00
Christopher Grebs f8c8244ed1
Make sure other rules like style-src are unaffected 2017-08-02 18:37:32 +02:00
Christopher Grebs dcb3bd23d6
Fix parseCspPolicy tests 2017-08-02 18:29:14 +02:00
Christopher Grebs 4dbe47389b
Add a few more tests 2017-08-02 18:22:27 +02:00
Christopher Grebs 343c2f6d3f
First take on #1298, parse and validate CSP rules more properly.
This needs much more test-values, best from real-life add-ons.
2017-08-02 17:35:42 +02:00