Skip to content

Commit 28e29f0

Browse files
authored
Merge branch 'main' into 705-model-national-cybersecurity-incident-scoring-system
2 parents 0e43c0c + e9ba885 commit 28e29f0

File tree

204 files changed

+3098
-1622
lines changed

Some content is hidden

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

204 files changed

+3098
-1622
lines changed

.github/workflows/lint_md_changes.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ jobs:
1616
- uses: actions/checkout@v4
1717
with:
1818
fetch-depth: 0
19-
- uses: tj-actions/changed-files@823fcebdb31bb35fdf2229d9f769b400309430d0
19+
- uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c
2020
id: changed-files
2121
with:
2222
files: '**/*.md'
2323
separator: ","
24-
- uses: DavidAnson/markdownlint-cli2-action@v19
24+
- uses: DavidAnson/markdownlint-cli2-action@v20
2525
if: steps.changed-files.outputs.any_changed == 'true'
2626
with:
2727
globs: ${{ steps.changed-files.outputs.all_changed_files }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.DS_Store
12
# Byte-compiled / optimized / DLL files
23
__pycache__/
34
*.py[cod]

Makefile

Lines changed: 32 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,58 @@
11
# Project-specific vars
2-
PFX=ssvc
3-
DOCKER=docker
4-
DOCKER_BUILD=$(DOCKER) build
5-
DOCKER_RUN=$(DOCKER) run --tty --rm
6-
PROJECT_VOLUME=--volume $(shell pwd):/app
72
MKDOCS_PORT=8765
8-
9-
# docker names
10-
TEST_DOCKER_TARGET=test
11-
TEST_IMAGE = $(PFX)_test
12-
DOCS_DOCKER_TARGET=docs
13-
DOCS_IMAGE = $(PFX)_docs
3+
DOCKER_DIR=docker
144

155
# Targets
16-
.PHONY: all dockerbuild_test dockerrun_test dockerbuild_docs dockerrun_docs docs docker_test clean help
6+
.PHONY: all test docs docker_test clean help mdlint_fix up down regenerate_json
177

188
all: help
199

2010
mdlint_fix:
2111
@echo "Running markdownlint..."
2212
markdownlint --config .markdownlint.yml --fix .
2313

24-
dockerbuild_test:
25-
@echo "Building the test Docker image..."
26-
$(DOCKER_BUILD) --target $(TEST_DOCKER_TARGET) --tag $(TEST_IMAGE) .
14+
test:
15+
@echo "Running tests locally..."
16+
pytest -v src/test
2717

28-
dockerrun_test:
29-
@echo "Running the test Docker image..."
30-
$(DOCKER_RUN) $(PROJECT_VOLUME) $(TEST_IMAGE)
18+
docker_test:
19+
@echo "Running tests in Docker..."
20+
pushd $(DOCKER_DIR) && docker-compose run --rm test
3121

32-
dockerbuild_docs:
33-
@echo "Building the docs Docker image..."
34-
$(DOCKER_BUILD) --target $(DOCS_DOCKER_TARGET) --tag $(DOCS_IMAGE) .
22+
docs:
23+
@echo "Building and running docs in Docker..."
24+
pushd $(DOCKER_DIR) && docker-compose up docs
3525

36-
dockerrun_docs:
37-
@echo "Running the docs Docker image..."
38-
$(DOCKER_RUN) --publish $(MKDOCS_PORT):8000 $(PROJECT_VOLUME) $(DOCS_IMAGE)
26+
up:
27+
@echo "Starting Docker services..."
28+
pushd $(DOCKER_DIR) && docker-compose up -d
3929

30+
down:
31+
@echo "Stopping Docker services..."
32+
pushd $(DOCKER_DIR) && docker-compose down
4033

41-
docs: dockerbuild_docs dockerrun_docs
42-
docker_test: dockerbuild_test dockerrun_test
34+
regenerate_json:
35+
@echo "Regenerating JSON files..."
36+
rm -rf data/json/decision_points
37+
export PYTHONPATH=$(PWD)/src && ./src/ssvc/doctools.py --jsondir=./data/json/decision_points --overwrite
4338

4439
clean:
45-
@echo "Cleaning up..."
46-
$(DOCKER) rmi $(TEST_IMAGE) $(DOCS_IMAGE) || true
40+
@echo "Cleaning up Docker resources..."
41+
pushd $(DOCKER_DIR) && docker-compose down --rmi local || true
4742

4843
help:
4944
@echo "Usage: make [target]"
5045
@echo ""
5146
@echo "Targets:"
5247
@echo " all - Display this help message"
53-
@echo " mdlint_fix - Run markdownlint with --fix"
54-
@echo " docs - Build and run the docs Docker image"
55-
@echo " docker_test - Build and run the test Docker image"
56-
@echo ""
57-
@echo " dockerbuild_test - Build the test Docker image"
58-
@echo " dockerrun_test - Run the test Docker image"
59-
@echo " dockerbuild_docs - Build the docs Docker image"
60-
@echo " dockerrun_docs - Run the docs Docker image"
61-
@echo ""
62-
@echo " clean - Remove the Docker images"
63-
@echo " help - Display this help message"
64-
48+
@echo " mdlint_fix - Run markdownlint with fix"
49+
@echo " test - Run tests locally"
50+
@echo " docker_test - Run tests in Docker"
51+
@echo " docs - Build and run documentation in Docker"
52+
@echo " up - Start Docker services"
53+
@echo " down - Stop Docker services"
54+
@echo " regenerate_json - Regenerate JSON files from python modules"
55+
@echo " clean - Clean up Docker resources"
56+
@echo " help - Display this help message"
6557

6658

README.md

Lines changed: 29 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,19 @@ These json files are generated examples from the python `ssvc` module.
6161

6262
These files are used by the `ssvc-calc` module.
6363

64+
## `/docker/*`
65+
66+
The `docker` directory contains Dockerfiles and related configurations for to
67+
create images that can run the SSVC documentation site and unit tests.
68+
69+
Example:
70+
71+
```bash
72+
cd docker
73+
docker-compose up test
74+
docker-compose up docs
75+
```
76+
6477
## `/src/*`
6578

6679
This directory holds helper scripts that can make managing or using SSVC easier.
@@ -103,75 +116,29 @@ To preview any `make` command without actually executing it, run:
103116
make -n <command>
104117
```
105118

106-
### Run Local Server With Docker
107-
108-
The easiest way to get started is using make to build a docker image and run the site:
109-
110-
```bash
111-
make docs
112-
```
119+
### Run Local Docs Server
113120

114-
Then navigate to <http://localhost:8765/SSVC/> to see the site.
121+
The easiest way to get started is using make to build a docker image and run the site. However, we provide a few other options below.
115122

116-
Note that the docker container will display a message with the URL to visit, for
117-
example: `Serving on http://0.0.0.0:8000/SSVC/` in the output. However, that port
118-
is only available inside the container. The host port 8765 is mapped to the container's
119-
port 8000, so you should navigate to <http://localhost:8765/SSVC/> to see the site.
120-
121-
Or, if make is not available:
122-
123-
```bash
124-
docker build --target docs --tag ssvc_docs .
125-
docker run --tty --rm -p 8765:8000 --volume .:/app ssvc_docs
126-
```
127-
128-
### Run Local Server Without Docker
129-
130-
If you prefer to run the site locally without Docker, you can do so with mkdocs.
131-
We recommend using a virtual environment to manage dependencies:
132-
133-
```bash
134-
python3 -m venv ssvc_venv
135-
pip install -r requirements.txt
136-
```
123+
| Environment | Command |
124+
|-------------|---------|
125+
| Make, Docker | `make docs` |
126+
| ~~Make~~, Docker | `cd docker && docker-compose up docs` |
127+
| ~~Make~~, ~~Docker~~ | `mkdocs serve` |
137128

138-
Start a local server:
139-
140-
```bash
141-
mkdocs serve
142-
```
143-
144-
By default, the server will run on port 8001.
145-
This is configured in the `mkdocs.yml` file.
146-
Navigate to <http://localhost:8001/> to see the site.
147-
148-
(Hint: You can use the `--dev-addr` argument with mkdocs to change the port, e.g. `mkdocs serve --dev-addr localhost:8000`)
129+
Then navigate to <http://localhost:8000/SSVC/> to see the site.
149130

150131
## Run tests
151132

152133
We include a few tests for the `ssvc` module.
153-
154-
### Run Tests With Docker
155-
156-
The easiest way to run tests is using make to build a docker image and run the tests:
157-
158-
```bash
159-
make docker_test
160-
```
161-
162-
Or, if make is not available:
163-
164-
```bash
165-
docker build --target test --tag ssvc_test .
166-
docker run --tty --rm --volume .:/app ssvc_test
167-
```
168-
169-
### Run Tests Without Docker
170-
171-
```bash
172-
pip install pytest
173-
pytest src/test
174-
```
134+
Options for running the test suite are provided below.
135+
136+
| Environment | Command | Comment |
137+
|-------------|---------|---------|
138+
| Make, Docker | `make docker_test` | runs in docker container |
139+
| ~~Make~~, Docker | `cd docker && docker-compose run -rm test` | runs in docker container |
140+
| Make, ~~Docker~~ | `make test` | runs in host OS |
141+
| ~~Make~~, ~~Docker~~ | `pytest src/test` | runs in host OS |
175142

176143
## Environment Variables
177144

data/json/outcomes/CISA.json renamed to data/json/decision_points/cisa/cisa_levels_1_0_0.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
{
2-
"version": "1.0.0",
3-
"schemaVersion": "1-0-1",
42
"name": "CISA Levels",
53
"description": "The CISA outcome group. CISA uses its own SSVC decision tree model to prioritize relevant vulnerabilities into four possible decisions: Track, Track*, Attend, and Act.",
6-
"outcomes": [
4+
"namespace": "cisa",
5+
"version": "1.0.0",
6+
"schemaVersion": "1-0-1",
7+
"key": "CISA",
8+
"values": [
79
{
810
"key": "T",
911
"name": "Track",
@@ -25,4 +27,4 @@
2527
"description": "The vulnerability requires attention from the organization's internal, supervisory-level and leadership-level individuals. Necessary actions include requesting assistance or information about the vulnerability, as well as publishing a notification either internally and/or externally. Typically, internal groups would meet to determine the overall response and then execute agreed upon actions. CISA recommends remediating Act vulnerabilities as soon as possible."
2628
}
2729
]
28-
}
30+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "Mission Prevalence",
3+
"description": "Prevalence of the mission essential functions",
4+
"namespace": "cisa",
5+
"version": "1.0.0",
6+
"schemaVersion": "1-0-1",
7+
"key": "MP",
8+
"values": [
9+
{
10+
"key": "M",
11+
"name": "Minimal",
12+
"description": "Neither Support nor Essential apply. The vulnerable component may be used within the entities, but it is not used as a mission-essential component, nor does it provide impactful support to mission-essential functions."
13+
},
14+
{
15+
"key": "S",
16+
"name": "Support",
17+
"description": "The vulnerable component only supports MEFs for two or more entities."
18+
},
19+
{
20+
"key": "E",
21+
"name": "Essential",
22+
"description": "The vulnerable component directly provides capabilities that constitute at least one MEF for at least one entity; component failure may (but does not necessarily) lead to overall mission failure."
23+
}
24+
]
25+
}

data/json/decision_points/cvss/availability_impact_2_0_1.json

Lines changed: 0 additions & 25 deletions
This file was deleted.

data/json/decision_points/cvss/confidentiality_impact_2_0_1.json

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "CVSS Qualitative Severity Rating Scale",
3+
"description": "The CVSS Qualitative Severity Rating Scale group.",
4+
"namespace": "cvss",
5+
"version": "1.0.0",
6+
"schemaVersion": "1-0-1",
7+
"key": "CVSS",
8+
"values": [
9+
{
10+
"key": "N",
11+
"name": "None",
12+
"description": "None (0.0)"
13+
},
14+
{
15+
"key": "L",
16+
"name": "Low",
17+
"description": "Low (0.1-3.9)"
18+
},
19+
{
20+
"key": "M",
21+
"name": "Medium",
22+
"description": "Medium (4.0-6.9)"
23+
},
24+
{
25+
"key": "H",
26+
"name": "High",
27+
"description": "High (7.0-8.9)"
28+
},
29+
{
30+
"key": "C",
31+
"name": "Critical",
32+
"description": "Critical (9.0-10.0)"
33+
}
34+
]
35+
}

data/json/decision_points/cvss/integrity_impact_2_0_1.json

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)