vscode-jsonrpc
Advanced tools
Comparing version 8.2.1-next.1 to 8.2.1
@@ -1082,9 +1082,11 @@ "use strict"; | ||
try { | ||
responsePromises.set(id, responsePromise); | ||
await messageWriter.write(requestMessage); | ||
responsePromises.set(id, responsePromise); | ||
} | ||
catch (error) { | ||
// Writing the message failed. So we need to delete it from the response promises and | ||
// reject it. | ||
responsePromises.delete(id); | ||
responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, error.message ? error.message : 'Unknown reason')); | ||
logger.error(`Sending request failed.`); | ||
// Writing the message failed. So we need to reject the promise. | ||
responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, error.message ? error.message : 'Unknown reason')); | ||
throw error; | ||
@@ -1091,0 +1093,0 @@ } |
@@ -27,3 +27,2 @@ "use strict"; | ||
const os = require("os"); | ||
const fs = require("fs"); | ||
const crypto_1 = require("crypto"); | ||
@@ -160,17 +159,18 @@ const net_1 = require("net"); | ||
function generateRandomPipeName() { | ||
const randomSuffix = (0, crypto_1.randomBytes)(21).toString('hex'); | ||
if (process.platform === 'win32') { | ||
return `\\\\.\\pipe\\lsp-${(0, crypto_1.randomBytes)(16).toString('hex')}-sock`; | ||
return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`; | ||
} | ||
let randomLength = 32; | ||
const fixedLength = 'lsp-.sock'.length; | ||
const tmpDir = fs.realpathSync(XDG_RUNTIME_DIR ?? os.tmpdir()); | ||
let result; | ||
if (XDG_RUNTIME_DIR) { | ||
result = path.join(XDG_RUNTIME_DIR, `vscode-ipc-${randomSuffix}.sock`); | ||
} | ||
else { | ||
result = path.join(os.tmpdir(), `vscode-${randomSuffix}.sock`); | ||
} | ||
const limit = safeIpcPathLengths.get(process.platform); | ||
if (limit !== undefined) { | ||
randomLength = Math.min(limit - tmpDir.length - fixedLength, randomLength); | ||
if (limit !== undefined && result.length > limit) { | ||
(0, ril_1.default)().console.warn(`WARNING: IPC handle "${result}" is longer than ${limit} characters.`); | ||
} | ||
if (randomLength < 16) { | ||
throw new Error(`Unable to generate a random pipe name with ${randomLength} characters.`); | ||
} | ||
const randomSuffix = (0, crypto_1.randomBytes)(Math.floor(randomLength / 2)).toString('hex'); | ||
return path.join(tmpDir, `lsp-${randomSuffix}.sock`); | ||
return result; | ||
} | ||
@@ -177,0 +177,0 @@ exports.generateRandomPipeName = generateRandomPipeName; |
{ | ||
"name": "vscode-jsonrpc", | ||
"description": "A json rpc implementation over streams", | ||
"version": "8.2.1-next.1", | ||
"version": "8.2.1", | ||
"author": "Microsoft Corporation", | ||
@@ -24,3 +24,3 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@types/msgpack-lite": "^0.1.10", | ||
"@types/msgpack-lite": "^0.1.7", | ||
"msgpack-lite": "^0.1.26" | ||
@@ -27,0 +27,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
4962
1
1
208475