github-issue-tower-defence-management 1.148.3 → 1.148.5
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/CHANGELOG.md +14 -0
- package/bin/adapter/entry-points/console/ui-dist/assets/{index-D7Yt5Ya6.js → index-Cp5oIKAG.js} +1 -1
- package/bin/adapter/entry-points/console/ui-dist/assets/{index-BihdmZb-.css → index-Dihcph6j.css} +1 -1
- package/bin/adapter/entry-points/console/ui-dist/index.html +2 -2
- package/bin/domain/usecases/DailySecurityScanUseCase.js +40 -5
- package/bin/domain/usecases/DailySecurityScanUseCase.js.map +1 -1
- package/package.json +1 -1
- package/src/adapter/entry-points/console/ui/e2e/consoleScenario.spec.ts +4 -5
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleItemDetail.test.tsx +7 -7
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleItemDetail.tsx +10 -13
- package/src/adapter/entry-points/console/ui/src/index.css +0 -8
- package/src/adapter/entry-points/console/ui-dist/assets/{index-D7Yt5Ya6.js → index-Cp5oIKAG.js} +1 -1
- package/src/adapter/entry-points/console/ui-dist/assets/{index-BihdmZb-.css → index-Dihcph6j.css} +1 -1
- package/src/adapter/entry-points/console/ui-dist/index.html +2 -2
- package/src/domain/usecases/DailySecurityScanUseCase.test.ts +226 -5
- package/src/domain/usecases/DailySecurityScanUseCase.ts +65 -8
- package/types/domain/usecases/DailySecurityScanUseCase.d.ts +1 -0
- package/types/domain/usecases/DailySecurityScanUseCase.d.ts.map +1 -1
|
@@ -12,6 +12,8 @@ export type DailySecurityScanConfig = {
|
|
|
12
12
|
|
|
13
13
|
type KevVulnerability = {
|
|
14
14
|
cveID: string;
|
|
15
|
+
vendorProject: string;
|
|
16
|
+
product: string;
|
|
15
17
|
vulnerabilityName: string;
|
|
16
18
|
dateAdded: string;
|
|
17
19
|
};
|
|
@@ -27,6 +29,8 @@ const isKevVulnerability = (value: unknown): value is KevVulnerability => {
|
|
|
27
29
|
const record: Record<string, unknown> = { ...value };
|
|
28
30
|
return (
|
|
29
31
|
typeof record.cveID === 'string' &&
|
|
32
|
+
typeof record.vendorProject === 'string' &&
|
|
33
|
+
typeof record.product === 'string' &&
|
|
30
34
|
typeof record.vulnerabilityName === 'string' &&
|
|
31
35
|
typeof record.dateAdded === 'string'
|
|
32
36
|
);
|
|
@@ -178,13 +182,21 @@ export class DailySecurityScanUseCase {
|
|
|
178
182
|
);
|
|
179
183
|
}
|
|
180
184
|
|
|
181
|
-
const newKevEntries = parsedKev.vulnerabilities
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
185
|
+
const newKevEntries = parsedKev.vulnerabilities.filter(
|
|
186
|
+
(vulnerability) => vulnerability.dateAdded >= yesterdayYmd,
|
|
187
|
+
);
|
|
188
|
+
const usedKevEntries: KevVulnerability[] = [];
|
|
189
|
+
for (const vulnerability of newKevEntries) {
|
|
190
|
+
if (
|
|
191
|
+
await this.isProductPresentInScannedWorkspace(
|
|
192
|
+
config.scanBaseDirectory,
|
|
193
|
+
vulnerability.product,
|
|
194
|
+
)
|
|
195
|
+
) {
|
|
196
|
+
usedKevEntries.push(vulnerability);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (usedKevEntries.length === 0) {
|
|
188
200
|
return;
|
|
189
201
|
}
|
|
190
202
|
|
|
@@ -192,9 +204,54 @@ export class DailySecurityScanUseCase {
|
|
|
192
204
|
org,
|
|
193
205
|
config.kevReportRepo,
|
|
194
206
|
`CISA KEV new additions since ${yesterdayYmd}`,
|
|
195
|
-
|
|
207
|
+
usedKevEntries
|
|
208
|
+
.map(
|
|
209
|
+
(vulnerability) =>
|
|
210
|
+
`- ${vulnerability.dateAdded} ${vulnerability.cveID} ${vulnerability.vulnerabilityName}`,
|
|
211
|
+
)
|
|
212
|
+
.join('\n'),
|
|
196
213
|
[manager],
|
|
197
214
|
[],
|
|
198
215
|
);
|
|
199
216
|
};
|
|
217
|
+
|
|
218
|
+
private isProductPresentInScannedWorkspace = async (
|
|
219
|
+
scanBaseDirectory: string,
|
|
220
|
+
product: string,
|
|
221
|
+
): Promise<boolean> => {
|
|
222
|
+
const { stdout: findOutput } = await this.localCommandRunner.runCommand(
|
|
223
|
+
'find',
|
|
224
|
+
[scanBaseDirectory, '-maxdepth', '3', '-name', '.git', '-type', 'd'],
|
|
225
|
+
);
|
|
226
|
+
const repositoryDirectories = findOutput
|
|
227
|
+
.split('\n')
|
|
228
|
+
.filter((line) => line.length > 0)
|
|
229
|
+
.map((gitDirectory) => gitDirectory.replace(/\/\.git$/, ''));
|
|
230
|
+
|
|
231
|
+
for (const repositoryDirectory of repositoryDirectories) {
|
|
232
|
+
const { stderr, exitCode } = await this.localCommandRunner.runCommand(
|
|
233
|
+
'git',
|
|
234
|
+
[
|
|
235
|
+
'-C',
|
|
236
|
+
repositoryDirectory,
|
|
237
|
+
'grep',
|
|
238
|
+
'-I',
|
|
239
|
+
'-i',
|
|
240
|
+
'-q',
|
|
241
|
+
'-F',
|
|
242
|
+
'-e',
|
|
243
|
+
product,
|
|
244
|
+
],
|
|
245
|
+
);
|
|
246
|
+
if (exitCode === 0) {
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
249
|
+
if (exitCode !== 1) {
|
|
250
|
+
console.error(
|
|
251
|
+
`Failed to search ${repositoryDirectory} for ${product}: ${stderr}`,
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return false;
|
|
256
|
+
};
|
|
200
257
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DailySecurityScanUseCase.d.ts","sourceRoot":"","sources":["../../../src/domain/usecases/DailySecurityScanUseCase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,c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