verdaccio-audit 13.0.5 → 13.1.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.
@@ -0,0 +1,23 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ //#endregion
23
+ exports.__toESM = __toESM;
package/build/audit.js CHANGED
@@ -1,167 +1,73 @@
1
- "use strict";
1
+ const require_runtime = require("./_virtual/_rolldown/runtime.js");
2
+ let express = require("express");
3
+ express = require_runtime.__toESM(express);
4
+ let https_proxy_agent = require("https-proxy-agent");
5
+ https_proxy_agent = require_runtime.__toESM(https_proxy_agent);
6
+ let node_fetch = require("node-fetch");
7
+ node_fetch = require_runtime.__toESM(node_fetch);
8
+ let node_https = require("node:https");
9
+ node_https = require_runtime.__toESM(node_https);
10
+ let _verdaccio_core = require("@verdaccio/core");
11
+ //#region src/audit.ts
12
+ var REGISTRY_DOMAIN = "https://registry.npmjs.org";
13
+ var ProxyAudit = class extends _verdaccio_core.pluginUtils.Plugin {
14
+ enabled;
15
+ logger;
16
+ strict_ssl;
17
+ timeout;
18
+ constructor(config, options) {
19
+ super(config, options);
20
+ this.enabled = config.enabled || false;
21
+ this.strict_ssl = config.strict_ssl !== void 0 ? config.strict_ssl : true;
22
+ this.timeout = config.timeout ?? 1e3 * 60 * 1;
23
+ this.logger = options.logger;
24
+ }
25
+ register_middlewares(app, auth) {
26
+ const fetchAudit = async (req, res) => {
27
+ const headers = req.headers;
28
+ headers["host"] = "registry.npmjs.org";
29
+ headers["content-encoding"] = "gzip,deflate,br";
30
+ let requestOptions = {
31
+ agent: new node_https.default.Agent({ rejectUnauthorized: this.strict_ssl }),
32
+ body: JSON.stringify(req.body),
33
+ headers,
34
+ method: req.method
35
+ };
36
+ if (auth?.config?.https_proxy) {
37
+ const agent = (0, https_proxy_agent.default)(auth?.config?.https_proxy);
38
+ requestOptions = Object.assign({}, requestOptions, { agent });
39
+ }
40
+ try {
41
+ const auditEndpoint = `${REGISTRY_DOMAIN}${req.baseUrl}${req.route.path}`;
42
+ this.logger.debug("fetching audit from " + auditEndpoint);
43
+ const controller = new AbortController();
44
+ setTimeout(() => controller.abort(`Fetch ${auditEndpoint} timeout ${this.timeout}ms`), this.timeout);
45
+ const response = await (0, node_fetch.default)(auditEndpoint, {
46
+ ...requestOptions,
47
+ signal: controller.signal
48
+ });
49
+ if (response.ok) res.status(response.status).send(await response.json());
50
+ else {
51
+ this.logger.warn("could not fetch audit: " + JSON.stringify(await response.json()));
52
+ res.status(response.status).end();
53
+ }
54
+ } catch (error) {
55
+ this.logger.warn("could not fetch audit: " + error);
56
+ res.status(500).end();
57
+ }
58
+ };
59
+ const handleAudit = async (req, res) => {
60
+ if (this.enabled) await fetchAudit(req, res);
61
+ else res.status(500).end();
62
+ };
63
+ const router = express.default.Router();
64
+ router.post("/audits", express.default.json({ limit: "10mb" }), handleAudit);
65
+ router.post("/audits/quick", express.default.json({ limit: "10mb" }), handleAudit);
66
+ router.post("/advisories/bulk", express.default.json({ limit: "10mb" }), handleAudit);
67
+ app.use("/-/npm/v1/security", router);
68
+ }
69
+ };
70
+ //#endregion
71
+ exports.default = ProxyAudit;
2
72
 
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports["default"] = exports.REGISTRY_DOMAIN = void 0;
8
- var _express = _interopRequireDefault(require("express"));
9
- var _httpsProxyAgent = _interopRequireDefault(require("https-proxy-agent"));
10
- var _nodeFetch = _interopRequireDefault(require("node-fetch"));
11
- var _nodeHttps = _interopRequireDefault(require("node:https"));
12
- var _core = require("@verdaccio/core");
13
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
14
- function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
15
- function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
16
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
17
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
18
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
19
- function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
20
- function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
21
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
22
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
23
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
24
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
25
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
26
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
27
- function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
28
- function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
29
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
30
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
31
- function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
32
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
33
- // FUTURE: we should be able to overwrite this
34
- var REGISTRY_DOMAIN = exports.REGISTRY_DOMAIN = 'https://registry.npmjs.org';
35
- var ProxyAudit = exports["default"] = /*#__PURE__*/function (_pluginUtils$Plugin) {
36
- function ProxyAudit(config, options) {
37
- var _config$timeout;
38
- var _this;
39
- _classCallCheck(this, ProxyAudit);
40
- _this = _callSuper(this, ProxyAudit, [config, options]);
41
- _this.enabled = config.enabled || false;
42
- _this.strict_ssl = config.strict_ssl !== undefined ? config.strict_ssl : true;
43
- _this.timeout = (_config$timeout = config.timeout) !== null && _config$timeout !== void 0 ? _config$timeout : 1000 * 60 * 1;
44
- _this.logger = options.logger;
45
- return _this;
46
- }
47
- _inherits(ProxyAudit, _pluginUtils$Plugin);
48
- return _createClass(ProxyAudit, [{
49
- key: "register_middlewares",
50
- value: function register_middlewares(app, auth) {
51
- var _this2 = this;
52
- var fetchAudit = /*#__PURE__*/function () {
53
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(req, res) {
54
- var _auth$config;
55
- var headers, requestOptions, _auth$config2, agent, auditEndpoint, controller, response, _t, _t2, _t3, _t4, _t5;
56
- return _regenerator().w(function (_context) {
57
- while (1) switch (_context.p = _context.n) {
58
- case 0:
59
- headers = req.headers;
60
- headers['host'] = 'registry.npmjs.org';
61
- headers['content-encoding'] = 'gzip,deflate,br';
62
- requestOptions = {
63
- agent: new _nodeHttps["default"].Agent({
64
- rejectUnauthorized: _this2.strict_ssl
65
- }),
66
- body: JSON.stringify(req.body),
67
- headers: headers,
68
- method: req.method
69
- };
70
- if (auth !== null && auth !== void 0 && (_auth$config = auth.config) !== null && _auth$config !== void 0 && _auth$config.https_proxy) {
71
- // we should check whether this works fine after this migration
72
- // please notify if anyone is having issues
73
- agent = (0, _httpsProxyAgent["default"])(auth === null || auth === void 0 || (_auth$config2 = auth.config) === null || _auth$config2 === void 0 ? void 0 : _auth$config2.https_proxy);
74
- requestOptions = Object.assign({}, requestOptions, {
75
- agent: agent
76
- });
77
- }
78
- _context.p = 1;
79
- auditEndpoint = "".concat(REGISTRY_DOMAIN).concat(req.baseUrl).concat(req.route.path);
80
- _this2.logger.debug('fetching audit from ' + auditEndpoint);
81
- controller = new AbortController();
82
- setTimeout(function () {
83
- return controller.abort("Fetch ".concat(auditEndpoint, " timeout ").concat(_this2.timeout, "ms"));
84
- }, _this2.timeout);
85
- _context.n = 2;
86
- return (0, _nodeFetch["default"])(auditEndpoint, _objectSpread(_objectSpread({}, requestOptions), {}, {
87
- signal: controller.signal
88
- }));
89
- case 2:
90
- response = _context.v;
91
- if (!response.ok) {
92
- _context.n = 4;
93
- break;
94
- }
95
- _t = res.status(response.status);
96
- _context.n = 3;
97
- return response.json();
98
- case 3:
99
- _t.send.call(_t, _context.v);
100
- _context.n = 6;
101
- break;
102
- case 4:
103
- _t2 = _this2.logger;
104
- _t3 = JSON;
105
- _context.n = 5;
106
- return response.json();
107
- case 5:
108
- _t4 = _t3.stringify.call(_t3, _context.v);
109
- _t2.warn.call(_t2, 'could not fetch audit: ' + _t4);
110
- res.status(response.status).end();
111
- case 6:
112
- _context.n = 8;
113
- break;
114
- case 7:
115
- _context.p = 7;
116
- _t5 = _context.v;
117
- _this2.logger.warn('could not fetch audit: ' + _t5);
118
- res.status(500).end();
119
- case 8:
120
- return _context.a(2);
121
- }
122
- }, _callee, null, [[1, 7]]);
123
- }));
124
- return function fetchAudit(_x, _x2) {
125
- return _ref.apply(this, arguments);
126
- };
127
- }();
128
- var handleAudit = /*#__PURE__*/function () {
129
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(req, res) {
130
- return _regenerator().w(function (_context2) {
131
- while (1) switch (_context2.n) {
132
- case 0:
133
- if (!_this2.enabled) {
134
- _context2.n = 2;
135
- break;
136
- }
137
- _context2.n = 1;
138
- return fetchAudit(req, res);
139
- case 1:
140
- _context2.n = 3;
141
- break;
142
- case 2:
143
- res.status(500).end();
144
- case 3:
145
- return _context2.a(2);
146
- }
147
- }, _callee2);
148
- }));
149
- return function handleAudit(_x3, _x4) {
150
- return _ref2.apply(this, arguments);
151
- };
152
- }();
153
- var router = _express["default"].Router();
154
- router.post('/audits', _express["default"].json({
155
- limit: '10mb'
156
- }), handleAudit);
157
- router.post('/audits/quick', _express["default"].json({
158
- limit: '10mb'
159
- }), handleAudit);
160
- router.post('/advisories/bulk', _express["default"].json({
161
- limit: '10mb'
162
- }), handleAudit);
163
- app.use('/-/npm/v1/security', router);
164
- }
165
- }]);
166
- }(_core.pluginUtils.Plugin);
167
73
  //# sourceMappingURL=audit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"audit.js","names":["_express","_interopRequireDefault","require","_httpsProxyAgent","_nodeFetch","_nodeHttps","_core","e","__esModule","_regenerator","t","r","Symbol","n","iterator","o","toStringTag","i","c","prototype","Generator","u","Object","create","_regeneratorDefine2","f","p","y","G","v","a","d","bind","length","l","TypeError","call","done","value","GeneratorFunction","GeneratorFunctionPrototype","getPrototypeOf","setPrototypeOf","__proto__","displayName","w","m","defineProperty","_regeneratorDefine","_invoke","enumerable","configurable","writable","ownKeys","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","push","apply","_objectSpread","arguments","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","_toPropertyKey","asyncGeneratorStep","Promise","resolve","then","_asyncToGenerator","_next","_throw","_classCallCheck","_defineProperties","key","_createClass","_toPrimitive","_typeof","toPrimitive","String","Number","_callSuper","_getPrototypeOf","_possibleConstructorReturn","_isNativeReflectConstruct","Reflect","construct","constructor","_assertThisInitialized","ReferenceError","Boolean","valueOf","_inherits","_setPrototypeOf","REGISTRY_DOMAIN","exports","ProxyAudit","_pluginUtils$Plugin","config","options","_config$timeout","_this","enabled","strict_ssl","undefined","timeout","logger","register_middlewares","app","auth","_this2","fetchAudit","_ref","_callee","req","res","_auth$config","headers","requestOptions","_auth$config2","agent","auditEndpoint","controller","response","_t","_t2","_t3","_t4","_t5","_context","https","Agent","rejectUnauthorized","body","JSON","stringify","method","https_proxy","createHttpsProxyAgent","assign","concat","baseUrl","route","path","debug","AbortController","setTimeout","abort","fetch","signal","ok","status","json","send","warn","end","_x","_x2","handleAudit","_ref2","_callee2","_context2","_x3","_x4","router","express","Router","post","limit","use","pluginUtils","Plugin"],"sources":["../src/audit.ts"],"sourcesContent":["import express, { type Express, type Request, type Response } from 'express';\nimport createHttpsProxyAgent from 'https-proxy-agent';\nimport fetch from 'node-fetch';\nimport https from 'node:https';\n\nimport type { Auth } from '@verdaccio/auth';\nimport { pluginUtils } from '@verdaccio/core';\nimport type { Logger } from '@verdaccio/types';\n\nimport type { ConfigAudit } from './types';\n\n// FUTURE: we should be able to overwrite this\nexport const REGISTRY_DOMAIN = 'https://registry.npmjs.org';\n\nexport default class ProxyAudit\n extends pluginUtils.Plugin<ConfigAudit>\n implements pluginUtils.ExpressMiddleware<ConfigAudit, {}, Auth>\n{\n public enabled: boolean;\n public logger: Logger;\n public strict_ssl: boolean;\n public timeout: number;\n\n public constructor(config: ConfigAudit, options: pluginUtils.PluginOptions) {\n super(config, options);\n this.enabled = config.enabled || false;\n this.strict_ssl = config.strict_ssl !== undefined ? config.strict_ssl : true;\n this.timeout = config.timeout ?? 1000 * 60 * 1;\n this.logger = options.logger;\n }\n\n public register_middlewares(app: Express, auth: Auth): void {\n const fetchAudit = async (\n req: Request,\n res: Response & { report_error?: Function }\n ): Promise<void> => {\n const headers = req.headers;\n\n headers['host'] = 'registry.npmjs.org';\n headers['content-encoding'] = 'gzip,deflate,br';\n\n let requestOptions: any = {\n agent: new https.Agent({ rejectUnauthorized: this.strict_ssl }),\n body: JSON.stringify(req.body),\n headers,\n method: req.method,\n };\n\n if (auth?.config?.https_proxy) {\n // we should check whether this works fine after this migration\n // please notify if anyone is having issues\n const agent = createHttpsProxyAgent(auth?.config?.https_proxy);\n requestOptions = Object.assign({}, requestOptions, {\n agent,\n });\n }\n\n try {\n const auditEndpoint = `${REGISTRY_DOMAIN}${req.baseUrl}${req.route.path}`;\n this.logger.debug('fetching audit from ' + auditEndpoint);\n\n const controller = new AbortController();\n\n setTimeout(\n () => controller.abort(`Fetch ${auditEndpoint} timeout ${this.timeout}ms`),\n this.timeout\n );\n\n const response = await fetch(auditEndpoint, {\n ...requestOptions,\n signal: controller.signal,\n });\n\n if (response.ok) {\n res.status(response.status).send(await response.json());\n } else {\n this.logger.warn('could not fetch audit: ' + JSON.stringify(await response.json()));\n res.status(response.status).end();\n }\n } catch (error) {\n this.logger.warn('could not fetch audit: ' + error);\n res.status(500).end();\n }\n };\n\n const handleAudit = async (req: Request, res: Response): Promise<void> => {\n if (this.enabled) {\n await fetchAudit(req, res);\n } else {\n res.status(500).end();\n }\n };\n\n const router = express.Router();\n\n router.post('/audits', express.json({ limit: '10mb' }), handleAudit);\n router.post('/audits/quick', express.json({ limit: '10mb' }), handleAudit);\n\n router.post('/advisories/bulk', express.json({ limit: '10mb' }), handleAudit);\n\n app.use('/-/npm/v1/security', router);\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,UAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAGA,IAAAI,KAAA,GAAAJ,OAAA;AAA8C,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,gBAAAA,CAAA;AAAA,SAAAE,aAAA,IAL9C,uKAAAF,CAAA,EAAAG,CAAA,EAAAC,CAAA,wBAAAC,MAAA,GAAAA,MAAA,OAAAC,CAAA,GAAAF,CAAA,CAAAG,QAAA,kBAAAC,CAAA,GAAAJ,CAAA,CAAAK,WAAA,8BAAAC,EAAAN,CAAA,EAAAE,CAAA,EAAAE,CAAA,EAAAE,CAAA,QAAAC,CAAA,GAAAL,CAAA,IAAAA,CAAA,CAAAM,SAAA,YAAAC,SAAA,GAAAP,CAAA,GAAAO,SAAA,EAAAC,CAAA,GAAAC,MAAA,CAAAC,MAAA,CAAAL,CAAA,CAAAC,SAAA,UAAAK,mBAAA,CAAA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"sourcesContent":["import express, { type Express, type Request, type Response } from 'express';\nimport createHttpsProxyAgent from 'https-proxy-agent';\nimport fetch from 'node-fetch';\nimport https from 'node:https';\n\nimport type { Auth } from '@verdaccio/auth';\nimport { pluginUtils } from '@verdaccio/core';\nimport type { Logger } from '@verdaccio/types';\n\nimport type { ConfigAudit } from './types';\n\n// FUTURE: we should be able to overwrite this\nexport const REGISTRY_DOMAIN = 'https://registry.npmjs.org';\n\nexport default class ProxyAudit\n extends pluginUtils.Plugin<ConfigAudit>\n implements pluginUtils.ExpressMiddleware<ConfigAudit, {}, Auth>\n{\n public enabled: boolean;\n public logger: Logger;\n public strict_ssl: boolean;\n public timeout: number;\n\n public constructor(config: ConfigAudit, options: pluginUtils.PluginOptions) {\n super(config, options);\n this.enabled = config.enabled || false;\n this.strict_ssl = config.strict_ssl !== undefined ? config.strict_ssl : true;\n this.timeout = config.timeout ?? 1000 * 60 * 1;\n this.logger = options.logger;\n }\n\n public register_middlewares(app: Express, auth: Auth): void {\n const fetchAudit = async (\n req: Request,\n res: Response & { report_error?: Function }\n ): Promise<void> => {\n const headers = req.headers;\n\n headers['host'] = 'registry.npmjs.org';\n headers['content-encoding'] = 'gzip,deflate,br';\n\n let requestOptions: any = {\n agent: new https.Agent({ rejectUnauthorized: this.strict_ssl }),\n body: JSON.stringify(req.body),\n headers,\n method: req.method,\n };\n\n if (auth?.config?.https_proxy) {\n // we should check whether this works fine after this migration\n // please notify if anyone is having issues\n const agent = createHttpsProxyAgent(auth?.config?.https_proxy);\n requestOptions = Object.assign({}, requestOptions, {\n agent,\n });\n }\n\n try {\n const auditEndpoint = `${REGISTRY_DOMAIN}${req.baseUrl}${req.route.path}`;\n this.logger.debug('fetching audit from ' + auditEndpoint);\n\n const controller = new AbortController();\n\n setTimeout(\n () => controller.abort(`Fetch ${auditEndpoint} timeout ${this.timeout}ms`),\n this.timeout\n );\n\n const response = await fetch(auditEndpoint, {\n ...requestOptions,\n signal: controller.signal,\n });\n\n if (response.ok) {\n res.status(response.status).send(await response.json());\n } else {\n this.logger.warn('could not fetch audit: ' + JSON.stringify(await response.json()));\n res.status(response.status).end();\n }\n } catch (error) {\n this.logger.warn('could not fetch audit: ' + error);\n res.status(500).end();\n }\n };\n\n const handleAudit = async (req: Request, res: Response): Promise<void> => {\n if (this.enabled) {\n await fetchAudit(req, res);\n } else {\n res.status(500).end();\n }\n };\n\n const router = express.Router();\n\n router.post('/audits', express.json({ limit: '10mb' }), handleAudit);\n router.post('/audits/quick', express.json({ limit: '10mb' }), handleAudit);\n\n router.post('/advisories/bulk', express.json({ limit: '10mb' }), handleAudit);\n\n app.use('/-/npm/v1/security', router);\n }\n}\n"],"mappings":";;;;;;;;;;;AAYA,IAAa,kBAAkB;AAE/B,IAAqB,aAArB,cACU,gBAAA,YAAY,OAEtB;CACE;CACA;CACA;CACA;CAEA,YAAmB,QAAqB,SAAoC;EAC1E,MAAM,QAAQ,OAAO;EACrB,KAAK,UAAU,OAAO,WAAW;EACjC,KAAK,aAAa,OAAO,eAAe,KAAA,IAAY,OAAO,aAAa;EACxE,KAAK,UAAU,OAAO,WAAW,MAAO,KAAK;EAC7C,KAAK,SAAS,QAAQ;CACxB;CAEA,qBAA4B,KAAc,MAAkB;EAC1D,MAAM,aAAa,OACjB,KACA,QACkB;GAClB,MAAM,UAAU,IAAI;GAEpB,QAAQ,UAAU;GAClB,QAAQ,sBAAsB;GAE9B,IAAI,iBAAsB;IACxB,OAAO,IAAI,WAAA,QAAM,MAAM,EAAE,oBAAoB,KAAK,WAAW,CAAC;IAC9D,MAAM,KAAK,UAAU,IAAI,IAAI;IAC7B;IACA,QAAQ,IAAI;GACd;GAEA,IAAI,MAAM,QAAQ,aAAa;IAG7B,MAAM,SAAA,GAAA,kBAAA,SAA8B,MAAM,QAAQ,WAAW;IAC7D,iBAAiB,OAAO,OAAO,CAAC,GAAG,gBAAgB,EACjD,MACF,CAAC;GACH;GAEA,IAAI;IACF,MAAM,gBAAgB,GAAG,kBAAkB,IAAI,UAAU,IAAI,MAAM;IACnE,KAAK,OAAO,MAAM,yBAAyB,aAAa;IAExD,MAAM,aAAa,IAAI,gBAAgB;IAEvC,iBACQ,WAAW,MAAM,SAAS,cAAc,WAAW,KAAK,QAAQ,GAAG,GACzE,KAAK,OACP;IAEA,MAAM,WAAW,OAAA,GAAA,WAAA,SAAY,eAAe;KAC1C,GAAG;KACH,QAAQ,WAAW;IACrB,CAAC;IAED,IAAI,SAAS,IACX,IAAI,OAAO,SAAS,MAAM,EAAE,KAAK,MAAM,SAAS,KAAK,CAAC;SACjD;KACL,KAAK,OAAO,KAAK,4BAA4B,KAAK,UAAU,MAAM,SAAS,KAAK,CAAC,CAAC;KAClF,IAAI,OAAO,SAAS,MAAM,EAAE,IAAI;IAClC;GACF,SAAS,OAAO;IACd,KAAK,OAAO,KAAK,4BAA4B,KAAK;IAClD,IAAI,OAAO,GAAG,EAAE,IAAI;GACtB;EACF;EAEA,MAAM,cAAc,OAAO,KAAc,QAAiC;GACxE,IAAI,KAAK,SACP,MAAM,WAAW,KAAK,GAAG;QAEzB,IAAI,OAAO,GAAG,EAAE,IAAI;EAExB;EAEA,MAAM,SAAS,QAAA,QAAQ,OAAO;EAE9B,OAAO,KAAK,WAAW,QAAA,QAAQ,KAAK,EAAE,OAAO,OAAO,CAAC,GAAG,WAAW;EACnE,OAAO,KAAK,iBAAiB,QAAA,QAAQ,KAAK,EAAE,OAAO,OAAO,CAAC,GAAG,WAAW;EAEzE,OAAO,KAAK,oBAAoB,QAAA,QAAQ,KAAK,EAAE,OAAO,OAAO,CAAC,GAAG,WAAW;EAE5E,IAAI,IAAI,sBAAsB,MAAM;CACtC;AACF"}
