Documentation
¶
Overview ¶
Command threatmodelcheck keeps docs/threat-model.md honest: every evidence reference it cites must exist in the repository, and every threat row must name a mitigating AD rule and at least one piece of evidence.
Evidence references are backticked and carry a kind prefix:
- `test:<dir>.<Func>`: a func Test..., Fuzz..., Benchmark... or Example... named <Func> in a *_test.go file directly in <dir> (repo-relative, forward slashes);
- `job:<workflow>/<job id>`: a job id under jobs: in .github/workflows/<workflow>;
- `lint:<rule>`: a forbidigo rule tag (`[AD-3 reveal]` is cited as `lint:AD-3 reveal`) or a depguard rule name in .golangci.yml, which must also be listed in internal/lintcheck/testdata/expect.txt so `make lint-selftest` proves it fires;
- `file:<path>`: a repo-relative file or directory.
Structure: a threat table is a Markdown table whose header starts with ID and has a Mitigation column. Every data row in it must start with a threat id Bn.m that is unique and sits under its "## Bn" section, name an AD-N rule in its Mitigation cell and cite at least one evidence reference. Every boundary Bn in the trust boundary table (header ID, Boundary) needs a "## Bn" section. A repo directory named in the "Evidence pending ..." section must not exist yet: once it does, its rows belong in the boundary tables. Each problem is reported as "file:line: message".
Usage: go run ./tools/threatmodelcheck [-doc docs/threat-model.md] [-root .]
Exit codes: 0 every reference exists, 1 at least one problem, 2 the check could not run (unreadable document, bad flags).