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

fabric8-analytics-lsp-server

Package Overview
Dependencies
Maintainers
1
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fabric8-analytics-lsp-server - npm Package Compare versions

Comparing version 0.1.48 to 0.1.49

2

json.js

@@ -97,3 +97,3 @@ /* --------------------------------------------------------------------------------------------

print() {
console.log(this.properties);
// console.log(this.properties);
this.children.forEach((scope) => { scope.print(); });

@@ -100,0 +100,0 @@ }

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

{"name":"fabric8-analytics-lsp-server","description":"LSP Server for Dependency Analytics","version":"0.1.48","author":"Pavel Odvody","contributors":[{"name":"Michal Srb","email":"michal@redhat.com"},{"name":"Jyasveer Gotta","email":"jgotta@redhat.com"},{"name":"Jaivardhan Kumar","email":"jakumar@redhat.com"}],"license":"Apache-2.0","engines":{"node":"*"},"keywords":["fabric8-analytics","LSP"],"repository":{"type":"git","url":"https://github.com/fabric8-analytics/fabric8-analytics-lsp-server.git"},"dependencies":{"request":"^2.79.0","stream-json":"0.4.2","vscode-languageserver":"^4.1.3","winston":"2.3.1","xml2object":"0.1.2"},"devDependencies":{"@types/node":"^6.0.52","@krux/condition-jenkins":"1.0.1","semantic-release":"8.2.0","typescript":"^2.1.4"},"scripts":{"build":"npm run clean && node node_modules/typescript/bin/tsc -p . && cp LICENSE package.json README.md output && npm run dist","clean":"rm -Rf ca-lsp-server.tar output/","dist":"cp -r node_modules output/ && cp ./package.json output/ && node -p -e \"require('./package.json').version\" > output/VERSION && rm -rf output/node_modules/typescript/ && tar cvjf ca-lsp-server.tar -C output/ .","semantic-release":"semantic-release pre && npm run build && cp -r .git output && npm publish output/ && semantic-release post"},"release":{"branch":"master","debug":false,"verifyConditions":{"path":"./node_modules/@krux/condition-jenkins"}}}
{"name":"fabric8-analytics-lsp-server","description":"LSP Server for Dependency Analytics","version":"0.1.49","author":"Pavel Odvody","contributors":[{"name":"Michal Srb","email":"michal@redhat.com"},{"name":"Jyasveer Gotta","email":"jgotta@redhat.com"},{"name":"Jaivardhan Kumar","email":"jakumar@redhat.com"}],"license":"Apache-2.0","engines":{"node":"*"},"keywords":["fabric8-analytics","LSP"],"repository":{"type":"git","url":"https://github.com/fabric8-analytics/fabric8-analytics-lsp-server.git"},"dependencies":{"request":"^2.79.0","stream-json":"0.4.2","vscode-languageserver":"^4.1.3","winston":"2.3.1","xml2object":"0.1.2"},"devDependencies":{"@types/node":"^6.0.52","@krux/condition-jenkins":"1.0.1","semantic-release":"8.2.0","typescript":"^2.1.4"},"scripts":{"build":"npm run clean && node node_modules/typescript/bin/tsc -p . && cp LICENSE package.json README.md output && npm run dist","clean":"rm -Rf ca-lsp-server.tar output/","dist":"cp -r node_modules output/ && cp ./package.json output/ && node -p -e \"require('./package.json').version\" > output/VERSION && rm -rf output/node_modules/typescript/ && tar cvjf ca-lsp-server.tar -C output/ .","semantic-release":"semantic-release pre && npm run build && cp -r .git output && npm publish output/ && semantic-release post"},"release":{"branch":"master","debug":false,"verifyConditions":{"path":"./node_modules/@krux/condition-jenkins"}}}

@@ -157,46 +157,12 @@ /* --------------------------------------------------------------------------------------------

let DiagnosticsEngines = [consumers_1.SecurityEngine];
// TODO: in-memory caching only, this needs to be more robust
let metadataCache = new Map();
let get_metadata = (ecosystem, name, version, cb) => {
let cacheKey = ecosystem + " " + name + " " + version;
let metadata = metadataCache[cacheKey];
if (metadata != null) {
winston.info('cache hit for ' + cacheKey);
cb(metadata);
return;
const getCAmsg = (deps, diagnostics) => {
if (diagnostics.length > 0) {
return `Scanned ${deps.length} runtime dependencies, flagged ${diagnostics.length} potential security vulnerabilities along with quick fixes`;
}
let part = [ecosystem, name, version].join('/');
const options = url.parse(config.server_url);
if (config.three_scale_user_token) {
options['path'] += `/component-analyses/${part}?user_key=${config.three_scale_user_token}`;
}
else {
options['path'] += `/component-analyses/${part}/`;
return `Scanned ${deps.length} runtime dependencies. No potential security vulnerabilities found`;
}
//options['path'] += `/component-analyses/${part}/`;
options['headers'] = { 'Authorization': 'Bearer ' + config.api_token };
winston.debug('get ' + options['host'] + options['path']);
if (process.env.RECOMMENDER_API_URL) {
let httpsHandler = https.get(options, function (res) {
let body = '';
res.on('data', function (chunk) { body += chunk; });
res.on('end', function () {
winston.info('status ' + this.statusCode);
if (this.statusCode == 200 || this.statusCode == 202) {
let response = JSON.parse(body);
winston.debug('response ' + response);
metadataCache[cacheKey] = response;
cb(response);
}
else {
cb(null);
}
});
});
httpsHandler.on('error', function (response) {
console.log('');
});
}
};
const bulkComponentAnalysis = function (reqData) {
const caDefaultMsg = 'Checking for security vulnerabilities ...';
const bulkComponentAnalysis = (reqData) => {
return new Promise((resolve, reject) => {

@@ -218,7 +184,5 @@ const options = {};

if (err) {
console.log('error', err);
reject(err);
}
else {
console.log('response Post ' + body);
if ((httpResponse.statusCode === 200 || httpResponse.statusCode === 202)) {

@@ -244,25 +208,24 @@ let resp = JSON.parse(body);

};
const constructPayload = function (ecosystem, packages) {
return __awaiter(this, void 0, void 0, function* () {
return yield new Promise((resolve) => {
const regexVersion = new RegExp(/^(\d+\.)?(\d+\.)?(\d+)$/);
let request_payload = [];
for (let pck of packages) {
if (pck.name.value && pck.version.value && regexVersion.test(pck.version.value)) {
request_payload.push({
"ecosystem": ecosystem,
"package": pck.name.value,
"version": pck.version.value
});
}
const constructPayload = (ecosystem, packages) => {
return new Promise((resolve) => {
const regexVersion = new RegExp(/^([a-zA-Z0-9]+\.)?([a-zA-Z0-9]+\.)?([a-zA-Z0-9]+\.)?([a-zA-Z0-9]+)$/);
let request_payload = [];
for (let pck of packages) {
if (pck.name.value && pck.version.value && regexVersion.test(pck.version.value)
&& !(request_payload.some((item) => item.package === pck.name.value && item.version === pck.version.value))) {
request_payload.push({
"ecosystem": ecosystem,
"package": pck.name.value,
"version": pck.version.value
});
}
resolve(request_payload);
});
}
resolve(request_payload);
});
};
let getComponentsInfo = function (request_payload, aggregator, components, diagnostics) {
let getComponentsInfo = (request_payload, aggregator, components, diagnostics) => __awaiter(this, void 0, void 0, function* () {
for (let i = 0; i < request_payload.length; i += 10) {
let pck = request_payload.slice(i, i + 10);
let req_data = JSON.stringify(pck);
bulkComponentAnalysis(req_data).then((response) => {
yield bulkComponentAnalysis(req_data).then((response) => {
let componentAnalysisResponse;

@@ -280,5 +243,7 @@ componentAnalysisResponse = response;

})
.catch(err => console.log(err));
.catch(err => {
return null;
});
}
};
});
files.on(EventStream.Diagnostics, "^package\\.json$", (uri, name, contents) => {

@@ -288,3 +253,3 @@ /* Convert from readable stream into string */

