|
3 | 3 | // SPDX-License-Identifier: Apache-2.0 |
4 | 4 |
|
5 | 5 | import * as path from "path"; |
6 | | -import { handle, matches, getNotificationChannels, mapToEndPoint } from "./hook"; |
| 6 | +import { matches, getNotificationChannels, mapToEndPoint } from "./hook"; |
7 | 7 | import { Finding } from "./model/Finding"; |
8 | 8 | import { NotificationChannel } from "./model/NotificationChannel"; |
9 | 9 | import { NotifierType } from "./NotifierType"; |
10 | 10 |
|
11 | | -const scan = { |
12 | | - metadata: { |
13 | | - uid: "09988cdf-1fc7-4f85-95ee-1b1d65dbc7cc", |
14 | | - name: "demo-scan-1601086432", |
15 | | - namespace: "my-scans", |
16 | | - creationTimestamp: "2021-01-01T14:29:25Z", |
17 | | - labels: { |
18 | | - company: "iteratec", |
19 | | - "attack-surface": "external", |
20 | | - }, |
21 | | - }, |
22 | | - spec: { |
23 | | - scanType: "Nmap", |
24 | | - parameters: ["-Pn", "localhost"], |
25 | | - }, |
26 | | - status: { |
27 | | - findingDownloadLink: |
28 | | - "https://my-secureCodeBox-instance.com/scan-b9as-sdweref--sadf-asdfsdf-dasdgf-asdffdsfa7/findings.json", |
29 | | - findings: { |
30 | | - categories: { |
31 | | - "A Client Error response code was returned by the server": 1, |
32 | | - "Information Disclosure - Sensitive Information in URL": 1, |
33 | | - "Strict-Transport-Security Header Not Set": 1, |
34 | | - }, |
35 | | - count: 3, |
36 | | - severities: { |
37 | | - high: 10, |
38 | | - medium: 5, |
39 | | - low: 2, |
40 | | - informational: 1, |
41 | | - }, |
42 | | - }, |
43 | | - finishedAt: "2020-05-25T02:38:13Z", |
44 | | - rawResultDownloadLink: |
45 | | - "https://my-secureCodeBox-instance.com/scan-blkfsdg-sdgfsfgd-sfg-sdfg-dfsg-gfs98-e8af2172caa7/zap-results.json?Expires=1601691232", |
46 | | - rawResultFile: "zap-results.json", |
47 | | - rawResultType: "zap-json", |
48 | | - state: "Done", |
49 | | - }, |
50 | | -}; |
51 | | - |
52 | | -const findings = [ |
53 | | - { |
54 | | - name: "SSH Service", |
55 | | - description: "SSH Service Information", |
56 | | - category: "SSH Service", |
57 | | - osi_layer: "APPLICATION", |
58 | | - severity: "INFORMATIONAL", |
59 | | - reference: {}, |
60 | | - hint: "", |
61 | | - location: "dummy-ssh.demo-apps.svc", |
62 | | - attributes: { |
63 | | - hostname: "dummy-ssh.demo-apps.svc", |
64 | | - ip_address: "10.102.131.102", |
65 | | - server_banner: "SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.8", |
66 | | - ssh_version: 2, |
67 | | - os_cpe: "o:canonical:ubuntu:16.04", |
68 | | - ssh_lib_cpe: "a:openssh:openssh:7.2p2", |
69 | | - compliance_policy: "Mozilla Modern", |
70 | | - compliant: false, |
71 | | - grade: "D", |
72 | | - references: ["https://wiki.mozilla.org/Security/Guidelines/OpenSSH"], |
73 | | - auth_methods: ["publickey", "password"], |
74 | | - key_algorithms: [ |
75 | | - "curve25519-sha256@libssh.org", |
76 | | - "ecdh-sha2-nistp256", |
77 | | - "ecdh-sha2-nistp384", |
78 | | - "ecdh-sha2-nistp521", |
79 | | - "diffie-hellman-group-exchange-sha256", |
80 | | - "diffie-hellman-group14-sha1", |
81 | | - ], |
82 | | - encryption_algorithms: [ |
83 | | - "chacha20-poly1305@openssh.com", |
84 | | - "aes128-ctr", |
85 | | - "aes192-ctr", |
86 | | - "aes256-ctr", |
87 | | - "aes128-gcm@openssh.com", |
88 | | - "aes256-gcm@openssh.com", |
89 | | - ], |
90 | | - mac_algorithms: [ |
91 | | - "umac-64-etm@openssh.com", |
92 | | - "umac-128-etm@openssh.com", |
93 | | - "hmac-sha2-256-etm@openssh.com", |
94 | | - "hmac-sha2-512-etm@openssh.com", |
95 | | - "hmac-sha1-etm@openssh.com", |
96 | | - "umac-64@openssh.com", |
97 | | - "umac-128@openssh.com", |
98 | | - "hmac-sha2-256", |
99 | | - "hmac-sha2-512", |
100 | | - "hmac-sha1", |
101 | | - ], |
102 | | - compression_algorithms: ["none", "zlib@openssh.com"], |
103 | | - }, |
104 | | - id: "17ac9886-d083-4c58-8518-557aa3b38d2d", |
105 | | - }, |
106 | | - { |
107 | | - name: "Insecure SSH Key Algorithms", |
108 | | - description: "Deprecated / discouraged SSH key algorithms are used", |
109 | | - category: "SSH Policy Violation", |
110 | | - osi_layer: "NETWORK", |
111 | | - severity: "MEDIUM", |
112 | | - reference: {}, |
113 | | - hint: "Remove these key exchange algorithms: diffie-hellman-group14-sha1", |
114 | | - location: "dummy-ssh.demo-apps.svc", |
115 | | - attributes: { |
116 | | - hostname: "dummy-ssh.demo-apps.svc", |
117 | | - ip_address: "10.102.131.102", |
118 | | - payload: ["diffie-hellman-group14-sha1"], |
119 | | - }, |
120 | | - id: "650c5ed1-00fb-44e3-933c-515dca4a1eda", |
121 | | - }, |
122 | | - { |
123 | | - name: "Insecure SSH MAC Algorithms", |
124 | | - description: "Deprecated / discouraged SSH MAC algorithms are used", |
125 | | - category: "SSH Policy Violation", |
126 | | - osi_layer: "NETWORK", |
127 | | - severity: "MEDIUM", |
128 | | - reference: {}, |
129 | | - hint: |
130 | | - "Remove these MAC algorithms: umac-64-etm@openssh.com, hmac-sha1-etm@openssh.com, umac-64@openssh.com, hmac-sha1", |
131 | | - location: "dummy-ssh.demo-apps.svc", |
132 | | - attributes: { |
133 | | - hostname: "dummy-ssh.demo-apps.svc", |
134 | | - ip_address: "10.102.131.102", |
135 | | - payload: [ |
136 | | - "umac-64-etm@openssh.com", |
137 | | - "hmac-sha1-etm@openssh.com", |
138 | | - "umac-64@openssh.com", |
139 | | - "hmac-sha1", |
140 | | - ], |
141 | | - }, |
142 | | - id: "5b681ed0-b509-400b-bb1e-ae839bb1b766", |
143 | | - }, |
144 | | - { |
145 | | - name: "Discouraged SSH authentication methods", |
146 | | - description: "Discouraged SSH authentication methods are used", |
147 | | - category: "SSH Policy Violation", |
148 | | - osi_layer: "NETWORK", |
149 | | - severity: "MEDIUM", |
150 | | - reference: {}, |
151 | | - hint: "Remove these authentication methods: password", |
152 | | - location: "dummy-ssh.demo-apps.svc", |
153 | | - attributes: { |
154 | | - hostname: "dummy-ssh.demo-apps.svc", |
155 | | - ip_address: "10.102.131.102", |
156 | | - payload: ["password"], |
157 | | - }, |
158 | | - id: "4485916d-3747-4c16-a730-a9b1146dd9a2", |
159 | | - }, |
160 | | -]; |
161 | | - |
162 | 11 | test("Should Match for High Severity Findings", async () => { |
163 | 12 | const finding: Finding = { |
164 | 13 | name: "test finding", |
|
0 commit comments