Skip to content

Commit 835d2bd

Browse files
authored
add config directory
this makes it easier to make local changes at runtime
1 parent 04954cc commit 835d2bd

6 files changed

Lines changed: 174 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
// this file is used by node-config to map a node-config (AppConfig)
3+
// hierarchy of constants to an environment variable
4+
// Note that much of the environment variables mapped here existed for some time
5+
// without AppConfig, this file bridges the historical uses of those with the new
6+
// as we transition to AppConfig
7+
"appConfig": {
8+
// constants for search capability
9+
"search": {
10+
"providerEndpoint": "OpenSearchDomainEndpoint",
11+
"index": "OpenSearchCveIndex",
12+
// allows local development using containers that do not have SSL certs
13+
"allowUnknownSslCerts": "OpenSearchAllowUnknownSslCerts"
14+
},
15+
// constants for testing node-config
16+
// these values are only used to test node-config in AppConfig.test.int.ts
17+
// DO NOT USE THIS FOR ANYTHING ELSE
18+
"test": {
19+
"appConfigTest": {
20+
"test": "JEST_env_config_test"
21+
}
22+
}
23+
}
24+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
// Default configuration
3+
// These values are overridable using other *.jsonc (e.g., prod.jsonc)
4+
// as well as using environment variables (e.g., in `.env`)
5+
// - Each configuration is mapped using custom-environment-variables.jsonc to enable environment varialbe overrides.
6+
// - For more information, see cve-core/src/adapters/config/AppConfig.ts
7+
// NOTE for consistency, all values need to be strings for proper type when using .env overrides
8+
"appConfig": {
9+
// constants for search capability
10+
"search": {
11+
// minimum versions for servers that are compatible with current code
12+
"minServer": [
13+
"elasticsearch:7.10.2",
14+
"opensearch:2.10.0"
15+
],
16+
// setting this to FALSE (highly recommended) requires an SSL cert to access the search server
17+
// The only time this should be allowed to be true is when developing or testing
18+
// using containers that do not have SSL certs
19+
"allowUnknownSslCerts": "FALSE",
20+
"providerEndpoint": "<using config/default.jsonc>", // preference is to specify this in a (secret) environment variable on production platforms
21+
"index": "<using config/default.jsonc>" // preference is to specify this in a (secret) environment variable on production platforms
22+
},
23+
"github": {
24+
"cvelist": {
25+
"cvesDirUrl": "https://raw.githubusercontent.com/CVEProject/cvelistV5/refs/heads/main/cves",
26+
"deltalogUrl": "https://raw.githubusercontent.com/CVEProject/cvelistV5/refs/heads/main/cves/deltaLog.json"
27+
}
28+
},
29+
"local": {
30+
"tempDownloadDirRoot": "./tempDownloads",
31+
"cvesDirRoot": "./cves"
32+
}
33+
}
34+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
// development configurations
3+
// overrides values specified in default.jsonc, read additional comments there
4+
// and in cve-core/src/adapters/config/AppConfig.ts
5+
// NOTE for consistency, all values need to be strings for proper type when using .env overrides
6+
"appConfig": {
7+
// constants for search capability
8+
"search": {
9+
// minimum versions for servers that are compatible with current code
10+
"minServer": [
11+
"opensearch:2.10.0"
12+
],
13+
// URL to reach search server
14+
"providerEndpoint": "https://admin:admin@localhost:9200",
15+
// index on search server related to searching CVEs
16+
"index": "e2e-cve-test-index-1109",
17+
// setting this to FALSE (recommended) requires an SSL cert to access the search server
18+
// The only time this should be allowed to be true is when developing or testing
19+
// using containers that do not have SSL certs
20+
// DO NOT USE THIS IN ANY PUBLIC OR PRODUCTION ENVIRONMENTS
21+
"allowUnknownSslCerts": "TRUE"
22+
},
23+
// constants for unit, int, e2e testing
24+
"test": {
25+
// constants for testing search capability
26+
"searchTest": {
27+
// many tests for search uses snapshots, which requires CVEs to remain unchanged
28+
// since the live server is updated all the time, a fixture containing fixed CVEs
29+
// is required to keep the test consistent. "fixtures" provides the link
30+
// to the cve-fixtures repository
31+
"fixtures": {
32+
// @todo these constants needs to be in sync in cve-fixtures
33+
// so that testing snapshots are consistent and valid
34+
"name": "fixtures-search-baseline-1086", // release tag
35+
"numCves": "1086" // possible identifier assuming we always add cves to a new release
36+
}
37+
},
38+
// constants for testing node-config
39+
"appConfigTest": {
40+
// these values are only used to test node-config in AppConfig.test.int.ts
41+
// DO NOT USE THIS FOR ANYTHING ELSE
42+
"two": "2",
43+
"five": "5"
44+
}
45+
}
46+
}
47+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
// production (example) constants
3+
// overrides values specified in default.jsonc, read additional comments there
4+
// and in cve-core/src/adapters/config/AppConfig.ts
5+
// NOTE for consistency, all values need to be strings for proper type when using .env overrides
6+
"appConfig": {
7+
"search": {
8+
"minServer": [
9+
"elasticsearch:7.10.2",
10+
"opensearch:2.10.0"
11+
],
12+
"providerEndpoint": "", // preference is to specify this in a (secret) environment variable on production platforms
13+
"index": "", // preference is to specify this in a (secret) environment variable on production platforms
14+
"allowUnknownSslCerts": "FALSE"
15+
}
16+
}
17+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
// SADP configuration
3+
// NOTE for consistency, all values need to be strings for proper type when using .env overrides
4+
"appConfig": {
5+
"local": {
6+
"cvesDirRoot": "./Published SADP Records"
7+
},
8+
// these variables are for working with CVEs with SADP information
9+
"sadp": {
10+
"deltaLog": {
11+
"numLookback": 3
12+
},
13+
// the code reviews CVEs based on the jsonpath string, looking for matching values
14+
"conditionalCveCopy": {
15+
"jsonpath": "$.containers.adp[*].providerMetadata.shortName",
16+
"matches": [
17+
"*-SADP"
18+
]
19+
}
20+
}
21+
}
22+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
// SADP configuration
3+
// NOTE for consistency, all values need to be strings for proper type when using .env overrides
4+
"appConfig": {
5+
"local": {
6+
// "cvesDirRoot": "./cves.sadp"
7+
"cvesDirRoot": "./Published SADP Records"
8+
},
9+
// these variables are for working with CVEs with SADP information
10+
"sadp": {
11+
"deltaLog": {
12+
"numLookback": 2
13+
},
14+
// the code reviews CVEs based on the jsonpath string, looking for matching values
15+
"conditionalCveCopy": {
16+
"jsonpath": "$.containers.adp[*].providerMetadata.shortName",
17+
// "jsonpath": "$.cveMetadata.state",
18+
// "jsonpath": "$.cveMetadata.assignerShortName",
19+
"matches": [
20+
// "redhat",
21+
// "PUBLISHED",
22+
// "*ED",
23+
// "PUBLISH*",
24+
"*-ADP",
25+
// "*-SADP",
26+
]
27+
}
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)