first
This commit is contained in:
1
safekiso-server/node_modules/snyk/wrapper_dist/bootstrap.d.ts
generated
vendored
Normal file
1
safekiso-server/node_modules/snyk/wrapper_dist/bootstrap.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
23
safekiso-server/node_modules/snyk/wrapper_dist/bootstrap.js
generated
vendored
Normal file
23
safekiso-server/node_modules/snyk/wrapper_dist/bootstrap.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const common = require("./common");
|
||||
const process = require("process");
|
||||
const errorContextMessage = 'Download Error';
|
||||
(async () => {
|
||||
try {
|
||||
const config = common.getCurrentConfiguration();
|
||||
const executable = config.getLocalLocation();
|
||||
if (process.argv.includes('exec')) {
|
||||
const filenameShasum = config.getShasumFile();
|
||||
const { downloadUrl, backupUrl } = config.getDownloadLocations();
|
||||
const downloadError = await common.downloadWithBackup(downloadUrl, backupUrl, executable, filenameShasum);
|
||||
if (downloadError !== undefined) {
|
||||
throw downloadError;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
await common.logError(errorContextMessage, err);
|
||||
}
|
||||
})();
|
||||
//# sourceMappingURL=bootstrap.js.map
|
||||
1
safekiso-server/node_modules/snyk/wrapper_dist/bootstrap.js.map
generated
vendored
Normal file
1
safekiso-server/node_modules/snyk/wrapper_dist/bootstrap.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":";;AAAA,mCAAmC;AACnC,mCAAmC;AAEnC,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AAE7C,CAAC,KAAK,IAAI,EAAE;IACV,IAAI;QACF,MAAM,MAAM,GAAG,MAAM,CAAC,uBAAuB,EAAE,CAAC;QAChD,MAAM,UAAU,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAE7C,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YACjC,MAAM,cAAc,GAAG,MAAM,CAAC,aAAa,EAAE,CAAC;YAC9C,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,oBAAoB,EAAE,CAAC;YAEjE,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,kBAAkB,CACnD,WAAW,EACX,SAAS,EACT,UAAU,EACV,cAAc,CACf,CAAC;YACF,IAAI,aAAa,KAAK,SAAS,EAAE;gBAC/B,MAAM,aAAa,CAAC;aACrB;SACF;KACF;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,MAAM,CAAC,QAAQ,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC;KACjD;AACH,CAAC,CAAC,EAAE,CAAC"}
|
||||
31
safekiso-server/node_modules/snyk/wrapper_dist/common.d.ts
generated
vendored
Normal file
31
safekiso-server/node_modules/snyk/wrapper_dist/common.d.ts
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import 'global-agent/bootstrap';
|
||||
export declare const versionFile: string;
|
||||
export declare const shasumFile: string;
|
||||
export declare const integrationName = "TS_BINARY_WRAPPER";
|
||||
export declare class WrapperConfiguration {
|
||||
private version;
|
||||
private binaryName;
|
||||
private expectedSha256sum;
|
||||
constructor(version: string, binaryName: string, expectedSha256sum: string);
|
||||
getVersion(): string;
|
||||
getBinaryName(): string;
|
||||
getDownloadLocations(): {
|
||||
downloadUrl: string;
|
||||
backupUrl: string;
|
||||
};
|
||||
getLocalLocation(): string;
|
||||
getShasumFile(): string;
|
||||
}
|
||||
export declare function determineBinaryName(platform: string, arch: string): string;
|
||||
export declare function getCurrentVersion(filename: string): string;
|
||||
export declare function getCurrentSha256sum(binaryName: string, filename: string): string;
|
||||
export declare function getCurrentConfiguration(): WrapperConfiguration;
|
||||
export declare function getCliArguments(inputArgv: string[]): string[];
|
||||
export declare function debugEnabled(cliArguments: string[]): boolean;
|
||||
export declare function runWrapper(executable: string, cliArguments: string[]): number;
|
||||
export declare function getWarningMessage(message: string): string;
|
||||
export declare function formatErrorMessage(message: string): boolean;
|
||||
export declare function downloadExecutable(downloadUrl: string, filename: string, filenameShasum: string): Promise<Error | undefined>;
|
||||
export declare function downloadWithBackup(downloadUrl: string, backupUrl: string, filename: string, filenameShasum: string): Promise<Error | undefined>;
|
||||
export declare function logError(context: string, err: Error, printToConsole?: boolean): Promise<void>;
|
||||
export declare function isAnalyticsEnabled(): boolean;
|
||||
317
safekiso-server/node_modules/snyk/wrapper_dist/common.js
generated
vendored
Normal file
317
safekiso-server/node_modules/snyk/wrapper_dist/common.js
generated
vendored
Normal file
@@ -0,0 +1,317 @@
|
||||
"use strict";
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isAnalyticsEnabled = exports.logError = exports.downloadWithBackup = exports.downloadExecutable = exports.formatErrorMessage = exports.getWarningMessage = exports.runWrapper = exports.debugEnabled = exports.getCliArguments = exports.getCurrentConfiguration = exports.getCurrentSha256sum = exports.getCurrentVersion = exports.determineBinaryName = exports.WrapperConfiguration = exports.integrationName = exports.shasumFile = exports.versionFile = void 0;
|
||||
// must be set before we import 'global-agent/bootstrap'
|
||||
process.env.GLOBAL_AGENT_ENVIRONMENT_VARIABLE_NAMESPACE = '';
|
||||
process.env.HTTPS_PROXY =
|
||||
(_b = (_a = process.env.HTTPS_PROXY) !== null && _a !== void 0 ? _a : process.env.https_proxy) !== null && _b !== void 0 ? _b : '';
|
||||
process.env.HTTP_PROXY = (_d = (_c = process.env.HTTP_PROXY) !== null && _c !== void 0 ? _c : process.env.http_proxy) !== null && _d !== void 0 ? _d : '';
|
||||
process.env.NO_PROXY = (_f = (_e = process.env.NO_PROXY) !== null && _e !== void 0 ? _e : process.env.no_proxy) !== null && _f !== void 0 ? _f : '';
|
||||
require("global-agent/bootstrap");
|
||||
const path = require("path");
|
||||
const os = require("os");
|
||||
const fs = require("fs");
|
||||
const child_process_1 = require("child_process");
|
||||
const https = require("https");
|
||||
const crypto_1 = require("crypto");
|
||||
const Sentry = require("@sentry/node");
|
||||
exports.versionFile = path.join(__dirname, 'generated', 'version');
|
||||
exports.shasumFile = path.join(__dirname, 'generated', 'sha256sums.txt');
|
||||
const binaryDeploymentsFilePath = path.join(__dirname, 'generated', 'binary-deployments.json');
|
||||
exports.integrationName = 'TS_BINARY_WRAPPER';
|
||||
class WrapperConfiguration {
|
||||
constructor(version, binaryName, expectedSha256sum) {
|
||||
this.version = version;
|
||||
this.binaryName = binaryName;
|
||||
this.expectedSha256sum = expectedSha256sum;
|
||||
}
|
||||
getVersion() {
|
||||
return this.version;
|
||||
}
|
||||
getBinaryName() {
|
||||
return this.binaryName;
|
||||
}
|
||||
getDownloadLocations() {
|
||||
const baseUrl = 'https://downloads.snyk.io/cli';
|
||||
const backupUrl = 'https://static.snyk.io/cli';
|
||||
return {
|
||||
downloadUrl: `${baseUrl}/v${this.version}/${this.binaryName}`,
|
||||
backupUrl: `${backupUrl}/v${this.version}/${this.binaryName}`,
|
||||
};
|
||||
}
|
||||
getLocalLocation() {
|
||||
const currentFolder = __dirname;
|
||||
return path.join(currentFolder, this.binaryName);
|
||||
}
|
||||
getShasumFile() {
|
||||
return this.expectedSha256sum;
|
||||
}
|
||||
}
|
||||
exports.WrapperConfiguration = WrapperConfiguration;
|
||||
const logErrorWithTimeStamps = (...args) => {
|
||||
console.error(`${new Date().toISOString()}:`, ...args);
|
||||
};
|
||||
function determineBinaryName(platform, arch) {
|
||||
let osname = platform;
|
||||
let archname = arch;
|
||||
switch (osname) {
|
||||
case 'win32':
|
||||
osname = 'windows';
|
||||
break;
|
||||
case 'linux': {
|
||||
let isAlpine = false;
|
||||
try {
|
||||
const result = (0, child_process_1.spawnSync)('cat /etc/os-release', { shell: true });
|
||||
isAlpine = result.stdout.toString().toLowerCase().includes('id=alpine');
|
||||
}
|
||||
catch {
|
||||
isAlpine = false;
|
||||
}
|
||||
if (isAlpine) {
|
||||
osname = 'alpine';
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (arch) {
|
||||
case 'x64':
|
||||
case 'amd64':
|
||||
archname = 'amd64';
|
||||
break;
|
||||
}
|
||||
const supportedPlatforms = require(binaryDeploymentsFilePath);
|
||||
const binaryName = supportedPlatforms[osname][archname];
|
||||
if (binaryName === undefined) {
|
||||
const defaultErrorMsg = ' The current platform (' +
|
||||
osname +
|
||||
' ' +
|
||||
archname +
|
||||
') is not supported by Snyk.\n' +
|
||||
' You may want to consider using Docker to run Snyk, for details see: https://docs.snyk.io/snyk-cli/install-the-snyk-cli#snyk-cli-in-a-docker-image\n' +
|
||||
' If you experience errors please check http://support.snyk.io/.';
|
||||
throw Error(getWarningMessage(defaultErrorMsg));
|
||||
}
|
||||
return binaryName;
|
||||
}
|
||||
exports.determineBinaryName = determineBinaryName;
|
||||
function getCurrentVersion(filename) {
|
||||
try {
|
||||
const version = fs.readFileSync(filename);
|
||||
return version.toString().trim();
|
||||
}
|
||||
catch {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
exports.getCurrentVersion = getCurrentVersion;
|
||||
function getCurrentSha256sum(binaryName, filename) {
|
||||
try {
|
||||
const allsums = fs.readFileSync(filename).toString();
|
||||
const re = new RegExp('^([a-zA-Z0-9]+)[\\s\\*]+' + binaryName + '$', 'mig');
|
||||
const result = re.exec(allsums);
|
||||
if (result) {
|
||||
return result[1];
|
||||
}
|
||||
}
|
||||
catch {
|
||||
//
|
||||
}
|
||||
return 'unknown-shasum-' + binaryName;
|
||||
}
|
||||
exports.getCurrentSha256sum = getCurrentSha256sum;
|
||||
function getCurrentConfiguration() {
|
||||
const binaryName = determineBinaryName(os.platform(), os.arch());
|
||||
const version = getCurrentVersion(exports.versionFile);
|
||||
const expectedSha256sum = getCurrentSha256sum(binaryName, exports.shasumFile);
|
||||
return new WrapperConfiguration(version, binaryName, expectedSha256sum);
|
||||
}
|
||||
exports.getCurrentConfiguration = getCurrentConfiguration;
|
||||
function getCliArguments(inputArgv) {
|
||||
const cliArguments = inputArgv.slice(2);
|
||||
return cliArguments;
|
||||
}
|
||||
exports.getCliArguments = getCliArguments;
|
||||
function debugEnabled(cliArguments) {
|
||||
let debugIndex = cliArguments.indexOf('--debug');
|
||||
if (debugIndex < 0) {
|
||||
debugIndex = cliArguments.indexOf('-d');
|
||||
}
|
||||
return debugIndex >= 0;
|
||||
}
|
||||
exports.debugEnabled = debugEnabled;
|
||||
function runWrapper(executable, cliArguments) {
|
||||
const debug = debugEnabled(cliArguments);
|
||||
if (debug) {
|
||||
logErrorWithTimeStamps('Executing: ' + executable + ' ' + cliArguments.join(' '));
|
||||
}
|
||||
const res = (0, child_process_1.spawnSync)(executable, cliArguments, {
|
||||
shell: false,
|
||||
stdio: 'inherit',
|
||||
env: {
|
||||
...process.env,
|
||||
SNYK_INTEGRATION_NAME: exports.integrationName,
|
||||
SNYK_INTEGRATION_VERSION: getCurrentVersion(exports.versionFile),
|
||||
},
|
||||
});
|
||||
if (res.status !== null) {
|
||||
if (debug) {
|
||||
logErrorWithTimeStamps(res);
|
||||
}
|
||||
return res.status;
|
||||
}
|
||||
else {
|
||||
logErrorWithTimeStamps(res);
|
||||
if (!formatErrorMessage(res.error.code)) {
|
||||
logErrorWithTimeStamps('Failed to spawn child process. (' + executable + ')');
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
exports.runWrapper = runWrapper;
|
||||
function getWarningMessage(message) {
|
||||
return `\n------------------------------- Warning -------------------------------\n${message}\n------------------------------- Warning -------------------------------\n`;
|
||||
}
|
||||
exports.getWarningMessage = getWarningMessage;
|
||||
function formatErrorMessage(message) {
|
||||
const eaccesWarning = "You don't have the permissions to install Snyk. Please try the following options:\n" +
|
||||
'* If you are installing with increased privileges (for example sudo), try adding --unsafe-perm as a parameter to npm install\n' +
|
||||
'* If you run NPM <= 6, please upgrade to a later version.\n' +
|
||||
'If the problems persist please check http://support.snyk.io/.';
|
||||
const certificateError = 'If you are running Snyk in an environment that intercepts SSL traffic, please specify\n' +
|
||||
'your custom CA certificates via the NODE_EXTRA_CA_CERTS environment variable.\n' +
|
||||
'See https://nodejs.org/api/cli.html#node_extra_ca_certsfile for additional information.';
|
||||
const degradedCLIWarning = 'You are currently running a degraded version of the Snyk CLI.\n' +
|
||||
'As a result, some features of the CLI will be unavailable.\n' +
|
||||
'For information on how to resolve this, please see this article: https://docs.snyk.io/snyk-cli/installing-snyk-cli-as-a-binary-via-npm\n' +
|
||||
'For any assistance, please check http://support.snyk.io/.';
|
||||
let warning = '';
|
||||
if (message.includes('EACCES')) {
|
||||
warning = eaccesWarning;
|
||||
}
|
||||
else if (message.includes('certificate')) {
|
||||
warning = certificateError;
|
||||
}
|
||||
else if (message.includes('legacy-cli')) {
|
||||
warning = degradedCLIWarning;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
logErrorWithTimeStamps(getWarningMessage(warning));
|
||||
return true;
|
||||
}
|
||||
exports.formatErrorMessage = formatErrorMessage;
|
||||
function downloadExecutable(downloadUrl, filename, filenameShasum) {
|
||||
return new Promise(function (resolve) {
|
||||
logErrorWithTimeStamps('Starting download');
|
||||
const options = new URL(`${downloadUrl}?utm_source=${exports.integrationName}`);
|
||||
const temp = path.join(__dirname, Date.now().toString());
|
||||
const fileStream = fs.createWriteStream(temp);
|
||||
const shasum = (0, crypto_1.createHash)('sha256').setEncoding('hex');
|
||||
const cleanupAfterError = (error) => {
|
||||
try {
|
||||
fs.unlinkSync(temp);
|
||||
}
|
||||
catch (e) {
|
||||
// ignoring any error during cleaning up after an error
|
||||
}
|
||||
resolve(error);
|
||||
};
|
||||
// shasum events
|
||||
shasum.on('error', cleanupAfterError);
|
||||
// filestream events
|
||||
fileStream.on('error', cleanupAfterError).on('close', () => {
|
||||
const actualShasum = shasum.read();
|
||||
const debugMessage = 'Shasums:\n- actual: ' +
|
||||
actualShasum +
|
||||
'\n- expected: ' +
|
||||
filenameShasum;
|
||||
if (filenameShasum && actualShasum != filenameShasum) {
|
||||
cleanupAfterError(Error('Shasum comparison failed!\n' + debugMessage));
|
||||
}
|
||||
else {
|
||||
logErrorWithTimeStamps(debugMessage);
|
||||
// finally rename the file and change permissions
|
||||
fs.renameSync(temp, filename);
|
||||
fs.chmodSync(filename, 0o755);
|
||||
logErrorWithTimeStamps('Downloaded successfull! ');
|
||||
}
|
||||
resolve(undefined);
|
||||
});
|
||||
logErrorWithTimeStamps("Downloading from '" + options.toString() + "' to '" + filename + "'");
|
||||
const req = https.get(options, (res) => {
|
||||
// response events
|
||||
res.on('error', cleanupAfterError).on('end', () => {
|
||||
shasum.end();
|
||||
fileStream.end();
|
||||
});
|
||||
// pipe data
|
||||
res.pipe(fileStream);
|
||||
res.pipe(shasum);
|
||||
});
|
||||
req.on('error', cleanupAfterError).on('response', (incoming) => {
|
||||
if (incoming.statusCode &&
|
||||
!(200 <= incoming.statusCode && incoming.statusCode < 300)) {
|
||||
req.destroy();
|
||||
cleanupAfterError(Error('Download failed! Server Response: ' +
|
||||
incoming.statusCode +
|
||||
' ' +
|
||||
incoming.statusMessage +
|
||||
' (' +
|
||||
downloadUrl +
|
||||
')'));
|
||||
}
|
||||
});
|
||||
req.end();
|
||||
});
|
||||
}
|
||||
exports.downloadExecutable = downloadExecutable;
|
||||
async function downloadWithBackup(downloadUrl, backupUrl, filename, filenameShasum) {
|
||||
try {
|
||||
const error = await downloadExecutable(downloadUrl, filename, filenameShasum);
|
||||
if (error) {
|
||||
logErrorWithTimeStamps(error);
|
||||
logErrorWithTimeStamps(`Failed to download from ${downloadUrl}! Trying to download from ${backupUrl} location...`);
|
||||
const backupError = await downloadExecutable(backupUrl, filename, filenameShasum);
|
||||
logErrorWithTimeStamps(backupError);
|
||||
return backupError;
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
// Handle any unexpected errors
|
||||
logErrorWithTimeStamps('An unexpected error occurred:', err);
|
||||
throw err; // Rethrow if you want to propagate the error upwards
|
||||
}
|
||||
}
|
||||
exports.downloadWithBackup = downloadWithBackup;
|
||||
async function logError(context, err, printToConsole = true) {
|
||||
if (isAnalyticsEnabled()) {
|
||||
// init error reporting
|
||||
const version = getCurrentVersion(exports.versionFile);
|
||||
Sentry.init({
|
||||
dsn: 'https://3e845233db8c4f43b4c4b9245f1d7bd6@o30291.ingest.sentry.io/4504599528079360',
|
||||
release: version,
|
||||
});
|
||||
// report error
|
||||
const sentryError = new Error('[' + context + '] ' + err.message);
|
||||
sentryError.stack = err.stack;
|
||||
Sentry.captureException(sentryError);
|
||||
await Sentry.close();
|
||||
}
|
||||
// finally log the error to the console as well
|
||||
if (printToConsole) {
|
||||
logErrorWithTimeStamps('\n' + err);
|
||||
formatErrorMessage(err.message);
|
||||
}
|
||||
}
|
||||
exports.logError = logError;
|
||||
function isAnalyticsEnabled() {
|
||||
if (process.env.snyk_disable_analytics == '1' ||
|
||||
process.env.SNYK_DISABLE_ANALYTICS == '1') {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
exports.isAnalyticsEnabled = isAnalyticsEnabled;
|
||||
//# sourceMappingURL=common.js.map
|
||||
1
safekiso-server/node_modules/snyk/wrapper_dist/common.js.map
generated
vendored
Normal file
1
safekiso-server/node_modules/snyk/wrapper_dist/common.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
17
safekiso-server/node_modules/snyk/wrapper_dist/generated/binary-deployments.json
generated
vendored
Normal file
17
safekiso-server/node_modules/snyk/wrapper_dist/generated/binary-deployments.json
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"darwin": {
|
||||
"amd64": "snyk-macos",
|
||||
"arm64": "snyk-macos-arm64"
|
||||
},
|
||||
"windows": {
|
||||
"amd64": "snyk-win.exe"
|
||||
},
|
||||
"alpine": {
|
||||
"amd64": "snyk-alpine",
|
||||
"arm64": "snyk-alpine-arm64"
|
||||
},
|
||||
"linux": {
|
||||
"amd64": "snyk-linux",
|
||||
"arm64": "snyk-linux-arm64"
|
||||
}
|
||||
}
|
||||
9
safekiso-server/node_modules/snyk/wrapper_dist/generated/sha256sums.txt
generated
vendored
Normal file
9
safekiso-server/node_modules/snyk/wrapper_dist/generated/sha256sums.txt
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
8069fd5db48b88f2142ad0d67a259edd6483a39b7d03faac354d6134574bb5a8 snyk-alpine-arm64
|
||||
373d9c1df9adcac3d349fc442490716ad2fc811a97602c6ea99be32ea597ea62 snyk-alpine
|
||||
161df8f7508322a205bcd7cfb5777c4f6da0da8344767372e653af93e94ab5e9 snyk-fix.tgz
|
||||
1a9ec7710e55a5c70f3e0dd21c61a91e245172bf5072d7f2546197053cb53f3c snyk-linux-arm64
|
||||
7e45e67a133c48ad31e58c8ac7ea96c0aab1bd1b5c5be49454a946f99306b885 snyk-linux
|
||||
b30798ee892084d33bcaeeab45093b3eacf37a2d9b92d534940891794b2dad14 snyk-macos-arm64
|
||||
23db387e4e284fa640db166acca6c4a5ebbd502dfb5631c1c6e1b6409dd7fbc9 snyk-macos
|
||||
7cb14e654ec59a6196322fe4396a11b9e0fe800f200965fdb532f8cdc7cb572b snyk-protect.tgz
|
||||
c957386de214527476cbcfdd7df2e0ac1a2d9d9ec25fa6cec9f81b3bc4ea656e snyk-win.exe
|
||||
1
safekiso-server/node_modules/snyk/wrapper_dist/generated/version
generated
vendored
Normal file
1
safekiso-server/node_modules/snyk/wrapper_dist/generated/version
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
1.1297.2
|
||||
2
safekiso-server/node_modules/snyk/wrapper_dist/index.d.ts
generated
vendored
Normal file
2
safekiso-server/node_modules/snyk/wrapper_dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
export {};
|
||||
53
safekiso-server/node_modules/snyk/wrapper_dist/index.js
generated
vendored
Normal file
53
safekiso-server/node_modules/snyk/wrapper_dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const process_1 = require("process");
|
||||
const common = require("./common");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const errorContextMessage = 'Runtime';
|
||||
const fallbackScript = path.join(__dirname, '..', 'dist', 'cli', 'index.js');
|
||||
const legacyCLIflag = '--legacy-cli';
|
||||
function run(executable) {
|
||||
let cliArguments = common.getCliArguments(process_1.argv);
|
||||
if (executable.endsWith('.js')) {
|
||||
cliArguments = [executable].concat(cliArguments);
|
||||
executable = process_1.argv[0]; // node runtime
|
||||
}
|
||||
const exitCode = common.runWrapper(executable, cliArguments);
|
||||
return exitCode;
|
||||
}
|
||||
(async () => {
|
||||
let fallbackToLegacyCLI = process_1.argv.includes(legacyCLIflag);
|
||||
if (fallbackToLegacyCLI === false) {
|
||||
try {
|
||||
const config = common.getCurrentConfiguration();
|
||||
const executable = config.getLocalLocation();
|
||||
const { downloadUrl, backupUrl } = config.getDownloadLocations();
|
||||
if (!fs.existsSync(executable)) {
|
||||
console.error("Executable doesn't exist, trying to download.");
|
||||
const downloadError = await common.downloadWithBackup(downloadUrl, backupUrl, executable, config.getShasumFile());
|
||||
if (downloadError !== undefined) {
|
||||
throw downloadError;
|
||||
}
|
||||
}
|
||||
// run the executable
|
||||
process.exit(run(executable));
|
||||
}
|
||||
catch (error) {
|
||||
fallbackToLegacyCLI = true;
|
||||
await common.logError(errorContextMessage, error);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// if --legacy-clli is enabled create a log messaeg
|
||||
await common.logError(errorContextMessage, Error(legacyCLIflag + ' is set'), false);
|
||||
}
|
||||
if (fallbackToLegacyCLI) {
|
||||
common.formatErrorMessage('legacy-cli');
|
||||
const exitCode = run(fallbackScript);
|
||||
common.formatErrorMessage('legacy-cli');
|
||||
process.exit(exitCode);
|
||||
}
|
||||
})();
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
safekiso-server/node_modules/snyk/wrapper_dist/index.js.map
generated
vendored
Normal file
1
safekiso-server/node_modules/snyk/wrapper_dist/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,qCAA+B;AAC/B,mCAAmC;AACnC,yBAAyB;AACzB,6BAA6B;AAE7B,MAAM,mBAAmB,GAAG,SAAS,CAAC;AACtC,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;AAC7E,MAAM,aAAa,GAAG,cAAc,CAAC;AAErC,SAAS,GAAG,CAAC,UAAkB;IAC7B,IAAI,YAAY,GAAG,MAAM,CAAC,eAAe,CAAC,cAAI,CAAC,CAAC;IAEhD,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QAC9B,YAAY,GAAG,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QACjD,UAAU,GAAG,cAAI,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe;KACtC;IAED,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAC7D,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,CAAC,KAAK,IAAI,EAAE;IACV,IAAI,mBAAmB,GAAG,cAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IAEvD,IAAI,mBAAmB,KAAK,KAAK,EAAE;QACjC,IAAI;YACF,MAAM,MAAM,GAAG,MAAM,CAAC,uBAAuB,EAAE,CAAC;YAChD,MAAM,UAAU,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;YAC7C,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,oBAAoB,EAAE,CAAC;YAEjE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;gBAC9B,OAAO,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;gBAE/D,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,kBAAkB,CACnD,WAAW,EACX,SAAS,EACT,UAAU,EACV,MAAM,CAAC,aAAa,EAAE,CACvB,CAAC;gBACF,IAAI,aAAa,KAAK,SAAS,EAAE;oBAC/B,MAAM,aAAa,CAAC;iBACrB;aACF;YAED,qBAAqB;YACrB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;SAC/B;QAAC,OAAO,KAAK,EAAE;YACd,mBAAmB,GAAG,IAAI,CAAC;YAC3B,MAAM,MAAM,CAAC,QAAQ,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;SACnD;KACF;SAAM;QACL,mDAAmD;QACnD,MAAM,MAAM,CAAC,QAAQ,CACnB,mBAAmB,EACnB,KAAK,CAAC,aAAa,GAAG,SAAS,CAAC,EAChC,KAAK,CACN,CAAC;KACH;IAED,IAAI,mBAAmB,EAAE;QACvB,MAAM,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;QACxC,MAAM,QAAQ,GAAG,GAAG,CAAC,cAAc,CAAC,CAAC;QACrC,MAAM,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;QAExC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;KACxB;AACH,CAAC,CAAC,EAAE,CAAC"}
|
||||
BIN
safekiso-server/node_modules/snyk/wrapper_dist/snyk-win.exe
generated
vendored
Normal file
BIN
safekiso-server/node_modules/snyk/wrapper_dist/snyk-win.exe
generated
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user