addons-scanner-utils 9.15.0 → 10.0.0
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/dist/functions.d.ts +1 -2
- package/dist/functions.js +5 -4
- package/package.json +6 -6
package/dist/functions.d.ts
CHANGED
|
@@ -20,10 +20,9 @@ export type FunctionConfig = {
|
|
|
20
20
|
_process?: typeof process;
|
|
21
21
|
_unlinkFile?: typeof fs.promises.unlink;
|
|
22
22
|
apiKeyEnvVarName?: string;
|
|
23
|
-
requiredApiKeyParam?: string;
|
|
24
23
|
requiredDownloadUrlParam?: string;
|
|
25
24
|
tmpDir?: string;
|
|
26
25
|
xpiFilename?: string;
|
|
27
26
|
};
|
|
28
|
-
export declare const createExpressApp: ({ _console, _fetch, _process, _unlinkFile, apiKeyEnvVarName,
|
|
27
|
+
export declare const createExpressApp: ({ _console, _fetch, _process, _unlinkFile, apiKeyEnvVarName, requiredDownloadUrlParam, tmpDir, xpiFilename, }?: FunctionConfig) => (handler: RequestHandler) => import("express-serve-static-core").Express;
|
|
29
28
|
export {};
|
package/dist/functions.js
CHANGED
|
@@ -29,7 +29,7 @@ const createApiError = ({ message, extraInfo, status = 500, }) => {
|
|
|
29
29
|
return error;
|
|
30
30
|
};
|
|
31
31
|
exports.createApiError = createApiError;
|
|
32
|
-
const createExpressApp = ({ _console = console, _fetch = node_fetch_1.default, _process = process, _unlinkFile = fs_1.default.promises.unlink, apiKeyEnvVarName = 'LAMBDA_API_KEY',
|
|
32
|
+
const createExpressApp = ({ _console = console, _fetch = node_fetch_1.default, _process = process, _unlinkFile = fs_1.default.promises.unlink, apiKeyEnvVarName = 'LAMBDA_API_KEY', requiredDownloadUrlParam = 'download_url', tmpDir = os_1.default.tmpdir(), xpiFilename = 'input.xpi', } = {}) => (handler) => {
|
|
33
33
|
const app = (0, express_1.default)();
|
|
34
34
|
const allowedOrigin = _process.env.ALLOWED_ORIGIN || null;
|
|
35
35
|
if (!allowedOrigin) {
|
|
@@ -59,14 +59,15 @@ const createExpressApp = ({ _console = console, _fetch = node_fetch_1.default, _
|
|
|
59
59
|
}));
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
|
-
if (
|
|
62
|
+
if (!req.get('authorization')) {
|
|
63
63
|
next((0, exports.createApiError)({
|
|
64
|
-
message: `missing
|
|
64
|
+
message: `missing authorization header`,
|
|
65
65
|
status: 400,
|
|
66
66
|
}));
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
if (!apiKey ||
|
|
69
|
+
if (!apiKey ||
|
|
70
|
+
!(0, safe_compare_1.default)(`Bearer ${apiKey}`, String(req.get('authorization')))) {
|
|
70
71
|
next((0, exports.createApiError)({
|
|
71
72
|
message: 'authentication has failed',
|
|
72
73
|
status: 401,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "addons-scanner-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "Various addons related helpers to build CLIs.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"yauzl": "2.10.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"body-parser": "
|
|
22
|
-
"express": "
|
|
21
|
+
"body-parser": "2.2.2",
|
|
22
|
+
"express": "5.2.1",
|
|
23
23
|
"node-fetch": "2.6.11",
|
|
24
24
|
"safe-compare": "1.1.4"
|
|
25
25
|
},
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/common-tags": "^1.8.0",
|
|
42
|
-
"@types/express": "
|
|
42
|
+
"@types/express": "5.0.6",
|
|
43
43
|
"@types/jest": "^30.0.0",
|
|
44
44
|
"@types/node": "^25.0.1",
|
|
45
45
|
"@types/node-fetch": "^2.6.4",
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"@types/supertest": "^6.0.2",
|
|
49
49
|
"@typescript-eslint/eslint-plugin": "^8.46.2",
|
|
50
50
|
"@typescript-eslint/parser": "^8.46.2",
|
|
51
|
-
"body-parser": "
|
|
51
|
+
"body-parser": "2.2.2",
|
|
52
52
|
"eslint": "^8.1.0",
|
|
53
53
|
"eslint-config-amo": "^6.1.0",
|
|
54
54
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
55
55
|
"eslint-plugin-amo": "^2.0.0",
|
|
56
|
-
"express": "
|
|
56
|
+
"express": "5.2.1",
|
|
57
57
|
"jest": "^30.2.0",
|
|
58
58
|
"node-fetch": "2.6.11",
|
|
59
59
|
"prettier": "3.7.4",
|