Skip to content

eBPF-based security platform

ci: check that the documentation names only proofs that exist

Daniel Borkmann20a7f98df1a7
diff --git a/.agents/skills/docs/SKILL.md b/.agents/skills/docs/SKILL.md
index be88ce50..eb6e2ecc 100644
--- a/.agents/skills/docs/SKILL.md
+++ b/.agents/skills/docs/SKILL.md
@@ -62,5 +62,6 @@ make docs # renders and serves on 127.0.0.1:8000
```
`check-docs.sh` checks the options of console examples, the failure
-categories, tamper counters, hooks, tests and units the pages name. It
+categories, tamper counters, hooks, tests, proofs and units the pages
+name, and that every proof has a row on the proof coverage page. It
cannot check the prose: read each changed paragraph against the code.
diff --git a/.github/scripts/check-docs.sh b/.github/scripts/check-docs.sh
index 810914e4..a11b0808 100755
--- a/.github/scripts/check-docs.sh
+++ b/.github/scripts/check-docs.sh
@@ -4,9 +4,9 @@
#
# .github/scripts/check-docs.sh -- check Documentation/ against the tree:
# every option a console example passes to shirudo exists in a parser,
-# every failure category the code emits and every tamper counter has its
-# entry in the reference, and every hook, counter, test and unit a page
-# names exists.
+# every failure category the code emits, every tamper counter and every
+# proof has its entry in the reference, and every hook, counter, test,
+# proof and unit a page names exists.
#
# .github/scripts/check-docs.sh
#
@@ -99,6 +99,27 @@ while IFS= read -r page; do
done
done <"$work/pages"
+# Every proof has a row on the coverage page, and a fact box names only
+# proofs that exist.
+coverage=Documentation/contribute/testing/proof-coverage.rst
+grep -v '^[[:space:]]*\(#\|$\)' testing/proofs/cbmc/proofs.list |
+ awk '{ print $1 }' >"$work/proofs"
+for model in testing/proofs/lean4/Shirudo/*.lean; do
+ model=${model##*/}
+ printf 'Shirudo.%s\n' "${model%.lean}"
+done >>"$work/proofs"
+while IFS= read -r proof; do
+ grep -qF "* - \`\`$proof\`\`" "$coverage" ||
+ report "$coverage" "no row for the proof $proof"
+done <"$work/proofs"
+while IFS= read -r page; do
+ grep '^:Proofs:' "$page" | grep -oE '``[A-Za-z0-9.-]+``' | tr -d '`' |
+ sort -u | while IFS= read -r proof; do
+ grep -qx "$proof" "$work/proofs" ||
+ report "$page" "no proof is named $proof"
+ done
+done <"$work/pages"
+
# Every unit a page names exists under systemd/.
while IFS= read -r page; do
grep -oE 'shirudo(-[a-z0-9]+)*\.(service|timer)' "$page" | sort -u |
diff --git a/Documentation/contribute/documentation/writing-docs.rst b/Documentation/contribute/documentation/writing-docs.rst
index e0e6fffd..1ac714b0 100644
--- a/Documentation/contribute/documentation/writing-docs.rst
+++ b/Documentation/contribute/documentation/writing-docs.rst
@@ -91,10 +91,13 @@ the ``facts`` class:
:Refusal: ``EACCES`` from the denied system call
:Counters: ``BpfCommand``, ``PinUnlink``, ``BpffsUmount``
:Tests: ``t6106``, ``t6107``, ``t6120``
+ :Proofs: ``upatch-header``, ``Shirudo.Chain``
:Residual: R3
-Name only hooks, counters and tests that exist. ``make -C Documentation
-check`` verifies them against the tree.
+Name only hooks, counters, tests and proofs that exist, a proof by its
+name in :src:`testing/proofs/cbmc/proofs.list` or its Lean 4 module, and
+add ``:Proofs:`` only where a proof covers the check the threat rests
+on. ``make -C Documentation check`` verifies them against the tree.
Page metadata
-------------