@itentialopensource/adapter-checkpoint_management 0.2.3 → 0.2.6

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.
Files changed (101) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.js +12 -12
  3. package/CHANGELOG.md +24 -0
  4. package/README.md +270 -68
  5. package/adapter.js +2607 -49
  6. package/adapterBase.js +544 -17
  7. package/entities/.generic/action.json +109 -0
  8. package/entities/.generic/schema.json +23 -0
  9. package/entities/.system/action.json +5 -5
  10. package/entities/APISettings/action.json +3 -3
  11. package/entities/AccessLayer/action.json +6 -6
  12. package/entities/AccessRole/action.json +6 -6
  13. package/entities/AccessRule/action.json +6 -6
  14. package/entities/AccessSection/action.json +5 -5
  15. package/entities/AddressRange/action.json +6 -6
  16. package/entities/Administrator/action.json +7 -7
  17. package/entities/Application/action.json +6 -6
  18. package/entities/ApplicationCategory/action.json +6 -6
  19. package/entities/ApplicationGroup/action.json +6 -6
  20. package/entities/DNSDomain/action.json +6 -6
  21. package/entities/DataCenter/action.json +4 -4
  22. package/entities/DataCenterObject/action.json +5 -5
  23. package/entities/Domain/action.json +6 -6
  24. package/entities/DynamicObject/action.json +6 -6
  25. package/entities/GlobalAssignment/action.json +7 -7
  26. package/entities/GlobalDomain/action.json +3 -3
  27. package/entities/Group/action.json +6 -6
  28. package/entities/GroupWithExclusion/action.json +6 -6
  29. package/entities/Host/action.json +6 -6
  30. package/entities/IPS/action.json +5 -5
  31. package/entities/IPSExtendedAttributes/action.json +3 -3
  32. package/entities/LoginMessage/action.json +3 -3
  33. package/entities/Misc/action.json +15 -15
  34. package/entities/MultiDomainServerMDS/action.json +3 -3
  35. package/entities/MulticastAddressRange/action.json +6 -6
  36. package/entities/NATRule/action.json +6 -6
  37. package/entities/NATSection/action.json +5 -5
  38. package/entities/Network/action.json +6 -6
  39. package/entities/OPSECApplication/action.json +6 -6
  40. package/entities/Placeholder/action.json +2 -2
  41. package/entities/Policy/action.json +3 -3
  42. package/entities/PolicyPackage/action.json +6 -6
  43. package/entities/SecurityZone/action.json +6 -6
  44. package/entities/ServiceDCERPC/action.json +6 -6
  45. package/entities/ServiceGroup/action.json +6 -6
  46. package/entities/ServiceICMP/action.json +6 -6
  47. package/entities/ServiceICMP6/action.json +6 -6
  48. package/entities/ServiceOther/action.json +6 -6
  49. package/entities/ServiceRPC/action.json +6 -6
  50. package/entities/ServiceSCTP/action.json +6 -6
  51. package/entities/ServiceTCP/action.json +6 -6
  52. package/entities/ServiceUDP/action.json +6 -6
  53. package/entities/Session/action.json +10 -10
  54. package/entities/SessionManagement/action.json +7 -7
  55. package/entities/SimpleGateway/action.json +6 -6
  56. package/entities/Tags/action.json +6 -6
  57. package/entities/ThreatEmulation/action.json +2 -2
  58. package/entities/ThreatException/action.json +6 -6
  59. package/entities/ThreatExceptionGroup/action.json +6 -6
  60. package/entities/ThreatIndicator/action.json +6 -6
  61. package/entities/ThreatLayer/action.json +6 -6
  62. package/entities/ThreatProfile/action.json +6 -6
  63. package/entities/ThreatProtection/action.json +6 -6
  64. package/entities/ThreatRule/action.json +6 -6
  65. package/entities/Time/action.json +6 -6
  66. package/entities/TimeGroup/action.json +6 -6
  67. package/entities/TrustedClient/action.json +6 -6
  68. package/entities/UpdatableObject/action.json +5 -5
  69. package/entities/UpdatableObjectsRepository/action.json +3 -3
  70. package/entities/VPNCommunityMeshed/action.json +6 -6
  71. package/entities/VPNCommunityStar/action.json +6 -6
  72. package/entities/Wildcard/action.json +6 -6
  73. package/error.json +6 -0
  74. package/package.json +46 -24
  75. package/pronghorn.json +570 -0
  76. package/propertiesSchema.json +84 -11
  77. package/refs?service=git-upload-pack +0 -0
  78. package/report/updateReport1594060676288.json +95 -0
  79. package/report/updateReport1614705421970.json +95 -0
  80. package/report/updateReport1646177180887.json +95 -0
  81. package/sampleProperties.json +31 -12
  82. package/test/integration/adapterTestBasicGet.js +85 -0
  83. package/test/integration/adapterTestConnectivity.js +93 -0
  84. package/test/integration/adapterTestIntegration.js +30 -11
  85. package/test/unit/adapterBaseTestUnit.js +944 -0
  86. package/test/unit/adapterTestUnit.js +638 -12
  87. package/utils/addAuth.js +94 -0
  88. package/utils/artifactize.js +9 -14
  89. package/utils/basicGet.js +50 -0
  90. package/utils/checkMigrate.js +63 -0
  91. package/utils/entitiesToDB.js +224 -0
  92. package/utils/findPath.js +74 -0
  93. package/utils/modify.js +154 -0
  94. package/utils/packModificationScript.js +1 -1
  95. package/utils/patches2bundledDeps.js +90 -0
  96. package/utils/pre-commit.sh +1 -1
  97. package/utils/removeHooks.js +20 -0
  98. package/utils/tbScript.js +169 -0
  99. package/utils/tbUtils.js +451 -0
  100. package/utils/troubleshootingAdapter.js +190 -0
  101. package/gl-code-quality-report.json +0 -1
@@ -0,0 +1,93 @@
1
+ /* @copyright Itential, LLC 2020 */
2
+
3
+ /* global describe it context before after */
4
+ /* eslint no-unused-vars: warn */
5
+
6
+ const mocha = require('mocha');
7
+ const assert = require('assert');
8
+ const diagnostics = require('network-diagnostics');
9
+
10
+ let host;
11
+ process.argv.forEach((val) => {
12
+ if (val.indexOf('--HOST') === 0) {
13
+ [, host] = val.split('=');
14
+ }
15
+ });
16
+
17
+ describe('[integration] Adapter Test', () => {
18
+ context(`Testing network connection on ${host}`, () => {
19
+ before(() => {
20
+ diagnostics.setTestURL(host);
21
+ });
22
+
23
+ after((done) => {
24
+ done();
25
+ });
26
+
27
+ it('DNS resolve', (done) => {
28
+ diagnostics.haveDNS((result) => {
29
+ try {
30
+ assert.equal(result, true);
31
+ done();
32
+ } catch (error) {
33
+ done(error);
34
+ }
35
+ });
36
+ });
37
+
38
+ it('Responds to ping', (done) => {
39
+ diagnostics.havePing((result) => {
40
+ try {
41
+ assert.equal(result, true);
42
+ done();
43
+ } catch (error) {
44
+ done(error);
45
+ }
46
+ });
47
+ });
48
+
49
+ it('Support HTTP on port 80', (done) => {
50
+ diagnostics.haveHTTP((result) => {
51
+ try {
52
+ assert.equal(result, true);
53
+ done();
54
+ } catch (error) {
55
+ done(error);
56
+ }
57
+ });
58
+ });
59
+
60
+ it('Support HTTPS on port 443', (done) => {
61
+ diagnostics.haveHTTPS((result) => {
62
+ try {
63
+ assert.equal(result, true);
64
+ done();
65
+ } catch (error) {
66
+ done(error);
67
+ }
68
+ });
69
+ });
70
+
71
+ it('Support IPv4', (done) => {
72
+ diagnostics.haveIPv4Async((result) => {
73
+ try {
74
+ assert.equal(result, true);
75
+ done();
76
+ } catch (error) {
77
+ done(error);
78
+ }
79
+ });
80
+ });
81
+
82
+ it('Support IPv6', (done) => {
83
+ diagnostics.haveIPv6Async((result) => {
84
+ try {
85
+ assert.equal(result, true);
86
+ done();
87
+ } catch (error) {
88
+ done(error);
89
+ }
90
+ });
91
+ });
92
+ });
93
+ });
@@ -13,7 +13,10 @@ const winston = require('winston');
13
13
  const { expect } = require('chai');
14
14
  const { use } = require('chai');
15
15
  const td = require('testdouble');
16
+ const util = require('util');
17
+ const pronghorn = require('../../pronghorn.json');
16
18
 
19
+ pronghorn.methodsByName = pronghorn.methods.reduce((result, meth) => ({ ...result, [meth.name]: meth }), {});
17
20
  const anything = td.matchers.anything();
18
21
 
19
22
  // stub and attemptTimeout are used throughout the code so set them here
