Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

backtrace-service

Package Overview
Dependencies
Maintainers
6
Versions
153
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backtrace-service - npm Package Compare versions

Comparing version 3.0.5 to 3.0.6

17

lib/config/config.js
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;

@@ -13,2 +25,3 @@ };

Object.defineProperty(exports, "__esModule", { value: true });
exports.getDescriptor = exports.getCoronerConfig = exports.listenDescriptor = void 0;
var crypto_1 = require("crypto");

@@ -15,0 +28,0 @@ var fs = __importStar(require("fs"));

5

lib/identity/identity.d.ts

@@ -1,2 +0,1 @@

/// <reference types="qs" />
import { NextFunction, Request, Response } from 'express';

@@ -20,3 +19,3 @@ import { IServiceDescriptor } from '../model/serviceDescriptor';

}): void;
serviceRequest(opts?: ICoronerRequestOption): ((request: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs>, response: Response<any>, next: NextFunction) => void)[];
serviceRequest(opts?: ICoronerRequestOption): ((request: Request, response: Response, next: NextFunction) => void)[];
/**

@@ -28,3 +27,3 @@ * Generate a middleware for Express.js, which authenticates a request given

*/
authenticateRequest(): (request: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs>, response: Response<any>, next: NextFunction) => Promise<void>;
authenticateRequest(): (request: Request, response: Response, next: NextFunction) => Promise<void>;
/**

@@ -31,0 +30,0 @@ * This assumes route has already passed authentication through authenticateRequest

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -41,10 +60,4 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.IdentityManager = void 0;
var axios_1 = __importDefault(require("axios"));

@@ -183,6 +196,6 @@ var body_parser_1 = __importDefault(require("body-parser"));

IdentityManager.prototype.checkProjectAccess = function (request, response, projects) {
var _a, _b, _c, _d, _e, _f, _g;
var _a, _b, _c, _d, _e;
var authRequest = request;
var universe = (_c = (_b = (_a = authRequest) === null || _a === void 0 ? void 0 : _a.coronerAuth) === null || _b === void 0 ? void 0 : _b.cfg) === null || _c === void 0 ? void 0 : _c.universe;
var projectsExt = universe && ((_g = (_f = (_e = (_d = authRequest) === null || _d === void 0 ? void 0 : _d.coronerAuth) === null || _e === void 0 ? void 0 : _e.cfg) === null || _f === void 0 ? void 0 : _f.universes[universe.name]) === null || _g === void 0 ? void 0 : _g.projects_ext);
var universe = (_b = (_a = authRequest === null || authRequest === void 0 ? void 0 : authRequest.coronerAuth) === null || _a === void 0 ? void 0 : _a.cfg) === null || _b === void 0 ? void 0 : _b.universe;
var projectsExt = universe && ((_e = (_d = (_c = authRequest === null || authRequest === void 0 ? void 0 : authRequest.coronerAuth) === null || _c === void 0 ? void 0 : _c.cfg) === null || _d === void 0 ? void 0 : _d.universes[universe.name]) === null || _e === void 0 ? void 0 : _e.projects_ext);
if (!projectsExt) {

@@ -189,0 +202,0 @@ this.log('debug', "missing projects_ext");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var identity_1 = require("./identity/identity");
exports.IdentityManager = identity_1.IdentityManager;
Object.defineProperty(exports, "IdentityManager", { enumerable: true, get: function () { return identity_1.IdentityManager; } });
/**

@@ -9,3 +9,3 @@ * Metrics

var metricsStorage_1 = require("./metrics/metricsStorage");
exports.MetricsStorage = metricsStorage_1.MetricsStorage;
Object.defineProperty(exports, "MetricsStorage", { enumerable: true, get: function () { return metricsStorage_1.MetricsStorage; } });
/**

@@ -15,3 +15,3 @@ * Logging

var logger_1 = require("./log/logger");
exports.Logger = logger_1.Logger;
Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return logger_1.Logger; } });
/**

@@ -21,6 +21,6 @@ * Helpers

var backtraceUniverseHelper_1 = require("./universe/backtraceUniverseHelper");
exports.UniverseHelper = backtraceUniverseHelper_1.UniverseHelper;
Object.defineProperty(exports, "UniverseHelper", { enumerable: true, get: function () { return backtraceUniverseHelper_1.UniverseHelper; } });
var config_1 = require("./config/config");
exports.getDescriptor = config_1.getDescriptor;
exports.listenDescriptor = config_1.listenDescriptor;
Object.defineProperty(exports, "getDescriptor", { enumerable: true, get: function () { return config_1.getDescriptor; } });
Object.defineProperty(exports, "listenDescriptor", { enumerable: true, get: function () { return config_1.listenDescriptor; } });
/**

@@ -30,7 +30,7 @@ * Backtrace service initialization methods

var backtraceService_1 = require("./service/backtraceService");
exports.BacktraceService = backtraceService_1.BacktraceService;
Object.defineProperty(exports, "BacktraceService", { enumerable: true, get: function () { return backtraceService_1.BacktraceService; } });
var serviceConfiguration_1 = require("./service/serviceConfiguration");
exports.ServiceConfiguration = serviceConfiguration_1.ServiceConfiguration;
Object.defineProperty(exports, "ServiceConfiguration", { enumerable: true, get: function () { return serviceConfiguration_1.ServiceConfiguration; } });
var apiError_1 = require("./model/apiError");
exports.ApiError = apiError_1.ApiError;
Object.defineProperty(exports, "ApiError", { enumerable: true, get: function () { return apiError_1.ApiError; } });
//# sourceMappingURL=index.js.map
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Logger = void 0;
var backtrace_node_1 = require("backtrace-node");

@@ -11,0 +24,0 @@ var winston_1 = __importStar(require("winston"));

@@ -42,2 +42,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.MetricsStorage = void 0;
var axios_1 = __importDefault(require("axios"));

@@ -50,3 +51,2 @@ var os_1 = __importDefault(require("os"));

if (logger === void 0) { logger = logger_1.Logger.getLogger(); }
var _a;
this.uuid = uuid;

@@ -74,3 +74,3 @@ this.secret = secret;

}
if (app && ((_a = opts) === null || _a === void 0 ? void 0 : _a.disableExpressMetrics) !== true) {
if (app && (opts === null || opts === void 0 ? void 0 : opts.disableExpressMetrics) !== true) {
app.use(function (req, res, next) { return _this.registerRequestLatency(req, res, next); });

@@ -77,0 +77,0 @@ }

@@ -16,2 +16,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiError = void 0;
var ApiError = /** @class */ (function (_super) {

@@ -18,0 +19,0 @@ __extends(ApiError, _super);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ResponseResult = void 0;
var ResponseResult = /** @class */ (function () {

@@ -4,0 +5,0 @@ function ResponseResult(msg, status) {

@@ -6,2 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.BacktraceService = void 0;
var argparse_1 = require("argparse");

@@ -23,3 +24,3 @@ var body_parser_1 = require("body-parser");

function BacktraceService(name, port, _opts) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
this.name = name;

@@ -29,5 +30,5 @@ this.port = port;

this.coronerdAddress = new Set();
this.app = ((_a = _opts) === null || _a === void 0 ? void 0 : _a.app) ? _opts.app : express_1.default();
this.initializeDefaultArgParser((_b = this._opts) === null || _b === void 0 ? void 0 : _b.serviceMutation);
this.configuration = BacktraceService.readConfiguration(this.name, this.port, ((_c = this.arguments) === null || _c === void 0 ? void 0 : _c.configuration) || ((_d = this._opts) === null || _d === void 0 ? void 0 : _d.confPath), false);
this.app = (_opts === null || _opts === void 0 ? void 0 : _opts.app) ? _opts.app : express_1.default();
this.initializeDefaultArgParser((_a = this._opts) === null || _a === void 0 ? void 0 : _a.serviceMutation);
this.configuration = BacktraceService.readConfiguration(this.name, this.port, ((_b = this.arguments) === null || _b === void 0 ? void 0 : _b.configuration) || ((_c = this._opts) === null || _c === void 0 ? void 0 : _c.confPath), false);
this.apiPrefix = this.configuration.descriptor

@@ -52,7 +53,7 @@ ? this.configuration.descriptor.resource

*/
var _l = this.getMetricsSecret(), uuid = _l.uuid, secret = _l.secret;
var _k = this.getMetricsSecret(), uuid = _k.uuid, secret = _k.secret;
this.metrics = new metricsStorage_1.MetricsStorage(uuid, secret, {
interval: (_f = (_e = this.configuration) === null || _e === void 0 ? void 0 : _e.metrics) === null || _f === void 0 ? void 0 : _f.interval,
hostUrl: (_h = (_g = this.configuration) === null || _g === void 0 ? void 0 : _g.metrics) === null || _h === void 0 ? void 0 : _h.hostUrl,
disableExpressMetrics: (_k = (_j = this.configuration) === null || _j === void 0 ? void 0 : _j.metrics) === null || _k === void 0 ? void 0 : _k.disableExpressMetrics,
interval: (_e = (_d = this.configuration) === null || _d === void 0 ? void 0 : _d.metrics) === null || _e === void 0 ? void 0 : _e.interval,
hostUrl: (_g = (_f = this.configuration) === null || _f === void 0 ? void 0 : _f.metrics) === null || _g === void 0 ? void 0 : _g.hostUrl,
disableExpressMetrics: (_j = (_h = this.configuration) === null || _h === void 0 ? void 0 : _h.metrics) === null || _j === void 0 ? void 0 : _j.disableExpressMetrics,
}, this.app, this._logger);

@@ -72,3 +73,3 @@ this.prepareServiceLayer();

},
enumerable: true,
enumerable: false,
configurable: true

@@ -150,4 +151,3 @@ });

app.get(prefix ? prefix : '/', function (_req, res) {
var _a;
(_a = identityManager) === null || _a === void 0 ? void 0 : _a.bypassProjectAccessCheck(res);
identityManager === null || identityManager === void 0 ? void 0 : identityManager.bypassProjectAccessCheck(res);
res.type('xml');

@@ -193,3 +193,2 @@ res.status(200).send("<html></html>");

app.use(function (req, res, next) {
var _a;
// prevent overriding headers.

@@ -199,3 +198,3 @@ if (res.headersSent) {

}
(_a = identityManager) === null || _a === void 0 ? void 0 : _a.bypassProjectAccessCheck(res);
identityManager === null || identityManager === void 0 ? void 0 : identityManager.bypassProjectAccessCheck(res);
// response json might be required by front-end

@@ -212,6 +211,7 @@ res.status(404).send({

BacktraceService.setupAuth = function (app) {
app.use(cors_1.default({
var corsSettings = cors_1.default({
exposedHeaders: ['service-version', 'bt-service-version'],
}));
app.options('*', cors_1.default());
});
app.use(corsSettings);
app.options('*', corsSettings);
app.use(nocache_1.default());

@@ -218,0 +218,0 @@ app.use(helmet_1.default({

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.projectValidation = exports.check = exports.setInvalid = exports.setValid = void 0;
function setValid(res) {

@@ -4,0 +5,0 @@ res.projectValidated = true;

@@ -6,2 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.ServiceConfiguration = void 0;
var fs_1 = __importDefault(require("fs"));

@@ -8,0 +9,0 @@ var path_1 = __importDefault(require("path"));

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UniverseHelper = void 0;
var url = __importStar(require("url"));

@@ -11,0 +24,0 @@ /**

{
"name": "backtrace-service",
"version": "3.0.5",
"version": "3.0.6",
"description": "Common tools for Backtrace Node services",

@@ -48,3 +48,3 @@ "author": "Backtrace",

"argparse": "^1.0.10",
"axios": "^0.19.0",
"axios": "^0.21.1",
"backtrace-node": "^1.0.5",

@@ -58,3 +58,2 @@ "body-parser": "^1.19.0",

"nocache": "^2.1.0",
"tslint": "^6.1.2",
"winston": "^3.2.1"

@@ -68,3 +67,3 @@ },

"@types/helmet": "0.0.43",
"@types/jest": "^24.0.11",
"@types/jest": "^26.0.20",
"@types/mkdirp": "^0.5.2",

@@ -74,3 +73,3 @@ "@types/nock": "^9.3.1",

"@types/supertest": "^2.0.10",
"jest": "^24.7.1",
"jest": "^26.6.3",
"minimist": "^1.2.5",

@@ -80,5 +79,6 @@ "nock": "^10.0.6",

"supertest": "^4.0.2",
"ts-jest": "^24.0.2",
"ts-jest": "^26.5.2",
"tslint": "^6.1.2",
"typescript": "^3.7.3"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc