Skip to content

Commit 7263abe

Browse files
committed
Initial cve-core release
0 parents  commit 7263abe

160 files changed

Lines changed: 26454 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env-EXAMPLE

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
################################################
2+
### cve-core ###################################
3+
################################################
4+
5+
# ----- ----- runtime ----- ----- ----- -----
6+
CVES_BASE_DIRECTORY=cves
7+
CVES_RECENT_ACTIVITIES_FILENAME=recent_activities.json
8+
CVES_DEFAULT_UPDATE_LOOKBACK_IN_MINS=180
9+
CVES_DEFAULT_DELTA_LOG_HISTORY_IN_DAYS=30
10+
CVES_MAX_ALLOWABLE_CVE_YEAR=2026
11+
GIT_MAX_FILESIZE_MB=100
12+
# ----- ----- for testing only ----- ----- -----
13+
CVES_TEST_BASE_DIRECTORY=test/pretend_github_repository
14+
15+
################################################
16+
### CVE Search specific ########################
17+
#################################################
18+
### LOCAL: OpenSearch variables ----- ----- -----
19+
# The following values are setup for a local OpenSearch instance
20+
# used for development and testing
21+
# These OpenSearch-specific variables must be modified in
22+
# each OpenSearch operating environment.
23+
# Please ask the infrastructure team for new values if needed
24+
# so they can update the infrastructure-as-code for consistency.
25+
OpenSearchCveIndex=cve-index-local
26+
# OpenSearchAllowUnknownSslCerts=true
27+
OpenSearchDomainEndpoint=https://admin:admin@localhost:9200
28+
29+
30+
################################################
31+
### cve services api ###########################
32+
################################################
33+
34+
# ----- production environment ----- ----- -----
35+
# CVE Services API-specific ----- -----
36+
CVE_SERVICES_URL=https://cveawg.mitre.org
37+
CVE_SERVICES_RECORDS_PER_PAGE=500
38+
CVE_ORG_URL=https://www.cve.org
39+
40+
# SECRET: user/role specific: DO NOT COMMIT ----- -----
41+
CVE_API_ORG=<yourOrg>
42+
CVE_API_USER=<yourUser>
43+
CVE_API_KEY=<serverToken>

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/**/*.js

.eslintrc.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"env": {
3+
"browser": false,
4+
"es6": true,
5+
"node": true
6+
},
7+
"parser": "@typescript-eslint/parser",
8+
"parserOptions": {
9+
"project": "tsconfig.json",
10+
"sourceType": "module",
11+
"ecmaVersion": 2020
12+
},
13+
"plugins": [
14+
"@typescript-eslint",
15+
"jest"
16+
],
17+
"extends": [
18+
"eslint:recommended",
19+
"plugin:@typescript-eslint/recommended",
20+
"plugin:jest/recommended",
21+
"prettier"
22+
],
23+
"rules": {
24+
// The following rule is enabled only to supplement the inline suppression
25+
// examples, and because it is not a recommended rule, you should either
26+
// disable it, or understand what it enforces.
27+
// https://typescript-eslint.io/rules/explicit-function-return-type/
28+
"@typescript-eslint/explicit-function-return-type": "warn",
29+
"@typescript-eslint/no-empty-function": "warn",
30+
"@typescript-eslint/no-inferrable-types": "off",
31+
"@typescript-eslint/no-unused-vars": "warn",
32+
// @todo temporarily turn off
33+
"jest/no-export": "off",
34+
// @todo changing this temporarily to warning (from error, which is the default)
35+
"prefer-const": "warn"
36+
}
37+
}

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "npm"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
# Raise pull requests for version updates
8+
# against the `develop` branch
9+
target-branch: "develop"
10+
# Labels on pull requests for version updates only
11+
labels:
12+
- "dependabot"
13+

