Skip to content

Commit fe665d0

Browse files
committed
work in progress
1 parent ef2c5cb commit fe665d0

12 files changed

Lines changed: 747 additions & 890 deletions

config/devel.jsonc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
"search": {
99
// minimum versions for servers that are compatible with current code
1010
"minServer": [
11-
"opensearch:2.10.0"
11+
"opensearch:2.10.0",
12+
"opensearch:3.5.0"
1213
],
1314
// URL to reach search server
14-
"providerEndpoint": "https://admin:admin@localhost:9200",
15+
"providerEndpoint": "https://admin:Test-PassW0rd-2026@localhost:9200",
1516
// index on search server related to searching CVEs
16-
"index": "e2e-cve-test-index-1109",
17+
"index": "e2e-cve-test-index-1137",
1718
// setting this to FALSE (recommended) requires an SSL cert to access the search server
1819
// The only time this should be allowed to be true is when developing or testing
1920
// using containers that do not have SSL certs

package-lock.json

Lines changed: 482 additions & 666 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/adapters/config/AppConfig.test.int.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ describe(`AppConfig`, () => {
1717
const index = config.get('appConfig.search.index');
1818
// console.log(`info: ${JSON.stringify(info, null, 2)}`)
1919
// expect(index).toBe('fixtures-search-baseline-1008');
20-
expect(config.get('appConfig.search.minServer').length).toBe(1);
20+
const minServer = config.get('appConfig.search.minServer') as string[];
21+
expect(minServer.length).toBe(1);
2122
});
2223

2324

src/adapters/config/AppConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class AppConfig {
7373
* `appConfig`
7474
*/
7575
static set(path:string, value: string): void {
76-
config.appConfig[path]=value
76+
config['appConfig'][path] = value
7777
// AppConfig._sVariables[path] = variable
7878
}
7979
}

src/search/BasicSearchManager.test.e2e.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe(`BasicSearchManager (e2e)`, () => {
1212
const searchProviderSpec = SearchProviderSpec.getDefaultSearchProviderSpec()
1313
// const _testPipeline = `jest_test_ingest_pipeline`
1414

15-
const numFound_office = 9
15+
const numFound_office = 11
1616

1717
it(`search(simpleString) correctly searches across all fields`, async () => {
1818
const searchManager = new BasicSearchManager(searchProviderSpec);
@@ -30,7 +30,7 @@ describe(`BasicSearchManager (e2e)`, () => {
3030
const searchResult: SearchResultData = resp.data as SearchResultData
3131
expect(searchResult.hits.total.value).toBe(numFound_office);
3232
const hits = searchResult.hits.hits;
33-
const expectedCveIds = ["CVE-2017-8501", "CVE-2017-8570", "CVE-2018-0804", "CVE-2018-0807", "CVE-2022-30190", "CVE-2022-30693", "CVE-2022-38745", "CVE-2022-38756", "CVE-2022-39024"];
33+
const expectedCveIds = ["CVE-2017-8501", "CVE-2017-8570", "CVE-2018-0804", "CVE-2018-0807", "CVE-2022-30190", "CVE-2022-30693", "CVE-2022-38745", "CVE-2022-38756", "CVE-2022-39024", "CVE-2024-49065", "CVE-2024-49142"];
3434
const hitCveIds = searchResult.hits.hits.map(e => e['_id']).sort();
3535
expect(hitCveIds).toMatchObject(expectedCveIds);
3636
});
@@ -124,8 +124,8 @@ describe(`BasicSearchManager (e2e)`, () => {
124124
// for (let i = 0; i < hits.total.value; i++) {
125125
// console.log(`cveIDs: ${i}: ${hits.hits[i]._source.cveMetadata.cveId}`);
126126
// }
127-
expect(hits.hits[8]._source.cveMetadata.cveId).toBe('CVE-2017-8501');
128-
expect(hits.hits[0]._source.cveMetadata.cveId).toBe('CVE-2022-39024');
127+
expect(hits.hits[10]._source.cveMetadata.cveId).toBe('CVE-2017-8501');
128+
expect(hits.hits[0]._source.cveMetadata.cveId).toBe('CVE-2024-49142');
129129
});
130130

131131

@@ -151,8 +151,8 @@ describe(`BasicSearchManager (e2e)`, () => {
151151
// for (let i = 0; i < hits.total.value; i++) {
152152
// console.log(`cveIDs: ${i}: ${hits.hits[i]._source.cveMetadata.cveId}`);
153153
// }
154-
expect(hits.hits[0]._source.cveMetadata.cveId).toBe('CVE-2022-38745');
155-
expect(hits.hits[2]._source.cveMetadata.cveId).toBe('CVE-2022-30190');
154+
expect(hits.hits[0]._source.cveMetadata.cveId).toBe('CVE-2022-39024');
155+
expect(hits.hits[2]._source.cveMetadata.cveId).toBe('CVE-2022-38745');
156156
});
157157

158158
// ----- spock test for ok search() against a test opensearch instance

src/search/SearchQueryBuilder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class SearchQueryBuilder {
7373
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
7474

7575
// if there are any errors, return result which already contains errors and notes
76-
if (!result.isOk()) {
76+
if (result && !result.isOk()) {
7777
return result;
7878
}
7979

src/search/SearchRequest.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,13 @@ export class SearchRequest {
186186
}
187187
})
188188
this._searchText = newSearchText.trim()
189-
result.data = {
190-
searchTextType: overallType,
191-
expression,
192-
processedSearchText: this._searchText
193-
};
189+
if (result) {
190+
result.data = {
191+
searchTextType: overallType,
192+
expression,
193+
processedSearchText: this._searchText
194+
};
195+
}
194196
// errorIds.forEach(id => {
195197
// result.pushErrors(id);
196198
// })

src/search/__snapshots__/BasicSearchManager.test.e2e.ts.snap

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -157,31 +157,31 @@ Object {
157157
158158
exports[`BasicSearchManager (e2e) search("office") correctly returns expected data (ok CveResult) 1`] = `
159159
Object {
160-
"_id": "CVE-2022-39024",
160+
"_id": "CVE-2024-49142",
161161
"_index": Any<String>,
162162
"_score": null,
163163
"_source": Object {
164164
"containers": Object {
165165
"cna": Object {
166166
"descriptions": Array [
167167
Object {
168-
"value": "U-Office Force Bulletin function has insufficient filtering for special characters. An unauthenticated remote attacker can exploit this vulnerability to inject JavaScript and perform XSS (Reflected Cross-Site Scripting) attack.",
168+
"value": "Microsoft Access Remote Code Execution Vulnerability",
169169
},
170170
],
171171
},
172172
},
173173
"cveMetadata": Object {
174-
"assignerOrgId": "cded6c7f-6ce5-4948-8f87-aa7a3bbb6b0e",
175-
"assignerShortName": "twcert",
176-
"cveId": "CVE-2022-39024",
177-
"datePublished": "2022-10-31T06:40:36.532745Z",
178-
"dateReserved": "2022-08-30T00:00:00",
179-
"dateUpdated": "2024-09-16T20:07:27.280Z",
174+
"assignerOrgId": "f38d906d-7342-40ea-92c1-6c4a2c6478c8",
175+
"assignerShortName": "microsoft",
176+
"cveId": "CVE-2024-49142",
177+
"datePublished": "2024-12-10T17:49:33.983Z",
178+
"dateReserved": "2024-10-11T20:57:49.214Z",
179+
"dateUpdated": "2025-05-13T15:25:32.461Z",
180180
"state": "PUBLISHED",
181181
},
182182
},
183183
"sort": Array [
184-
"CVE-2022-39024",
184+
"CVE-2024-49142",
185185
],
186186
}
187187
`;
@@ -478,32 +478,31 @@ Object {
478478
479479
exports[`BasicSearchManager (e2e) search(microsoft ???? office ?????????) correctly returns expected data (ok CveResult) 1`] = `
480480
Object {
481-
"_id": "CVE-2022-30190",
481+
"_id": "CVE-2024-49142",
482482
"_index": Any<String>,
483483
"_score": null,
484484
"_source": Object {
485485
"containers": Object {
486486
"cna": Object {
487487
"descriptions": Array [
488488
Object {
489-
"value": "A remote code execution vulnerability exists when MSDT is called using the URL protocol from a calling application such as Word. An attacker who successfully exploits this vulnerability can run arbitrary code with the privileges of the calling application. The attacker can then install programs, view, change, or delete data, or create new accounts in the context allowed by the user’s rights.
490-
Please see the MSRC Blog Entry for important information about steps you can take to protect your system from this vulnerability.",
489+
"value": "Microsoft Access Remote Code Execution Vulnerability",
491490
},
492491
],
493492
},
494493
},
495494
"cveMetadata": Object {
496495
"assignerOrgId": "f38d906d-7342-40ea-92c1-6c4a2c6478c8",
497496
"assignerShortName": "microsoft",
498-
"cveId": "CVE-2022-30190",
499-
"datePublished": "2022-06-01T20:10:17.000Z",
500-
"dateReserved": "2022-05-03T00:00:00.000Z",
501-
"dateUpdated": "2025-02-04T19:04:33.929Z",
497+
"cveId": "CVE-2024-49142",
498+
"datePublished": "2024-12-10T17:49:33.983Z",
499+
"dateReserved": "2024-10-11T20:57:49.214Z",
500+
"dateUpdated": "2025-05-13T15:25:32.461Z",
502501
"state": "PUBLISHED",
503502
},
504503
},
505504
"sort": Array [
506-
"CVE-2022-30190",
505+
"CVE-2024-49142",
507506
],
508507
}
509508
`;
@@ -525,31 +524,31 @@ CveResult {
525524
526525
exports[`BasicSearchManager (e2e) search(office) correctly returns expected data (ok CveResult) 1`] = `
527526
Object {
528-
"_id": "CVE-2022-39024",
527+
"_id": "CVE-2024-49142",
529528
"_index": Any<String>,
530529
"_score": null,
531530
"_source": Object {
532531
"containers": Object {
533532
"cna": Object {
534533
"descriptions": Array [
535534
Object {
536-
"value": "U-Office Force Bulletin function has insufficient filtering for special characters. An unauthenticated remote attacker can exploit this vulnerability to inject JavaScript and perform XSS (Reflected Cross-Site Scripting) attack.",
535+
"value": "Microsoft Access Remote Code Execution Vulnerability",
537536
},
538537
],
539538
},
540539
},
541540
"cveMetadata": Object {
542-
"assignerOrgId": "cded6c7f-6ce5-4948-8f87-aa7a3bbb6b0e",
543-
"assignerShortName": "twcert",
544-
"cveId": "CVE-2022-39024",
545-
"datePublished": "2022-10-31T06:40:36.532745Z",
546-
"dateReserved": "2022-08-30T00:00:00",
547-
"dateUpdated": "2024-09-16T20:07:27.280Z",
541+
"assignerOrgId": "f38d906d-7342-40ea-92c1-6c4a2c6478c8",
542+
"assignerShortName": "microsoft",
543+
"cveId": "CVE-2024-49142",
544+
"datePublished": "2024-12-10T17:49:33.983Z",
545+
"dateReserved": "2024-10-11T20:57:49.214Z",
546+
"dateUpdated": "2025-05-13T15:25:32.461Z",
548547
"state": "PUBLISHED",
549548
},
550549
},
551550
"sort": Array [
552-
"CVE-2022-39024",
551+
"CVE-2024-49142",
553552
],
554553
}
555554
`;

0 commit comments

Comments
 (0)