let collector = new collector_1.DependencyCollector(null);
connection.sendNotification('caNotification', { 'data': 'Checking for security vulnerabilities ...' });
connection.sendNotification('caNotification', { 'data': caDefaultMsg });
collector.collect(stream).then((deps) => {

@@ -294,9 +259,3 @@ let diagnostics = [];

let aggregator = new Aggregator(deps, () => {
if (diagnostics.length > 0) {
connection.sendNotification('caNotification', { 'data': `Scanned ${deps.length} runtime dependencies, flagged ${diagnostics.length} potential security vulnerabilities along with quick fixes`, 'isEditAction': isEditAction, 'diagCount': diagnostics.length });
}
else {
connection.sendNotification('caNotification', { 'data': `Scanned ${deps.length} runtime dependencies. No potential security vulnerabilities found`, 'isEditAction': isEditAction, 'diagCount': 0 });
}
isEditAction = false;
connection.sendNotification('caNotification', { 'data': getCAmsg(deps, diagnostics), 'diagCount': diagnostics.length > 0 ? diagnostics.length : 0 });
connection.sendDiagnostics({ uri: uri, diagnostics: diagnostics });

@@ -313,3 +272,3 @@ });

let collector = new collector_1.PomXmlDependencyCollector();
connection.sendNotification('caNotification', { 'data': 'Checking for security vulnerabilities ...' });
connection.sendNotification('caNotification', { 'data': caDefaultMsg });
collector.collect(stream).then((deps) => {

@@ -319,9 +278,3 @@ let diagnostics = [];

let aggregator = new Aggregator(deps, () => {
if (diagnostics.length > 0) {
connection.sendNotification('caNotification', { 'data': `Scanned ${deps.length} runtime dependencies, flagged ${diagnostics.length} potential security vulnerabilities along with quick fixes`, 'isEditAction': isEditAction, 'diagCount': diagnostics.length });
}
else {
connection.sendNotification('caNotification', { 'data': `Scanned ${deps.length} runtime dependencies. No potential security vulnerabilities found`, 'isEditAction': isEditAction, 'diagCount': 0 });
}
isEditAction = false;
connection.sendNotification('caNotification', { 'data': getCAmsg(deps, diagnostics), 'diagCount': diagnostics.length > 0 ? diagnostics.length : 0 });
connection.sendDiagnostics({ uri: uri, diagnostics: diagnostics });

@@ -336,3 +289,3 @@ });

let collector = new collector_1.ReqDependencyCollector();
connection.sendNotification('caNotification', { 'data': 'Checking for security vulnerabilities ...' });
connection.sendNotification('caNotification', { 'data': caDefaultMsg });
collector.collect(contents).then((deps) => {

@@ -342,9 +295,3 @@ let diagnostics = [];

let aggregator = new Aggregator(deps, () => {
if (diagnostics.length > 0) {
connection.sendNotification('caNotification', { 'data': `Scanned ${deps.length} runtime dependencies, flagged ${diagnostics.length} potential security vulnerabilities along with quick fixes`, 'isEditAction': isEditAction, 'diagCount': diagnostics.length });
}
else {
connection.sendNotification('caNotification', { 'data': `Scanned ${deps.length} runtime dependencies. No potential security vulnerabilities found`, 'isEditAction': isEditAction, 'diagCount': 0 });
}
isEditAction = false;
connection.sendNotification('caNotification', { 'data': getCAmsg(deps, diagnostics), 'diagCount': diagnostics.length > 0 ? diagnostics.length : 0 });
connection.sendDiagnostics({ uri: uri, diagnostics: diagnostics });

@@ -358,5 +305,3 @@ });

let checkDelay;
let isEditAction = false;
connection.onDidSaveTextDocument((params) => {
isEditAction = true;
clearTimeout(checkDelay);

@@ -367,3 +312,2 @@ server.handle_file_event(params.textDocument.uri, server.files.file_data[params.textDocument.uri]);

/* Update internal state for code lenses */
isEditAction = true;
server.files.file_data[params.textDocument.uri] = params.contentChanges[0].text;

@@ -376,3 +320,2 @@ clearTimeout(checkDelay);

connection.onDidOpenTextDocument((params) => {
isEditAction = false;
server.handle_file_event(params.textDocument.uri, params.textDocument.text);

@@ -392,3 +335,2 @@ });

connection.onDidCloseTextDocument((params) => {
isEditAction = false;
clearTimeout(checkDelay);

@@ -395,0 +337,0 @@ });

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