.github/workflows/codeql.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: 'CodeQL'
13+
14+
on:
15+
push:
16+
# run CodeQL on all branches on push
17+
branches: ['**']
18+
pull_request:
19+
# The branches below must be a subset of the branches above
20+
branches: ['main', 'develop']
21+
schedule:
22+
- cron: '27 5 * * 3'
23+
24+
jobs:
25+
analyze:
26+
name: Analyze
27+
runs-on: ubuntu-latest
28+
timeout-minutes: 360
29+
permissions:
30+
actions: read
31+
contents: read
32+
security-events: write
33+
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
language: ['javascript']
38+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
39+
# Use only 'java' to analyze code written in Java, Kotlin or both
40+
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
41+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
42+
43+
steps:
44+
- name: Checkout repository
45+
uses: actions/checkout@v3
46+
47+
# Initializes the CodeQL tools for scanning.
48+
- name: Initialize CodeQL
49+
uses: github/codeql-action/init@v2
50+
with:
51+
languages: ${{ matrix.language }}
52+
# If you wish to specify custom queries, you can do so here or in a config file.
53+
# By default, queries listed here will override any specified in a config file.
54+
# Prefix the list here with "+" to use these queries and those in the config file.
55+
56+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
57+
# queries: security-extended,security-and-quality
58+
59+
60+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
61+
# If this step fails, then you should remove it and run the build manually (see below)
62+
- name: Autobuild
63+
uses: github/codeql-action/autobuild@v2
64+
65+
# ℹ️ Command-line programs to run using the OS shell.
66+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
67+
68+
# If the Autobuild fails above, remove it and uncomment the following three lines.
69+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
70+
71+
# - run: |
72+
# echo "Run, Build Application using script"
73+
# ./location_of_script_within_repo/buildscript.sh
74+
75+
- name: Perform CodeQL Analysis
76+
uses: github/codeql-action/analyze@v2
77+
with:
78+
category: "/language:${{matrix.language}}"

.gitignore

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
temp/logs
6+
7+
# work directories
8+
node_modules/
9+
.history
10+
11+
# Coverage
12+
coverage
13+
14+
# Transpiled files
15+
build/
16+
dist/
17+
dist.*/
18+
release/
19+
lib-cjs/
20+
lib-esm/
21+
22+
# VS Code
23+
# .vscode
24+
# !.vscode/tasks.js
25+
26+
# JetBrains IDEs
27+
.idea/
28+
29+
# Optional npm cache directory
30+
.npm
31+
32+
# Optional eslint cache
33+
.eslintcache
34+
35+
# Misc
36+
.DS_Store
37+
devel/
38+
# test/pretend_github_repository*/log
39+
*.old
40+
# test/pretend_github_repository*/20*
41+
*\ copy
42+
*\ copy.*
43+
*.old/
44+
45+
Notes.md
46+
47+
# deployment specific
48+
.env
49+
.env.*
50+
51+
# development and testing files
52+
aws.temp
53+
bulk/converted*.jsonl
54+
cves/deltaLog.json
55+
data
56+
deltas/
57+
preview_cves/