@@ -0,0 +1,68 @@
1
+ import express from "express";
2
+ import createHttpsProxyAgent from "https-proxy-agent";
3
+ import fetch from "node-fetch";
4
+ import https from "node:https";
5
+ import { pluginUtils } from "@verdaccio/core";
6
+ //#region src/audit.ts
7
+ var REGISTRY_DOMAIN = "https://registry.npmjs.org";
8
+ var ProxyAudit = class extends pluginUtils.Plugin {
9
+ enabled;
10
+ logger;
11
+ strict_ssl;
12
+ timeout;
13
+ constructor(config, options) {
14
+ super(config, options);
15
+ this.enabled = config.enabled || false;
16
+ this.strict_ssl = config.strict_ssl !== void 0 ? config.strict_ssl : true;
17
+ this.timeout = config.timeout ?? 1e3 * 60 * 1;
18
+ this.logger = options.logger;
19
+ }
20
+ register_middlewares(app, auth) {
21
+ const fetchAudit = async (req, res) => {
22
+ const headers = req.headers;
23
+ headers["host"] = "registry.npmjs.org";
24
+ headers["content-encoding"] = "gzip,deflate,br";
25
+ let requestOptions = {
26
+ agent: new https.Agent({ rejectUnauthorized: this.strict_ssl }),
27
+ body: JSON.stringify(req.body),
28
+ headers,
29
+ method: req.method
30
+ };
31
+ if (auth?.config?.https_proxy) {
32
+ const agent = createHttpsProxyAgent(auth?.config?.https_proxy);
33
+ requestOptions = Object.assign({}, requestOptions, { agent });
34
+ }
35
+ try {
36
+ const auditEndpoint = `${REGISTRY_DOMAIN}${req.baseUrl}${req.route.path}`;
37
+ this.logger.debug("fetching audit from " + auditEndpoint);
38
+ const controller = new AbortController();
39
+ setTimeout(() => controller.abort(`Fetch ${auditEndpoint} timeout ${this.timeout}ms`), this.timeout);
40
+ const response = await fetch(auditEndpoint, {
41
+ ...requestOptions,
42
+ signal: controller.signal
43
+ });
44
+ if (response.ok) res.status(response.status).send(await response.json());
45
+ else {
46
+ this.logger.warn("could not fetch audit: " + JSON.stringify(await response.json()));
47
+ res.status(response.status).end();
48
+ }
49
+ } catch (error) {
50
+ this.logger.warn("could not fetch audit: " + error);
51
+ res.status(500).end();
52
+ }
53
+ };
54
+ const handleAudit = async (req, res) => {
55
+ if (this.enabled) await fetchAudit(req, res);
56
+ else res.status(500).end();
57
+ };
58
+ const router = express.Router();
59
+ router.post("/audits", express.json({ limit: "10mb" }), handleAudit);
60
+ router.post("/audits/quick", express.json({ limit: "10mb" }), handleAudit);
61
+ router.post("/advisories/bulk", express.json({ limit: "10mb" }), handleAudit);
62
+ app.use("/-/npm/v1/security", router);
63
+ }
64
+ };
65
+ //#endregion
66
+ export { ProxyAudit as default };
67
+
68
+ //# sourceMappingURL=audit.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit.mjs","names":[],"sources":["../src/audit.ts"],"sourcesContent":["import express, { type Express, type Request, type Response } from 'express';\nimport createHttpsProxyAgent from 'https-proxy-agent';\nimport fetch from 'node-fetch';\nimport https from 'node:https';\n\nimport type { Auth } from '@verdaccio/auth';\nimport { pluginUtils } from '@verdaccio/core';\nimport type { Logger } from '@verdaccio/types';\n\nimport type { ConfigAudit } from './types';\n\n// FUTURE: we should be able to overwrite this\nexport const REGISTRY_DOMAIN = 'https://registry.npmjs.org';\n\nexport default class ProxyAudit\n extends pluginUtils.Plugin<ConfigAudit>\n implements pluginUtils.ExpressMiddleware<ConfigAudit, {}, Auth>\n{\n public enabled: boolean;\n public logger: Logger;\n public strict_ssl: boolean;\n public timeout: number;\n\n public constructor(config: ConfigAudit, options: pluginUtils.PluginOptions) {\n super(config, options);\n this.enabled = config.enabled || false;\n this.strict_ssl = config.strict_ssl !== undefined ? config.strict_ssl : true;\n this.timeout = config.timeout ?? 1000 * 60 * 1;\n this.logger = options.logger;\n }\n\n public register_middlewares(app: Express, auth: Auth): void {\n const fetchAudit = async (\n req: Request,\n res: Response & { report_error?: Function }\n ): Promise<void> => {\n const headers = req.headers;\n\n headers['host'] = 'registry.npmjs.org';\n headers['content-encoding'] = 'gzip,deflate,br';\n\n let requestOptions: any = {\n agent: new https.Agent({ rejectUnauthorized: this.strict_ssl }),\n body: JSON.stringify(req.body),\n headers,\n method: req.method,\n };\n\n if (auth?.config?.https_proxy) {\n // we should check whether this works fine after this migration\n // please notify if anyone is having issues\n const agent = createHttpsProxyAgent(auth?.config?.https_proxy);\n requestOptions = Object.assign({}, requestOptions, {\n agent,\n });\n }\n\n try {\n const auditEndpoint = `${REGISTRY_DOMAIN}${req.baseUrl}${req.route.path}`;\n this.logger.debug('fetching audit from ' + auditEndpoint);\n\n const controller = new AbortController();\n\n setTimeout(\n () => controller.abort(`Fetch ${auditEndpoint} timeout ${this.timeout}ms`),\n this.timeout\n );\n\n const response = await fetch(auditEndpoint, {\n ...requestOptions,\n signal: controller.signal,\n });\n\n if (response.ok) {\n res.status(response.status).send(await response.json());\n } else {\n this.logger.warn('could not fetch audit: ' + JSON.stringify(await response.json()));\n res.status(response.status).end();\n }\n } catch (error) {\n this.logger.warn('could not fetch audit: ' + error);\n res.status(500).end();\n }\n };\n\n const handleAudit = async (req: Request, res: Response): Promise<void> => {\n if (this.enabled) {\n await fetchAudit(req, res);\n } else {\n res.status(500).end();\n }\n };\n\n const router = express.Router();\n\n router.post('/audits', express.json({ limit: '10mb' }), handleAudit);\n router.post('/audits/quick', express.json({ limit: '10mb' }), handleAudit);\n\n router.post('/advisories/bulk', express.json({ limit: '10mb' }), handleAudit);\n\n app.use('/-/npm/v1/security', router);\n }\n}\n"],"mappings":";;;;;;AAYA,IAAa,kBAAkB;AAE/B,IAAqB,aAArB,cACU,YAAY,OAEtB;CACE;CACA;CACA;CACA;CAEA,YAAmB,QAAqB,SAAoC;EAC1E,MAAM,QAAQ,OAAO;EACrB,KAAK,UAAU,OAAO,WAAW;EACjC,KAAK,aAAa,OAAO,eAAe,KAAA,IAAY,OAAO,aAAa;EACxE,KAAK,UAAU,OAAO,WAAW,MAAO,KAAK;EAC7C,KAAK,SAAS,QAAQ;CACxB;CAEA,qBAA4B,KAAc,MAAkB;EAC1D,MAAM,aAAa,OACjB,KACA,QACkB;GAClB,MAAM,UAAU,IAAI;GAEpB,QAAQ,UAAU;GAClB,QAAQ,sBAAsB;GAE9B,IAAI,iBAAsB;IACxB,OAAO,IAAI,MAAM,MAAM,EAAE,oBAAoB,KAAK,WAAW,CAAC;IAC9D,MAAM,KAAK,UAAU,IAAI,IAAI;IAC7B;IACA,QAAQ,IAAI;GACd;GAEA,IAAI,MAAM,QAAQ,aAAa;IAG7B,MAAM,QAAQ,s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figAudit };
2
+ import type { ConfigAudit } from './types';
3
+ export type { ConfigAudit };
4
4
  export default AuditPlugin;
