Skip to content

Commit ce4d811

Browse files
authored
Merge branch 'main' into reference
2 parents 4e524f9 + fd232a0 commit ce4d811

File tree

472 files changed

+68200
-9312
lines changed

Some content is hidden

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

472 files changed

+68200
-9312
lines changed

.github/workflows/deploy_site.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,29 @@ jobs:
3232
runs-on: ubuntu-latest
3333
steps:
3434
- name: Checkout
35-
uses: actions/checkout@v4
35+
uses: actions/checkout@v5
3636

3737
- name: Set up Python
38-
uses: actions/setup-python@v5
38+
uses: actions/setup-python@v6
3939
with:
4040
python-version: '3.12'
4141

4242
- name: Install dependencies
4343
run: |
4444
python -m pip install --upgrade pip
45-
python -m pip install -r requirements.txt
45+
python -m pip install uv
46+
uv sync --project=src --no-dev
4647
4748
- name: Setup Pages
4849
uses: actions/configure-pages@v5
4950

5051
- name: Build Site
5152
run: |
5253
export PYTHONPATH=src:$PYTHONPATH
53-
mkdocs build --verbose --clean --config-file mkdocs.yml
54+
uv run --project=src mkdocs build --clean --config-file mkdocs.yml
5455
5556
- name: Upload artifact
56-
uses: actions/upload-pages-artifact@v3
57+
uses: actions/upload-pages-artifact@v4
5758
with:
5859
# Upload entire repository
5960
path: 'site'

.github/workflows/link_checker.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
- .github/workflows/linkchecker.yml
1313
# run on any PR that changes the pip requirements
1414
- requirements.txt
15+
- src/pyproject.toml
1516
# let us trigger it manually
1617
workflow_dispatch:
1718

@@ -20,28 +21,23 @@ jobs:
2021
runs-on: ubuntu-latest
2122
steps:
2223
- name: Checkout
23-
uses: actions/checkout@v4
24+
uses: actions/checkout@v5
2425

2526
- name: Set up Python
26-
uses: actions/setup-python@v5
27+
uses: actions/setup-python@v6
2728
with:
2829
python-version: '3.12'
2930

3031
- name: Install dependencies
3132
run: |
32-
python -m pip install --upgrade pip
33-
python -m pip install -r requirements.txt
34-
python -m pip install linkchecker
35-
36-
- name: Install our python stuff
37-
run: |
38-
python -m pip install -e src
33+
python -m pip install --upgrade pip uv
34+
uv sync --dev --project=src
3935
4036
- name: Build Site
4137
run: |
42-
mkdocs build --verbose --clean --config-file mkdocs.yml
38+
uv run --project=src mkdocs build --verbose --clean --config-file mkdocs.yml
4339
4440
- name: Check links
4541
run: |
46-
linkchecker site/index.html
42+
uv run --project=src linkchecker site/index.html
4743

.github/workflows/lint_md_changes.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
lint:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v5
1717
with:
1818
fetch-depth: 0
1919
- uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c

.github/workflows/python-app.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,24 @@ jobs:
1818
runs-on: ubuntu-latest
1919

2020
steps:
21-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v5
2222
with:
2323
fetch-tags: true
2424
- name: Set up Python 3.12
25-
uses: actions/setup-python@v5
25+
uses: actions/setup-python@v6
2626
with:
2727
python-version: "3.12"
2828
- name: Install dependencies
2929
run: |
30-
python -m pip install --upgrade pip
31-
pip install pytest build
32-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
30+
python -m pip install --upgrade pip uv
31+
uv sync --project=src --dev --frozen
3332
# - uses: psf/black@stable
3433
- name: Test with pytest
3534
run: |
36-
pytest
35+
uv run --project=src pytest
3736
- name: Build
3837
run: |
39-
python -m build src
38+
uv build --project=src
4039
- name: Upload Artifacts
4140
uses: actions/upload-artifact@v4
4241
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,4 @@ dmypy.json
131131
ssvc2-applier-wip.xlsx
132132
_version.py
133133
node_modules
134+
tmp

