threatmodelcheck

command
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL