@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.
- package/.eslintignore +1 -0
- package/.eslintrc.js +12 -12
- package/CHANGELOG.md +24 -0
- package/README.md +270 -68
- package/adapter.js +2607 -49
- package/adapterBase.js +544 -17
- package/entities/.generic/action.json +109 -0
- package/entities/.generic/schema.json +23 -0
- package/entities/.system/action.json +5 -5
- package/entities/APISettings/action.json +3 -3
- package/entities/AccessLayer/action.json +6 -6
- package/entities/AccessRole/action.json +6 -6
- package/entities/AccessRule/action.json +6 -6
- package/entities/AccessSection/action.json +5 -5
- package/entities/AddressRange/action.json +6 -6
- package/entities/Administrator/action.json +7 -7
- package/entities/Application/action.json +6 -6
- package/entities/ApplicationCategory/action.json +6 -6
- package/entities/ApplicationGroup/action.json +6 -6
- package/entities/DNSDomain/action.json +6 -6
- package/entities/DataCenter/action.json +4 -4
- package/entities/DataCenterObject/action.json +5 -5
- package/entities/Domain/action.json +6 -6
- package/entities/DynamicObject/action.json +6 -6
- package/entities/GlobalAssignment/action.json +7 -7
- package/entities/GlobalDomain/action.json +3 -3
- package/entities/Group/action.json +6 -6
- package/entities/GroupWithExclusion/action.json +6 -6
- package/entities/Host/action.json +6 -6
- package/entities/IPS/action.json +5 -5
- package/entities/IPSExtendedAttributes/action.json +3 -3
- package/entities/LoginMessage/action.json +3 -3
- package/entities/Misc/action.json +15 -15
- package/entities/MultiDomainServerMDS/action.json +3 -3
- package/entities/MulticastAddressRange/action.json +6 -6
- package/entities/NATRule/action.json +6 -6
- package/entities/NATSection/action.json +5 -5
- package/entities/Network/action.json +6 -6
- package/entities/OPSECApplication/action.json +6 -6
- package/entities/Placeholder/action.json +2 -2
- package/entities/Policy/action.json +3 -3
- package/entities/PolicyPackage/action.json +6 -6
- package/entities/SecurityZone/action.json +6 -6
- package/entities/ServiceDCERPC/action.json +6 -6
- package/entities/ServiceGroup/action.json +6 -6
- package/entities/ServiceICMP/action.json +6 -6
- package/entities/ServiceICMP6/action.json +6 -6
- package/entities/ServiceOther/action.json +6 -6
- package/entities/ServiceRPC/action.json +6 -6
- package/entities/ServiceSCTP/action.json +6 -6
- package/entities/ServiceTCP/action.json +6 -6
- package/entities/ServiceUDP/action.json +6 -6
- package/entities/Session/action.json +10 -10
- package/entities/SessionManagement/action.json +7 -7
- package/entities/SimpleGateway/action.json +6 -6
- package/entities/Tags/action.json +6 -6
- package/entities/ThreatEmulation/action.json +2 -2
- package/entities/ThreatException/action.json +6 -6
- package/entities/ThreatExceptionGroup/action.json +6 -6
- package/entities/ThreatIndicator/action.json +6 -6
- package/entities/ThreatLayer/action.json +6 -6
- package/entities/ThreatProfile/action.json +6 -6
- package/entities/ThreatProtection/action.json +6 -6
- package/entities/ThreatRule/action.json +6 -6
- package/entities/Time/action.json +6 -6
- package/entities/TimeGroup/action.json +6 -6
- package/entities/TrustedClient/action.json +6 -6
- package/entities/UpdatableObject/action.json +5 -5
- package/entities/UpdatableObjectsRepository/action.json +3 -3
- package/entities/VPNCommunityMeshed/action.json +6 -6
- package/entities/VPNCommunityStar/action.json +6 -6
- package/entities/Wildcard/action.json +6 -6
- package/error.json +6 -0
- package/package.json +46 -24
- package/pronghorn.json +570 -0
- package/propertiesSchema.json +84 -11
- package/refs?service=git-upload-pack +0 -0
- package/report/updateReport1594060676288.json +95 -0
- package/report/updateReport1614705421970.json +95 -0
- package/report/updateReport1646177180887.json +95 -0
- package/sampleProperties.json +31 -12
- package/test/integration/adapterTestBasicGet.js +85 -0
- package/test/integration/adapterTestConnectivity.js +93 -0
- package/test/integration/adapterTestIntegration.js +30 -11
- package/test/unit/adapterBaseTestUnit.js +944 -0
- package/test/unit/adapterTestUnit.js +638 -12
- package/utils/addAuth.js +94 -0
- package/utils/artifactize.js +9 -14
- package/utils/basicGet.js +50 -0
- package/utils/checkMigrate.js +63 -0
- package/utils/entitiesToDB.js +224 -0
- package/utils/findPath.js +74 -0
- package/utils/modify.js +154 -0
- package/utils/packModificationScript.js +1 -1
- package/utils/patches2bundledDeps.js +90 -0
- package/utils/pre-commit.sh +1 -1
- package/utils/removeHooks.js +20 -0
- package/utils/tbScript.js +169 -0
- package/utils/tbUtils.js +451 -0
- package/utils/troubleshootingAdapter.js +190 -0
- 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 =
|
|
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
|
|
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);
|