Makefile

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,88 @@
11
# Project-specific vars
22
MKDOCS_PORT=8765
33
DOCKER_DIR=docker
4+
PROJECT_DIR = ./src
5+
DOCKER_COMPOSE=docker-compose --project-directory $(DOCKER_DIR)
6+
UV_RUN=uv run --project $(PROJECT_DIR)
47

58
# Targets
6-
.PHONY: all test docs docker_test clean help mdlint_fix up down regenerate_json
9+
.PHONY: all test docs api docker_test clean help mdlint_fix up down regenerate_json
10+
711

812
all: help
913

14+
dev:
15+
@echo "Set up dev environment..."
16+
uv sync --dev --project $(PROJECT_DIR)
17+
1018
mdlint_fix:
1119
@echo "Running markdownlint..."
1220
markdownlint --config .markdownlint.yml --fix .
1321

1422
test:
1523
@echo "Running tests locally..."
16-
pytest -v src/test
24+
uv run --project $(PROJECT_DIR) pytest -v
1725

1826
docker_test:
1927
@echo "Building the latest test image..."
20-
pushd $(DOCKER_DIR) && docker-compose build test
28+
$(DOCKER_COMPOSE) build test
2129
@echo "Running tests in Docker..."
22-
pushd $(DOCKER_DIR) && docker-compose run --rm test
30+
$(DOCKER_COMPOSE) run --rm test
31+
32+
docs_local:
33+
@echo "Building and running docs locally..."
34+
$(UV_RUN) mkdocs serve
2335

2436
docs:
2537
@echo "Building and running docs in Docker..."
26-
pushd $(DOCKER_DIR) && docker-compose up docs
38+
$(DOCKER_COMPOSE) up docs
39+
40+
api:
41+
@echo "Building and running API in Docker..."
42+
$(DOCKER_COMPOSE) up api
43+
44+
api_dev:
45+
$(UV_RUN) uvicorn ssvc.api.main:app --reload
2746

2847
up:
2948
@echo "Starting Docker services..."
30-
pushd $(DOCKER_DIR) && docker-compose up -d
49+
$(DOCKER_COMPOSE) up -d
3150

3251
down:
3352
@echo "Stopping Docker services..."
34-
pushd $(DOCKER_DIR) && docker-compose down
53+
$(DOCKER_COMPOSE) down
3554

3655
regenerate_json:
3756
@echo "Regenerating JSON files..."
3857
rm -rf data/json/decision_points
39-
export PYTHONPATH=$(PWD)/src && ./src/ssvc/doctools.py --jsondir=./data/json/decision_points --overwrite
58+
export PYTHONPATH=$(PWD)/src && ./src/ssvc/doctools.py --datadir=./data --overwrite
4059

4160
clean:
4261
@echo "Cleaning up Docker resources..."
43-
pushd $(DOCKER_DIR) && docker-compose down --rmi local || true
44-
62+
$(DOCKER_COMPOSE) down --rmi local || true
63+
rm -rf $(PROJECT_DIR)/.venv $(PROJECT_DIR)/uv.lock
4564
help:
4665
@echo "Usage: make [target]"
4766
@echo ""
4867
@echo "Targets:"
4968
@echo " all - Display this help message"
69+
70+
@echo " dev - Set up development environment"
5071
@echo " mdlint_fix - Run markdownlint with fix"
5172
@echo " test - Run tests locally"
5273
@echo " docker_test - Run tests in Docker"
74+
5375
@echo " docs - Build and run documentation in Docker"
76+
@echo " docs_local - Build and run documentation locally"
77+
78+
@echo " api - Build and run API in Docker"
79+
@echo " api_dev - Run API locally with auto-reload"
80+
5481
@echo " up - Start Docker services"
5582
@echo " down - Stop Docker services"
83+
5684
@echo " regenerate_json - Regenerate JSON files from python modules"
85+
5786
@echo " clean - Clean up Docker resources"
5887
@echo " help - Display this help message"
5988