package/build/index.js CHANGED
@@ -1,17 +1,10 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "ConfigAudit", {
7
- enumerable: true,
8
- get: function get() {
9
- return _types.ConfigAudit;
10
- }
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
11
4
  });
12
- exports["default"] = void 0;
13
- var _audit = _interopRequireDefault(require("./audit"));
14
- var _types = require("./types");
15
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
16
- var _default = exports["default"] = _audit["default"];
5
+ //#region src/index.ts
6
+ var src_default = require("./audit.js").default;
7
+ //#endregion
8
+ exports.default = src_default;
9
+
17
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_audit","_interopRequireDefault","require","_types","e","__esModule","_default","exports","AuditPlugin"],"sources":["../src/index.ts"],"sourcesContent":["import AuditPlugin from './audit';\nimport { ConfigAudit } from './types';\n\nexport { ConfigAudit };\n\nexport default AuditPlugin;\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAAsC,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,gBAAAA,CAAA;AAAA,IAAAE,QAAA,GAAAC,OAAA,cAIvBC,iBAAW","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import AuditPlugin from './audit';\nimport type { ConfigAudit } from './types';\n\nexport type { ConfigAudit };\n\nexport default AuditPlugin;\n"],"mappings":";;;;;AAKA,IAAA,kCAAe,EAAA"}
@@ -0,0 +1,7 @@
1
+ import ProxyAudit from "./audit.mjs";
2
+ //#region src/index.ts
3
+ var src_default = ProxyAudit;
4
+ //#endregion
5
+ export { src_default as default };
6
+
7
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import AuditPlugin from './audit';\nimport type { ConfigAudit } from './types';\n\nexport type { ConfigAudit };\n\nexport default AuditPlugin;\n"],"mappings":";;AAKA,IAAA,cAAe"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verdaccio-audit",
3
- "version": "13.0.5",
3
+ "version": "13.1.0",
4
4
  "description": "Verdaccio Middleware plugin to bypass npmjs audit",
