addons-scanner-utils 15.4.0 → 15.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -3
- package/dist/io/const.d.ts +1 -0
- package/dist/io/const.js +4 -1
- package/dist/io/xpi.js +14 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -52,10 +52,9 @@ We use [Prettier][] to automatically format our JavaScript code and stop all the
|
|
|
52
52
|
|
|
53
53
|
### Versioning
|
|
54
54
|
|
|
55
|
-
This project follows the [semantic versioning](https://semver.org/) specification.
|
|
56
|
-
|
|
57
|
-
In order to release a new version, one has to run the [`npm version`](https://docs.npmjs.com/cli/version) command with one of the following arguments: `minor`, `patch` or `major` (less frequent). This command (1) updates the `version` in `package.json`, (2) create a new commit for the release and (3) make a `git` tag.
|
|
55
|
+
This project follows the [semantic versioning](https://semver.org/) specification. To release a new version of this library on npmjs.org, please see [our release process][].
|
|
58
56
|
|
|
59
57
|
[eslint]: https://eslint.org/
|
|
60
58
|
[jest]: https://jestjs.io/
|
|
59
|
+
[our release process]: https://github.com/mozilla/addons/tree/1.1/.github/actions/release#release-process
|
|
61
60
|
[prettier]: https://prettier.io/
|
package/dist/io/const.d.ts
CHANGED
package/dist/io/const.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NO_COMPRESSION = exports.MAX_FILE_SIZE_MB = exports.FLAGGED_FILE_MAGIC_NUMBERS_LENGTH = exports.DEFLATE_COMPRESSION = void 0;
|
|
3
|
+
exports.NO_COMPRESSION = exports.MAX_FILE_SIZE_MB = exports.FLAGGED_FILE_MAGIC_NUMBERS_LENGTH = exports.INVALID_ENTRY_NAME_REGEX = exports.DEFLATE_COMPRESSION = void 0;
|
|
4
4
|
exports.DEFLATE_COMPRESSION = 8;
|
|
5
|
+
// Control chars are not rejected by `yauzl`, even with `strictFileNames`.
|
|
6
|
+
// `\p{Cc}` covers the C0 controls, DEL and the C1 controls.
|
|
7
|
+
exports.INVALID_ENTRY_NAME_REGEX = /\p{Cc}/u;
|
|
5
8
|
exports.FLAGGED_FILE_MAGIC_NUMBERS_LENGTH = 4;
|
|
6
9
|
exports.MAX_FILE_SIZE_MB = 100;
|
|
7
10
|
exports.NO_COMPRESSION = 0;
|
package/dist/io/xpi.js
CHANGED
|
@@ -18,7 +18,13 @@ const first_chunk_stream_1 = __importDefault(require("first-chunk-stream"));
|
|
|
18
18
|
const strip_bom_stream_1 = __importDefault(require("strip-bom-stream"));
|
|
19
19
|
const common_tags_1 = require("common-tags");
|
|
20
20
|
const base_1 = require("./base");
|
|
21
|
+
const const_1 = require("./const");
|
|
21
22
|
const errors_1 = require("../errors");
|
|
23
|
+
const escapeEntryName = (fileName) => {
|
|
24
|
+
return fileName.replace(new RegExp(const_1.INVALID_ENTRY_NAME_REGEX, `${const_1.INVALID_ENTRY_NAME_REGEX.flags}g`), (char) => {
|
|
25
|
+
return `\\u${char.codePointAt(0).toString(16).padStart(4, '0')}`;
|
|
26
|
+
});
|
|
27
|
+
};
|
|
22
28
|
/*
|
|
23
29
|
* Simple Promise wrapper for the Yauzl unzipping lib to unpack add-on .xpis.
|
|
24
30
|
*
|
|
@@ -65,6 +71,14 @@ class Xpi extends base_1.IOBase {
|
|
|
65
71
|
});
|
|
66
72
|
}
|
|
67
73
|
handleEntry(entry, reject) {
|
|
74
|
+
// Look for invalid entries, including directories. We also check the raw
|
|
75
|
+
// bytes because `yauzl` decodes the name with CP437 unless the entry is
|
|
76
|
+
// flagged as UTF-8, and CP437 maps the control bytes to printable glyphs.
|
|
77
|
+
if (const_1.INVALID_ENTRY_NAME_REGEX.test(entry.fileName) ||
|
|
78
|
+
const_1.INVALID_ENTRY_NAME_REGEX.test(entry.fileNameRaw.toString('utf8'))) {
|
|
79
|
+
reject(new errors_1.InvalidZipFileError(`invalid characters in fileName: "${escapeEntryName(entry.fileName)}"`));
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
68
82
|
if (/\/$/.test(entry.fileName)) {
|
|
69
83
|
return;
|
|
70
84
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "addons-scanner-utils",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.5.2",
|
|
4
4
|
"description": "Various addons related helpers to build CLIs.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"first-chunk-stream": "3.0.0",
|
|
41
41
|
"jsonwebtoken": "^9.0.3",
|
|
42
42
|
"strip-bom-stream": "4.0.0",
|
|
43
|
-
"upath": "3.0.
|
|
43
|
+
"upath": "3.0.8",
|
|
44
44
|
"yauzl": "3.4.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
"@types/express": "5.0.6",
|
|
61
61
|
"@types/jest": "^30.0.0",
|
|
62
62
|
"@types/jsonwebtoken": "^9.0.10",
|
|
63
|
-
"@types/node": "^
|
|
63
|
+
"@types/node": "^26.0.0",
|
|
64
64
|
"@types/safe-compare": "^1.1.0",
|
|
65
65
|
"@types/supertest": "^7.2.0",
|
|
66
|
-
"@types/yauzl": "3.
|
|
66
|
+
"@types/yauzl": "3.4.0",
|
|
67
67
|
"@typescript-eslint/eslint-plugin": "^8.46.2",
|
|
68
68
|
"@typescript-eslint/parser": "^8.46.2",
|
|
69
69
|
"eslint": "^9.0.0",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"eslint-plugin-amo": "^3.0.0",
|
|
73
73
|
"express": "5.2.1",
|
|
74
74
|
"jest": "^30.2.0",
|
|
75
|
-
"prettier": "3.
|
|
75
|
+
"prettier": "3.9.6",
|
|
76
76
|
"pretty-quick": "4.2.2",
|
|
77
77
|
"rimraf": "^6.1.0",
|
|
78
78
|
"safe-compare": "1.1.4",
|