-
Notifications
You must be signed in to change notification settings - Fork 179
Expand file tree
/
Copy pathssh.test.js
More file actions
69 lines (61 loc) · 1.91 KB
/
ssh.test.js
File metadata and controls
69 lines (61 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const { startSecurityTest, Time } = require('./sdk');
test(
'finds a few medium severity findings for ssh-service',
async () => {
const securityTest = await startSecurityTest({
context: 'ssh-service ssh',
metaData: {},
name: 'ssh',
target: {
name: 'ssh-service ssh',
location: 'ssh-service',
attributes: {},
},
});
const { report } = securityTest;
const findings = report.findings.map(
({ description, category, name, osi_layer, severity }) => ({
description,
category,
name,
osi_layer,
severity,
})
);
expect(findings).toContainEqual({
category: 'SSH Service',
name: 'SSH Service Information',
osi_layer: 'NETWORK',
severity: 'INFORMATIONAL',
});
expect(findings).toContainEqual({
description: 'Deprecated / discouraged SSH key algorithms are used',
category: 'SSH Policy Violation',
name: 'Insecure SSH Key Algorithms',
osi_layer: 'NETWORK',
severity: 'MEDIUM',
});
expect(findings).toContainEqual({
description: 'Deprecated / discouraged SSH MAC algorithms are used',
category: 'SSH Policy Violation',
name: 'Insecure SSH MAC Algorithms',
osi_layer: 'NETWORK',
severity: 'MEDIUM',
});
expect(findings).toContainEqual({
description: 'Discouraged SSH authentication methods are used',
category: 'SSH Policy Violation',
name: 'Discouraged SSH authentication methods',
osi_layer: 'NETWORK',
severity: 'MEDIUM',
});
expect(
findings
.filter(({ name }) => name !== 'SSH Service Information')
.filter(({ name }) => name !== 'Insecure SSH Key Algorithms')
.filter(({ name }) => name !== 'Insecure SSH MAC Algorithms')
.filter(({ name }) => name !== 'Discouraged SSH authentication methods')
).toEqual([]);
},
2 * Time.Minute
);