README.md

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,22 @@ The data folder contains detailed data files that define suggested prioritizatio
4545

4646
There are both `.csv` and `.json` files in this directory.
4747

48-
### `/data/csvs/*`
48+
### `/data/csv/*`
4949

50-
The `.csv` files are the primary data files used by the `ssvc.py` module.
50+
The `.csv` files are generated from the python `ssvc` module.
5151

52-
Also included in data are the lookup tables as csv files which `ssvc_v2.py` reads in.
53-
These files define one row per possible path through the trees as described in the documentation.
52+
These files define one row per possible path through the decision tables as described in the documentation.
5453
Customizing the "outcome" column in this csv is the primary recommended way that stakeholders might adapt SSVC to their environment.
5554

5655
### `/data/json/*`
5756

58-
These json files are generated examples from the python `ssvc` module.
57+
These json files are generated examples from the python `ssvc` module,
58+
which uses `pydantic` to define the data models.
5959

6060
### `/data/schema/*` and `/data/schema_examples/*`
6161

62+
These json schema files are used to validate the structure of the `.json` files in `/data/json/*`.
63+
They are generated from the python `ssvc` module, which uses `pydantic` to define the data models.
6264
These files are used by the `ssvc-calc` module.
6365

6466
## `/docker/*`
@@ -85,15 +87,6 @@ These modules are used to generate documentation for various [Decision Points](h
8587

8688
Documentation for the `ssvc` module can be found at [https://certcc.github.io/SSVC/reference/code/](https://certcc.github.io/SSVC/reference/code/)
8789

88-
### `src/ssvc_v2.py`
89-
90-
A basic Python module for interacting with the SSVC trees. `ssvc_v2.py` has
91-
two methods: `applier_tree()` and `developer_tree()`
92-
93-
The two methods just loop through their respective lookup tables until
94-
they hit a match, then return the outcome. Maybe not the best implementation,
95-
but it worked well enough for what was needed at the time.
96-
9790
## Local development
9891

9992
The simplest way to get started with local development is to use Docker.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../src/ssvc/utils/ssvc_namespace_pattern.abnf
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
row,Exploitation v1.1.0,Automatable v2.0.0,Technical Impact v1.0.0,Mission and Well-Being Impact v1.0.0,CISA Levels v1.1.0 (cisa)
2+
0,none,no,partial,low,track
3+
1,none,no,partial,medium,track
4+
2,none,no,partial,high,track
5+
3,none,no,total,low,track
6+
4,none,no,total,medium,track
7+
5,none,no,total,high,track*
8+
6,none,yes,partial,low,track
9+
7,none,yes,partial,medium,track
10+
8,none,yes,partial,high,attend
11+
9,none,yes,total,low,track
12+
10,none,yes,total,medium,track
13+
11,none,yes,total,high,attend
14+
12,public poc,no,partial,low,track
15+
13,public poc,no,partial,medium,track
16+
14,public poc,no,partial,high,track*
17+
15,public poc,no,total,low,track
18+
16,public poc,no,total,medium,track*
19+
17,public poc,no,total,high,attend
20+
18,public poc,yes,partial,low,track
21+
19,public poc,yes,partial,medium,track
22+
20,public poc,yes,partial,high,attend
23+
21,public poc,yes,total,low,track
24+
22,public poc,yes,total,medium,track*
25+
23,public poc,yes,total,high,attend
26+
24,active,no,partial,low,track
27+
25,active,no,partial,medium,track
28+
26,active,no,partial,high,attend
29+
27,active,no,total,low,track
30+
28,active,no,total,medium,attend
31+
29,active,no,total,high,act
32+
30,active,yes,partial,low,attend
33+
31,active,yes,partial,medium,attend
34+
32,active,yes,partial,high,act
35+
33,active,yes,total,low,attend
36+
34,active,yes,total,medium,act
37+
35,active,yes,total,high,act

0 commit comments

Comments
 (0)