slnodejs 6.1.128 → 6.1.136

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.
@@ -47704,6 +47704,9 @@ var __extends = (this && this.__extends) || (function () {
47704
47704
  SlEnvVars.blockBrowserHttpTraffic = function () {
47705
47705
  return parsing_utils_1.ParsingUtils.parseBoolean(SlEnvVars.BLOCK_BROWSER_HTTP_TRAFFIC);
47706
47706
  };
47707
+ SlEnvVars.getDisableHookDependencyGuard = function () {
47708
+ return parsing_utils_1.ParsingUtils.parseBoolean(SlEnvVars.DISABLE_HOOK_DEPENDENCY_GUARD);
47709
+ };
47707
47710
  var _a;
47708
47711
  SlEnvVars.HTTP_TIMEOUT = 'SL_httpTimeout';
47709
47712
  SlEnvVars.HTTP_MAX_ATTEMPTS = 'SL_HttpMaxAttempts';
@@ -47720,6 +47723,7 @@ var __extends = (this && this.__extends) || (function () {
47720
47723
  SlEnvVars.EXECUTION_QUERY_INTERVAL_SEC = 'SL_executionQueryIntervalSecs';
47721
47724
  SlEnvVars.FOOTPRINTS_BUFFER_THRESHOLD_MB = 'SL_footprintsBufferThresholdMb';
47722
47725
  SlEnvVars.BLOCK_BROWSER_HTTP_TRAFFIC = 'SL_blockBrowserHttpTraffic';
47726
+ SlEnvVars.DISABLE_HOOK_DEPENDENCY_GUARD = 'SL_disableHookDependencyGuard';
47723
47727
  SlEnvVars.CIA = (_a = (function () {
47724
47728
  function class_1() {
47725
47729
  }
@@ -83638,7 +83642,7 @@ module.exports = {
83638
83642
  return replace.call(value, percentTwenties, '+');
83639
83643
  },
83640
83644
  RFC3986: function (value) {
83641
- return value;
83645
+ return String(value);
83642
83646
  }
83643
83647
  },
83644
83648
  RFC1738: 'RFC1738',
@@ -83714,14 +83718,15 @@ var parseObject = function (chain, val, options) {
83714
83718
  var obj;
83715
83719
  var root = chain[i];
83716
83720
 
83717
- if (root === '[]') {
83718
- obj = [];
83719
- obj = obj.concat(leaf);
83721
+ if (root === '[]' && options.parseArrays) {
83722
+ obj = [].concat(leaf);
83720
83723
  } else {
83721
83724
  obj = options.plainObjects ? Object.create(null) : {};
83722
83725
  var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
83723
83726
  var index = parseInt(cleanRoot, 10);
83724
- if (
83727
+ if (!options.parseArrays && cleanRoot === '') {
83728
+ obj = { 0: leaf };
83729
+ } else if (
83725
83730
  !isNaN(index)
83726
83731
  && root !== cleanRoot
83727
83732
  && String(index) === cleanRoot
@@ -83730,7 +83735,7 @@ var parseObject = function (chain, val, options) {
83730
83735
  ) {
83731
83736
  obj = [];
83732
83737
  obj[index] = leaf;
83733
- } else {
83738
+ } else if (cleanRoot !== '__proto__') {
83734
83739
  obj[cleanRoot] = leaf;
83735
83740
  }
83736
83741
  }
@@ -83841,17 +83846,23 @@ var utils = require('./utils');
83841
83846
  var formats = require('./formats');
83842
83847
 
83843
83848
  var arrayPrefixGenerators = {
83844
- brackets: function brackets(prefix) { // eslint-disable-line func-name-matching
83849
+ brackets: function brackets(prefix) {
83845
83850
  return prefix + '[]';
83846
83851
  },
83847
- indices: function indices(prefix, key) { // eslint-disable-line func-name-matching
83852
+ indices: function indices(prefix, key) {
83848
83853
  return prefix + '[' + key + ']';
83849
83854
  },
83850
- repeat: function repeat(prefix) { // eslint-disable-line func-name-matching
83855
+ repeat: function repeat(prefix) {
83851
83856
  return prefix;
83852
83857
  }
83853
83858
  };
83854
83859
 
83860
+ var isArray = Array.isArray;
83861
+ var push = Array.prototype.push;
83862
+ var pushToArray = function (arr, valueOrArray) {
83863
+ push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
83864
+ };
83865
+
83855
83866
  var toISO = Date.prototype.toISOString;
83856
83867
 
83857
83868
  var defaults = {
@@ -83859,14 +83870,14 @@ var defaults = {
83859
83870
  encode: true,
83860
83871
  encoder: utils.encode,
83861
83872
  encodeValuesOnly: false,
83862
- serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching
83873
+ serializeDate: function serializeDate(date) {
83863
83874
  return toISO.call(date);
83864
83875
  },
83865
83876
  skipNulls: false,
83866
83877
  strictNullHandling: false
83867
83878
  };
83868
83879
 
83869
- var stringify = function stringify( // eslint-disable-line func-name-matching
83880
+ var stringify = function stringify(
83870
83881
  object,
83871
83882
  prefix,
83872
83883
  generateArrayPrefix,
@@ -83885,7 +83896,9 @@ var stringify = function stringify( // eslint-disable-line func-name-matching
83885
83896
  obj = filter(prefix, obj);
83886
83897
  } else if (obj instanceof Date) {
83887
83898
  obj = serializeDate(obj);
83888
- } else if (obj === null) {
83899
+ }
83900
+
83901
+ if (obj === null) {
83889
83902
  if (strictNullHandling) {
83890
83903
  return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder) : prefix;
83891
83904
  }
@@ -83908,7 +83921,7 @@ var stringify = function stringify( // eslint-disable-line func-name-matching
83908
83921
  }
83909
83922
 
83910
83923
  var objKeys;
83911
- if (Array.isArray(filter)) {
83924
+ if (isArray(filter)) {
83912
83925
  objKeys = filter;
83913
83926
  } else {
83914
83927
  var keys = Object.keys(obj);
@@ -83922,8 +83935,8 @@ var stringify = function stringify( // eslint-disable-line func-name-matching
83922
83935
  continue;
83923
83936
  }
83924
83937
 
83925
- if (Array.isArray(obj)) {
83926
- values = values.concat(stringify(
83938
+ if (isArray(obj)) {
83939
+ pushToArray(values, stringify(
83927
83940
  obj[key],
83928
83941
  generateArrayPrefix(prefix, key),
83929
83942
  generateArrayPrefix,
@@ -83938,7 +83951,7 @@ var stringify = function stringify( // eslint-disable-line func-name-matching
83938
83951
  encodeValuesOnly
83939
83952
  ));
83940
83953
  } else {
83941
- values = values.concat(stringify(
83954
+ pushToArray(values, stringify(
83942
83955
  obj[key],
83943
83956
  prefix + (allowDots ? '.' + key : '[' + key + ']'),
83944
83957
  generateArrayPrefix,
@@ -83962,7 +83975,7 @@ module.exports = function (object, opts) {
83962
83975
  var obj = object;
83963
83976
  var options = opts ? utils.assign({}, opts) : {};
83964
83977
 
83965
- if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') {
83978
+ if (options.encoder !== null && typeof options.encoder !== 'undefined' && typeof options.encoder !== 'function') {
83966
83979
  throw new TypeError('Encoder has to be a function.');
83967
83980
  }
83968
83981
 
@@ -83987,7 +84000,7 @@ module.exports = function (object, opts) {
83987
84000
  if (typeof options.filter === 'function') {
83988
84001
  filter = options.filter;
83989
84002
  obj = filter('', obj);
83990
- } else if (Array.isArray(options.filter)) {
84003
+ } else if (isArray(options.filter)) {
83991
84004
  filter = options.filter;
83992
84005
  objKeys = filter;
83993
84006
  }
@@ -84023,8 +84036,7 @@ module.exports = function (object, opts) {
84023
84036
  if (skipNulls && obj[key] === null) {
84024
84037
  continue;
84025
84038
  }
84026
-
84027
- keys = keys.concat(stringify(
84039
+ pushToArray(keys, stringify(
84028
84040
  obj[key],
84029
84041
  key,
84030
84042
  generateArrayPrefix,
@@ -84102,8 +84114,8 @@ var merge = function merge(target, source, options) {
84102
84114
  if (typeof source !== 'object') {
84103
84115
  if (Array.isArray(target)) {
84104
84116
  target.push(source);
84105
- } else if (typeof target === 'object') {
84106
- if (options.plainObjects || options.allowPrototypes || !has.call(Object.prototype, source)) {
84117
+ } else if (target && typeof target === 'object') {
84118
+ if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) {
84107
84119
  target[source] = true;
84108
84120
  }
84109
84121
  } else {
@@ -84113,7 +84125,7 @@ var merge = function merge(target, source, options) {
84113
84125
  return target;
84114
84126
  }
84115
84127
 
84116
- if (typeof target !== 'object') {
84128
+ if (!target || typeof target !== 'object') {
84117
84129
  return [target].concat(source);
84118
84130
  }
84119
84131
 
@@ -84125,8 +84137,9 @@ var merge = function merge(target, source, options) {
84125
84137
  if (Array.isArray(target) && Array.isArray(source)) {
84126
84138
  source.forEach(function (item, i) {
84127
84139
  if (has.call(target, i)) {
84128
- if (target[i] && typeof target[i] === 'object') {
84129
- target[i] = merge(target[i], item, options);
84140
+ var targetItem = target[i];
84141
+ if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
84142
+ target[i] = merge(targetItem, item, options);
84130
84143
  } else {
84131
84144
  target.push(item);
84132
84145
  }
@@ -84207,6 +84220,7 @@ var encode = function encode(str) {
84207
84220
 
84208
84221
  i += 1;
84209
84222
  c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
84223
+ /* eslint operator-linebreak: [2, "before"] */
84210
84224
  out += hexTable[0xF0 | (c >> 18)]
84211
84225
  + hexTable[0x80 | ((c >> 12) & 0x3F)]
84212
84226
  + hexTable[0x80 | ((c >> 6) & 0x3F)]
@@ -90926,20 +90940,30 @@ var assert = require('assert-plus');
90926
90940
  var Buffer = require('safer-buffer').Buffer;
90927
90941
  var rfc4253 = require('./rfc4253');
90928
90942
  var Key = require('../key');
90943
+ var SSHBuffer = require('../ssh-buffer');
90944
+ var crypto = require('crypto');
90945
+ var PrivateKey = require('../private-key');
90929
90946
 
90930
90947
  var errors = require('../errors');
90931
90948
 
90949
+ // https://tartarus.org/~simon/putty-prerel-snapshots/htmldoc/AppendixC.html
90932
90950
  function read(buf, options) {
90933
90951
  var lines = buf.toString('ascii').split(/[\r\n]+/);
90934
90952
  var found = false;
90935
90953
  var parts;
90936
90954
  var si = 0;
90955
+ var formatVersion;
90937
90956
  while (si < lines.length) {
90938
90957
  parts = splitHeader(lines[si++]);
90939
- if (parts &&
90940
- parts[0].toLowerCase() === 'putty-user-key-file-2') {
90941
- found = true;
90942
- break;
90958
+ if (parts) {
90959
+ formatVersion = {
90960
+ 'putty-user-key-file-2': 2,
90961
+ 'putty-user-key-file-3': 3
90962
+ }[parts[0].toLowerCase()];
90963
+ if (formatVersion) {
90964
+ found = true;
90965
+ break;
90966
+ }
90943
90967
  }
90944
90968
  }
90945
90969
  if (!found) {
@@ -90949,6 +90973,7 @@ function read(buf, options) {
90949
90973
 
90950
90974
  parts = splitHeader(lines[si++]);
90951
90975
  assert.equal(parts[0].toLowerCase(), 'encryption');
90976
+ var encryption = parts[1];
90952
90977
 
90953
90978
  parts = splitHeader(lines[si++]);
90954
90979
  assert.equal(parts[0].toLowerCase(), 'comment');
@@ -90969,10 +90994,94 @@ function read(buf, options) {
90969
90994
  if (key.type !== keyType) {
90970
90995
  throw (new Error('Outer key algorithm mismatch'));
90971
90996
  }
90997
+
90998
+ si += publicLines;
90999
+ if (lines[si]) {
91000
+ parts = splitHeader(lines[si++]);
91001
+ assert.equal(parts[0].toLowerCase(), 'private-lines');
91002
+ var privateLines = parseInt(parts[1], 10);
91003
+ if (!isFinite(privateLines) || privateLines < 0 ||
91004
+ privateLines > lines.length) {
91005
+ throw (new Error('Invalid private-lines count'));
91006
+ }
91007
+
91008
+ var privateBuf = Buffer.from(
91009
+ lines.slice(si, si + privateLines).join(''), 'base64');
91010
+
91011
+ if (encryption !== 'none' && formatVersion === 3) {
91012
+ throw new Error('Encrypted keys arenot supported for' +
91013
+ ' PuTTY format version 3');
91014
+ }
91015
+
91016
+ if (encryption === 'aes256-cbc') {
91017
+ if (!options.passphrase) {
91018
+ throw (new errors.KeyEncryptedError(
91019
+ options.filename, 'PEM'));
91020
+ }
91021
+
91022
+ var iv = Buffer.alloc(16, 0);
91023
+ var decipher = crypto.createDecipheriv(
91024
+ 'aes-256-cbc',
91025
+ derivePPK2EncryptionKey(options.passphrase),
91026
+ iv);
91027
+ decipher.setAutoPadding(false);
91028
+ privateBuf = Buffer.concat([
91029
+ decipher.update(privateBuf), decipher.final()]);
91030
+ }
91031
+
91032
+ key = new PrivateKey(key);
91033
+ if (key.type !== keyType) {
91034
+ throw (new Error('Outer key algorithm mismatch'));
91035
+ }
91036
+
91037
+ var sshbuf = new SSHBuffer({buffer: privateBuf});
91038
+ var privateKeyParts;
91039
+ if (alg === 'ssh-dss') {
91040
+ privateKeyParts = [ {
91041
+ name: 'x',
91042
+ data: sshbuf.readBuffer()
91043
+ }];
91044
+ } else if (alg === 'ssh-rsa') {
91045
+ privateKeyParts = [
91046
+ { name: 'd', data: sshbuf.readBuffer() },
91047
+ { name: 'p', data: sshbuf.readBuffer() },
91048
+ { name: 'q', data: sshbuf.readBuffer() },
91049
+ { name: 'iqmp', data: sshbuf.readBuffer() }
91050
+ ];
91051
+ } else if (alg.match(/^ecdsa-sha2-nistp/)) {
91052
+ privateKeyParts = [ {
91053
+ name: 'd', data: sshbuf.readBuffer()
91054
+ } ];
91055
+ } else if (alg === 'ssh-ed25519') {
91056
+ privateKeyParts = [ {
91057
+ name: 'k', data: sshbuf.readBuffer()
91058
+ } ];
91059
+ } else {
91060
+ throw new Error('Unsupported PPK key type: ' + alg);
91061
+ }
91062
+
91063
+ key = new PrivateKey({
91064
+ type: key.type,
91065
+ parts: key.parts.concat(privateKeyParts)
91066
+ });
91067
+ }
91068
+
90972
91069
  key.comment = comment;
90973
91070
  return (key);
90974
91071
  }
90975
91072
 
91073
+ function derivePPK2EncryptionKey(passphrase) {
91074
+ var hash1 = crypto.createHash('sha1').update(Buffer.concat([
91075
+ Buffer.from([0, 0, 0, 0]),
91076
+ Buffer.from(passphrase)
91077
+ ])).digest();
91078
+ var hash2 = crypto.createHash('sha1').update(Buffer.concat([
91079
+ Buffer.from([0, 0, 0, 1]),
91080
+ Buffer.from(passphrase)
91081
+ ])).digest();
91082
+ return (Buffer.concat([hash1, hash2]).slice(0, 32));
91083
+ }
91084
+
90976
91085
  function splitHeader(line) {
90977
91086
  var idx = line.indexOf(':');
90978
91087
  if (idx === -1)
@@ -91015,7 +91124,7 @@ function wrap(txt, len) {
91015
91124
  return (lines);
91016
91125
  }
91017
91126
 
91018
- },{"../errors":475,"../key":491,"./rfc4253":484,"assert-plus":387,"safer-buffer":470}],484:[function(require,module,exports){
91127
+ },{"../errors":475,"../key":491,"../private-key":492,"../ssh-buffer":494,"./rfc4253":484,"assert-plus":387,"crypto":81,"safer-buffer":470}],484:[function(require,module,exports){
91019
91128
  // Copyright 2015 Joyent, Inc.
91020
91129
 
91021
91130
  module.exports = {
@@ -93159,6 +93268,7 @@ formats['ssh-private'] = require('./formats/ssh-private');
93159
93268
  formats['openssh'] = formats['ssh-private'];
93160
93269
  formats['ssh'] = formats['ssh-private'];
93161
93270
  formats['dnssec'] = require('./formats/dnssec');
93271
+ formats['putty'] = require('./formats/putty');
93162
93272
 
93163
93273
  function PrivateKey(opts) {
93164
93274
  assert.object(opts, 'options');
@@ -93371,7 +93481,7 @@ PrivateKey._oldVersionDetect = function (obj) {
93371
93481
  return ([1, 0]);
93372
93482
  };
93373
93483
 
93374
- },{"./algs":471,"./dhe":473,"./ed-compat":474,"./errors":475,"./fingerprint":476,"./formats/auto":477,"./formats/dnssec":478,"./formats/pem":480,"./formats/pkcs1":481,"./formats/pkcs8":482,"./formats/rfc4253":484,"./formats/ssh-private":485,"./key":491,"./signature":493,"./utils":495,"assert-plus":387,"crypto":81,"safer-buffer":470,"tweetnacl":504,"util":243}],493:[function(require,module,exports){
93484
+ },{"./algs":471,"./dhe":473,"./ed-compat":474,"./errors":475,"./fingerprint":476,"./formats/auto":477,"./formats/dnssec":478,"./formats/pem":480,"./formats/pkcs1":481,"./formats/pkcs8":482,"./formats/putty":483,"./formats/rfc4253":484,"./formats/ssh-private":485,"./key":491,"./signature":493,"./utils":495,"assert-plus":387,"crypto":81,"safer-buffer":470,"tweetnacl":504,"util":243}],493:[function(require,module,exports){
93375
93485
  // Copyright 2015 Joyent, Inc.
93376
93486
 
93377
93487
  module.exports = Signature;