ChangeLog.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Change Log
2+
3+
## 2.0.0-rc14
4+
- initial version of `cve-core` as a peer project to other `cve-projects`. Can be used as part of a monorepo
5+
- search using `axios`, NodeJS-native `fetch` and `@opensearch-project/opensearch` libraries
6+
- CVE-, CWE-, and CAPAC- IDs
7+
- CVE YEAR
8+
- basic version strings (e.g., "v3.2.5", "v3.2.5-RC1")
9+
- basic IPv4 and IPv6
10+
- URLs
11+
- compound words (e.g., "docker-compose", "microsoft word")
12+
- hyphenated words (e.g., "man-in-the-middle")
13+
- software names (e.g., "Node.JS", ".NET")
14+
- file extension (e.g., "matvar_struct.c")
15+
- repeating non-language characters (e.g., "aaaaa" is ok, but "?????" is replaced by "")
16+
- can run as AWS Lambda Layer
17+
- new adapters
18+
- CVE Services reader
19+
- CVE Search reader
20+
- CVE file reader
21+
- file reader/writer
22+
- console input for interacting with a user in a CLI
23+
- CveResult class with standardized errors and messages (this version is aimed at the search service)
24+
- object (JSON) comparer using `json-difference` library
25+
- JSON replacer that alphabetizes keys when serializing using JSON.stringify()
26+
27+
## Older Milestones from the older `cveUtils`/`cvelist-bulk-download` repositories
28+
29+
Note that the following milestones were in other repositories, which contained a superset of the source code in this npm library. The milestones below are meant only for historic reference, in case a full history of an implementation is needed.
30+
31+
### 1.2.0 - deployed 2024-07-18 (tag `2024-07-18_v1.2.0`)
32+
- baseline for the `cve-core` npm library
33+
- changes for cisa adp, reference ingest
34+
- axios-retry for network retry
35+
- optimized update.yml to use fetch-depth: 1
36+
- CVES_MAX_ALLOWABLE_CVE_YEAR environment variable set to 2025
37+
- GIT_MAX_FILESIZE_MB environment variable set to 100
38+
- initial refactoring of core classes to separate I/O functions from business logic classes (work in progress)
39+
- minimized 3rd party dependency in IsoDateString class to minimize footprint for AWS Lambda
40+
- import specific lodash functions instead of the full lodash to minimize footprint for AWS Lambda
41+
- dependabot PRs defaults to develop branch
42+
- cveUtils/GitLab PR 32
43+
44+
### 1.1.1 - 2024-06-03
45+
- hotfix for large commit messages in anticipation of CISA adding ADP containers to a large number of CVEs on 6/4/2024.
46+
- tested but not used on cvelistV5
47+
48+
### 1.1.0 - 2023-09-26 (tag `2023-09-26_v1.1.0`)
49+
- Delta files in /cves (delta.json and deltaLog.json), replacing recent_activities.json
50+
51+
### 1.0.0 - 2023-05-26 (tag `2023-04-25_v1.0.0`)
52+
- Official version using public domain code in https://github.com/CVEProject/cvelist-bulk-download
53+
54+
55+
### `Sprint-0` - 2023-04-20 (tag `2023-04-20_initial_cveUtils_on_github`)
56+
- initial version selectively copied from internal MITRE gitlab to https://github.com/hkong-mitre/cvelist-bulk-download
57+
- https://github.com/hkong-mitre/cvelist-bulk-download/commit/207b9f2b82908afbd8d9d2270969f6781f9d39e4
58+
- (note date is different): https://gitlab.mitre.org/hkong/cve_utils/-/tags/2023-04-25_to_github_hkong-mitre_cvelist_bulk_download
59+
60+
61+
### 2023-03-29
62+
- official version used in GitHub actions that updated /cves when cvelistV5 was announced at CNA Summit 2023
63+
- https://gitlab.mitre.org/hkong/cve_utils/-/tags/2023-03-29-cveproject_cvelistV5_dist_(similar)
64+
65+
66+
### 2023-03-10
67+
- code during team code walkthru
68+
- https://gitlab.mitre.org/hkong/cve_utils/-/tags/2023_03_10_code_walkthrough_with_team
69+
70+
71+
### 2023-03-06
72+
- first version deployed to cvelistV5 for testing (using `preview_cves` instead of `cves`)
73+
- https://gitlab.mitre.org/hkong/cve_utils/-/tags/2023_03_06_deployed_to_cveproject_cvelistv5
74+
75+
76+
## Additional Information
77+
78+
This project uses (either verbatim or modified from) the following projects:
79+
80+
1. [jsynowiec/node-typescript-boilerplate](https://github.com/jsynowiec/node-typescript-boilerplate) as a starter (8/26/2022).
81+
- but not using [Volta][volta]
82+
2. [Quicktype](https://quicktype.io/) to convert CVE schemas to usable Typescript classes. Specifically, all classes in `src/generated/quicktype` are all generated this way:
83+
- `Cve5`: https://raw.githubusercontent.com/CVEProject/cve-services/dev/schemas/cve/create-full-cve-record-request.json
84+
3. [recommended tsconfig](https://github.com/tsconfig/bases#centralized-recommendations-for-tsconfig-bases)

0 commit comments

Comments
 (0)