@@ -49,6 +52,7 @@ global.pronghornProps = {
49
52
  base_path: '/api',
50
53
  version: 'v1.0',
51
54
  cache_location: 'none',
55
+ encode_pathvars: true,
52
56
  save_metric: false,
53
57
  stub,
54
58
  protocol,
@@ -61,11 +65,16 @@ global.pronghornProps = {
61
65
  token_timeout: -1,
62
66
  token_cache: 'local',
63
67
  auth_field: 'header.headers.Authorization',
64
- auth_field_format: 'Basic {b64}{username}:{password}{/b64}'
68
+ auth_field_format: 'Basic {b64}{username}:{password}{/b64}',
69
+ auth_logging: false,
70
+ client_id: '',
71
+ client_secret: '',
72
+ grant_type: ''
65
73
  },
66
74
  healthcheck: {
67
75
  type: 'startup',
68
- frequency: 60000
76
+ frequency: 60000,
77
+ query_object: {}
69
78
  },
70
79
  throttle: {
71
80
  throttle_enabled: false,
@@ -74,7 +83,13 @@ global.pronghornProps = {
74
83
  max_in_queue: 1000,
75
84
  concurrent_max: 1,
76
85
  expire_timeout: 0,
77
- avg_runtime: 200
86
+ avg_runtime: 200,
87
+ priorities: [
88
+ {
89
+ value: 0,
90
+ percent: 100
91
+ }
92
+ ]
78
93
  },
79
94
  request: {
80
95
  number_redirects: 0,
@@ -90,13 +105,16 @@ global.pronghornProps = {
90
105
  },
91
106
  healthcheck_on_timeout: false,
92
107
  return_raw: true,
93
- archiving: false
108
+ archiving: false,
109
+ return_request: false
94
110
  },
95
111
  proxy: {
96
112
  enabled: false,
97
113
  host: '',
98
114
  port: 1,
99
- protocol: 'http'
115
+ protocol: 'http',
116
+ username: '',
117
+ password: ''
100
118
  },
101
119
  ssl: {
102
120
  ecdhCurve: '',
@@ -159,7 +177,7 @@ process.argv.forEach((val) => {
159
177
  });
160
178
 
161
179
  // need to set global logging
162
- global.log = new (winston.Logger)({
180
+ global.log = winston.createLogger({
163
181
  level: logLevel,
164
182
  levels: myCustomLevels.levels,
165
183
  transports: [
@@ -253,7 +271,7 @@ function saveMockData(entityName, actionName, descriptor, responseData) {
253
271
  };
254
272
 
255
273
  // get the object for method we're trying to change.
256
- const currentMethodAction = parsedJson.actions.find(obj => obj.name === actionName);
274
+ const currentMethodAction = parsedJson.actions.find((obj) => obj.name === actionName);
257
275
 
258
276
  // if the method was not found - should never happen but...
259
277
  if (!currentMethodAction) {
@@ -261,12 +279,12 @@ function saveMockData(entityName, actionName, descriptor, responseData) {
261
279
  }
262
280
 
263
281
  // if there is a response object, we want to replace the Response object. Otherwise we'll create one.
264
- const actionResponseObj = currentMethodAction.responseObjects.find(obj => obj.type === descriptor);
282
+ const actionResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === descriptor);
265
283
 
266
284
  // Add the action responseObj back into the array of response objects.
267
285
  if (!actionResponseObj) {
268
286
  // if there is a default response object, we want to get the key.
269
- const defaultResponseObj = currentMethodAction.responseObjects.find(obj => obj.type === 'default');
287
+ const defaultResponseObj = currentMethodAction.responseObjects.find((obj) => obj.type === 'default');
270
288
 
271
289
  // save the default key into the new response object
272
290
  if (defaultResponseObj) {
@@ -297,9 +315,8 @@ function saveMockData(entityName, actionName, descriptor, responseData) {
297
315
  return false;
298
316
  }
299
317
 
300
-
301
318
  // require the adapter that we are going to be using
302
- const CheckpointManagement = require('../../adapter.js');
319
+ const CheckpointManagement = require('../../adapter');
303
320
 
304
321
  // begin the testing - these should be pretty well defined between the describe and the it!
305
322
  describe('[integration] Checkpoint_Management Adapter Test', () => {
@@ -330,6 +347,8 @@ describe('[integration] Checkpoint_Management Adapter Test', () => {
330
347
  try {
331
348
  assert.notEqual(null, a);
332
349
  assert.notEqual(undefined, a);
350
+ const checkId = global.pronghornProps.adapterProps.adapters[0].id;
351
+ assert.equal(checkId, a.id);
333
352
  assert.notEqual(null, a.allProps);
334
353
  const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
335
354
  assert.equal(check, a.healthcheckType);