5
5
  "keywords": [
6
6
  "enterprise",
@@ -28,33 +28,46 @@
28
28
  "type": "opencollective",
29
29
  "url": "https://opencollective.com/verdaccio"
30
30
  },
31
- "main": "build/index.js",
32
- "types": "build/index.d.ts",
31
+ "main": "./build/index.js",
32
+ "module": "./build/index.mjs",
33
+ "types": "./build/index.d.ts",
34
+ "exports": {
35
+ ".": {
36
+ "import": {
37
+ "types": "./build/index.d.ts",
38
+ "default": "./build/index.mjs"
39
+ },
40
+ "require": {
41
+ "types": "./build/index.d.ts",
42
+ "default": "./build/index.js"
43
+ }
44
+ },
45
+ "./build/*": "./build/*"
46
+ },
33
47
  "dependencies": {
34
- "@verdaccio/config": "8.1.4",
35
- "@verdaccio/core": "8.1.4",
48
+ "@verdaccio/config": "8.2.0",
49
+ "@verdaccio/core": "8.2.0",
36
50
  "express": "4.22.1",
37
51
  "https-proxy-agent": "5.0.1",
38
52
  "node-fetch": "cjs"
39
53
  },
40
54
  "devDependencies": {
41
- "@verdaccio/auth": "8.0.6",
42
- "@verdaccio/logger": "8.0.5",
55
+ "@verdaccio/auth": "8.1.0",
56
+ "@verdaccio/logger": "8.1.0",
43
57
  "@verdaccio/types": "13.0.5",
44
58
  "nock": "13.5.6",
45
59
  "supertest": "7.1.4",
60
+ "vite": "8.0.16",
46
61
  "vitest": "4.1.2"
47
62
  },
48
63
  "engines": {
49
- "node": ">=18"
64
+ "node": ">=22"
50
65
  },
51
66
  "scripts": {
52
67
  "clean": "rimraf ./build",
53
68
  "type-check": "tsc --noEmit -p tsconfig.build.json",
54
- "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
55
- "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
56
- "build": "pnpm run build:js && pnpm run build:types",
57
- "watch": "pnpm build:js -- --watch",
69
+ "build": "vite build && tsc --emitDeclarationOnly -p tsconfig.build.json",
70
+ "watch": "vite build --watch",
58
71
  "test": "vitest run"
59
72
  }
60
73
  }
package/build/types.js DELETED
@@ -1,6 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["export interface ConfigAudit {\n enabled: boolean;\n max_body?: string;\n strict_ssl?: boolean;\n timeout?: number;\n}\n"],"mappings":"","ignoreList":[]}