|
| 1 | +# NFTBan — Integrity & Build Status |
| 2 | + |
| 3 | +> **Policy:** Main branch is always green. Failed CI blocks merge. |
| 4 | +> No manual overrides for truth-critical checks. Evidence over claims. |
| 5 | +
|
| 6 | +**Current version:** v1.89.0 |
| 7 | +**Truth model:** Kernel → Validator → CLI |
| 8 | +**Enforcement:** [Design Principles](docs/DESIGN_PRINCIPLES.md) |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +## 0. What This Page Represents |
| 13 | + |
| 14 | +This is not a badge collection. |
| 15 | + |
| 16 | +This page is a **live, machine-verifiable audit surface** showing how NFTBan |
| 17 | +enforces system integrity through automated CI/CD pipelines. |
| 18 | + |
| 19 | +**Authority model:** |
| 20 | +Kernel (nftables) is the only source of truth. All validation, metrics, and |
| 21 | +CLI output derive from kernel state via the Go validator. The daemon `/metrics` |
| 22 | +endpoint is the canonical runtime observability surface. |
| 23 | + |
| 24 | +**Evidence model:** |
| 25 | +Protection state is derived from kernel-observable evidence (counters, sets, |
| 26 | +meters). Structural presence alone does not imply enforcement. |
| 27 | + |
| 28 | +Every check listed here is: |
| 29 | + |
| 30 | +- **Automated** — runs without human intervention on every PR and push |
| 31 | +- **Reproducible** — identical inputs produce identical results |
| 32 | +- **Verifiable** — badge links go directly to workflow run logs |
| 33 | + |
| 34 | +No check relies on manual verification. |
| 35 | + |
| 36 | +If any check fails, the corresponding code **cannot be merged or released**. |
| 37 | + |
| 38 | +This model allows operators and auditors to independently verify system |
| 39 | +integrity without trusting documentation or claims. |
| 40 | + |
| 41 | +This page covers four verification axes: |
| 42 | + |
| 43 | +1. Build correctness and runtime safety |
| 44 | +2. Architecture and contract enforcement |
| 45 | +3. Security and supply chain integrity |
| 46 | +4. Compliance and provenance attestation |
| 47 | + |
| 48 | +--- |
| 49 | + |
| 50 | +## 1. Build & Runtime Verification |
| 51 | + |
| 52 | +These workflows verify that NFTBan compiles, installs, and executes correctly |
| 53 | +across all supported platforms. |
| 54 | + |
| 55 | +| Workflow | What it verifies | Frequency | Status | |
| 56 | +|---|---|---|---| |
| 57 | +| [Go Build & Test](https://github.com/itcmsgr/nftban/actions/workflows/ci-go.yml) | Compilation, unit tests, race detection, module completeness (G8-1/2/3), schema codegen lock | Every PR + push | [](https://github.com/itcmsgr/nftban/actions/workflows/ci-go.yml) | |
| 58 | +| [Bash Validation](https://github.com/itcmsgr/nftban/actions/workflows/ci-bash.yml) | Shell correctness under `set -Eeuo pipefail`, execution safety | Every PR + push | [](https://github.com/itcmsgr/nftban/actions/workflows/ci-bash.yml) | |
| 59 | +| [ShellCheck](https://github.com/itcmsgr/nftban/actions/workflows/shellcheck.yml) | Static shell analysis (SC2 rules) | Every PR + push | [](https://github.com/itcmsgr/nftban/actions/workflows/shellcheck.yml) | |
| 60 | +| [Build Packages](https://github.com/itcmsgr/nftban/actions/workflows/build-packages.yml) | RPM + DEB build and install test across 7 platform targets | Every PR + push | [](https://github.com/itcmsgr/nftban/actions/workflows/build-packages.yml) | |
| 61 | +| [Docker](https://github.com/itcmsgr/nftban/actions/workflows/docker.yml) | Container build reproducibility | Every PR + push | [](https://github.com/itcmsgr/nftban/actions/workflows/docker.yml) | |
| 62 | +| [Smoke Test](https://github.com/itcmsgr/nftban/actions/workflows/ci-smoke.yml) | CLI runtime execution, JSON output validity, runtime anomaly detection | Every PR + push | [](https://github.com/itcmsgr/nftban/actions/workflows/ci-smoke.yml) | |
| 63 | +| [Release](https://github.com/itcmsgr/nftban/actions/workflows/release.yml) | Signed release pipeline with provenance attestation | Release only | [](https://github.com/itcmsgr/nftban/actions/workflows/release.yml) | |
| 64 | + |
| 65 | +--- |
| 66 | + |
| 67 | +## 2. Architecture & Contract Enforcement |
| 68 | + |
| 69 | +These workflows enforce structural invariants that prevent regression of the |
| 70 | +kernel-first truth model. |
| 71 | + |
| 72 | +**Structural invariant:** No rule may shadow another. Detection logic must |
| 73 | +remain reachable in the nftables chain. Shadowed logic (e.g., accept rules |
| 74 | +before detection jumps) is treated as DEGRADED state. |
| 75 | + |
| 76 | +| Workflow | What it verifies | Frequency | Status | |
| 77 | +|---|---|---|---| |
| 78 | +| [Architecture Policy](https://github.com/itcmsgr/nftban/actions/workflows/ci-architecture.yml) | Schema integrity, vocabulary discipline (G1-1), module consistency (G8-4), codegen drift detection, nft direct-write protection | Every PR + push | [](https://github.com/itcmsgr/nftban/actions/workflows/ci-architecture.yml) | |
| 79 | +| [Documentation](https://github.com/itcmsgr/nftban/actions/workflows/ci-docs.yml) | Markdown lint, link validity, doc completeness | Every PR + push | [](https://github.com/itcmsgr/nftban/actions/workflows/ci-docs.yml) | |
| 80 | +| [Project Health](https://github.com/itcmsgr/nftban/actions/workflows/project-health.yml) | Repository hygiene, stale issues, PR quality | Scheduled | [](https://github.com/itcmsgr/nftban/actions/workflows/project-health.yml) | |
| 81 | + |
| 82 | +The Architecture Policy workflow is the primary anti-regression guard. It |
| 83 | +prevents changes that would break the kernel → validator → CLI truth pipeline |
| 84 | +or introduce vocabulary drift in operator-facing output. |
| 85 | + |
| 86 | +--- |
| 87 | + |
| 88 | +## 3. Security & Supply Chain (Zero-Trust) |
| 89 | + |
| 90 | +These workflows implement defense-in-depth security scanning. No single tool |
| 91 | +covers all attack surfaces — the combination provides layered coverage. |
| 92 | + |
| 93 | +| Workflow | What it verifies | Frequency | Status | |
| 94 | +|---|---|---|---| |
| 95 | +| [CodeQL](https://github.com/itcmsgr/nftban/actions/workflows/codeql.yml) | Semantic SAST for Go (data flow, taint tracking) | Every PR + push | [](https://github.com/itcmsgr/nftban/actions/workflows/codeql.yml) | |
| 96 | +| [Semgrep](https://github.com/itcmsgr/nftban/actions/workflows/semgrep.yml) | Pattern-based security rules (Go + Shell) | Every PR + push | [](https://github.com/itcmsgr/nftban/actions/workflows/semgrep.yml) | |
| 97 | +| [Secure Go](https://github.com/itcmsgr/nftban/actions/workflows/secure-go.yml) | gosec, govulncheck, staticcheck, Trivy container scan | Every PR + push | [](https://github.com/itcmsgr/nftban/actions/workflows/secure-go.yml) | |
| 98 | +| [OSV-Scanner](https://github.com/itcmsgr/nftban/actions/workflows/osv-scanner.yml) | Dependency CVE detection via Google OSV database | Every PR + weekly | [](https://github.com/itcmsgr/nftban/actions/workflows/osv-scanner.yml) | |
| 99 | +| [Gitleaks](https://github.com/itcmsgr/nftban/actions/workflows/gitleaks.yml) | Secret and credential leakage detection | Every PR + push | [](https://github.com/itcmsgr/nftban/actions/workflows/gitleaks.yml) | |
| 100 | +| [Fuzz Tests](https://github.com/itcmsgr/nftban/actions/workflows/fuzz.yml) | Parser robustness via automated fuzzing | Nightly | [](https://github.com/itcmsgr/nftban/actions/workflows/fuzz.yml) | |
| 101 | +| [Dependency Review](https://github.com/itcmsgr/nftban/actions/workflows/dependency-review.yml) | Dependency diff risk analysis on PRs | Every PR | [](https://github.com/itcmsgr/nftban/actions/workflows/dependency-review.yml) | |
| 102 | +| [Socket Supply Chain](https://github.com/itcmsgr/nftban/actions/workflows/socket-supplychain.yml) | Typosquatting, malicious package, and behavioral detection | Every PR + push | [](https://github.com/itcmsgr/nftban/actions/workflows/socket-supplychain.yml) | |
| 103 | +| [Security Summary](https://github.com/itcmsgr/nftban/actions/workflows/security-summary.yml) | Consolidated security posture dashboard | Scheduled | [](https://github.com/itcmsgr/nftban/actions/workflows/security-summary.yml) | |
| 104 | + |
| 105 | +--- |
| 106 | + |
| 107 | +## 4. Compliance & Provenance |
| 108 | + |
| 109 | +These workflows provide verifiable evidence of license compliance and build |
| 110 | +provenance for enterprise and audit requirements. |
| 111 | + |
| 112 | +| Workflow | What it verifies | Frequency | Status | |
| 113 | +|---|---|---|---| |
| 114 | +| [OSSRA Remediation](https://github.com/itcmsgr/nftban/actions/workflows/ossra-remediation.yml) | License compliance (go-licenses), SPDX header validation, dependency freshness (libyear), URL integrity (Lychee) | Every PR + push | [](https://github.com/itcmsgr/nftban/actions/workflows/ossra-remediation.yml) | |
| 115 | +| [OpenSSF Scorecard](https://github.com/itcmsgr/nftban/actions/workflows/scorecard.yml) | OpenSSF security posture scoring | Scheduled | [](https://github.com/itcmsgr/nftban/actions/workflows/scorecard.yml) | |
| 116 | +| [SLSA Provenance](https://github.com/itcmsgr/nftban/actions/workflows/slsa-go-releaser.yml) | Cryptographic build attestation (SLSA Level 3) | Release only | [](https://slsa.dev) | |
| 117 | + |
| 118 | +Every release includes: |
| 119 | + |
| 120 | +- SLSA Level 3 provenance (non-forgeable build attestation) |
| 121 | +- SBOM in SPDX-JSON format |
| 122 | +- GPG-signed tags and artifacts |
| 123 | +- All GitHub Actions pinned to commit SHAs |
| 124 | + |
| 125 | +--- |
| 126 | + |
| 127 | +## 5. Contract Gates |
| 128 | + |
| 129 | +These are **blocking gates** enforced by CI workflows. A failure in any gate |
| 130 | +prevents merge to main. They enforce [Design Principles](docs/DESIGN_PRINCIPLES.md) |
| 131 | +directly in code — not by policy document, but by automated test. |
| 132 | + |
| 133 | +| Gate | Design Principle | What it prevents | |
| 134 | +|---|---|---| |
| 135 | +| **G1-1** | Vocabulary discipline | Banned terms in CLI output ("healthy", "OK", "working", etc.) | |
| 136 | +| **G2-3** | Schema consistency | CLI expected schema ≠ validator schema version | |
| 137 | +| **G8-1** | Module completeness | CORE module missing from evaluator or JSON output | |
| 138 | +| **G8-2** | Config classification | Module config directory without classification | |
| 139 | +| **G8-3** | IPv6 parity | IPv4 structural check without matching IPv6 check | |
| 140 | +| **G8-4** | Cross-surface truth | Validator module list ≠ CLI module list | |
| 141 | +| **INV-M-001** | Single kernel read | Evidence layer calls nft directly (must go through validator) | |
| 142 | +| **INV-M-003** | Metric ownership | Duplicate metric collection across components | |
| 143 | +| **INV-M-005** | No shell duplication | Shell exporter duplicates daemon kernel collection | |
| 144 | + |
| 145 | +These gates are tested as part of `ci-go.yml` (Go unit tests) and |
| 146 | +`ci-architecture.yml` (structural policy checks). |
| 147 | + |
| 148 | +--- |
| 149 | + |
| 150 | +## 6. Pipeline Statistics (Automation Proof) |
| 151 | + |
| 152 | +These values represent enforced automation, not documentation claims. |
| 153 | + |
| 154 | +| Metric | Value | |
| 155 | +|---|---| |
| 156 | +| CI/CD workflows | 24 | |
| 157 | +| Security scanning tools | 10 | |
| 158 | +| Contract gates (blocking) | 9 | |
| 159 | +| Package build targets | 7 (el9, el10, ubuntu22/24, debian12/13, + validation) | |
| 160 | +| Install test environments | 5 (rocky9, alma9, centos-stream9/10, debian12) | |
| 161 | +| Canonical daemon metrics | ~110 (post v1.90 name freeze) | |
| 162 | +| Provenance level | SLSA Level 3 | |
| 163 | +| SBOM format | SPDX-JSON | |
| 164 | + |
| 165 | +--- |
| 166 | + |
| 167 | +## 7. Runtime Truth Verification |
| 168 | + |
| 169 | +Post-deploy verification commands that prove kernel enforcement on live hosts: |
| 170 | + |
| 171 | +```bash |
| 172 | +# 1. Kernel-derived health state (authoritative) |
| 173 | +nftban-validate --json | jq '.status' |
| 174 | +# Expected: "protected", "idle", or "degraded" |
| 175 | + |
| 176 | +# 2. CLI truth (must match validator — INV-CONS-001) |
| 177 | +nftban health --json | jq '.status' |
| 178 | +# Must match validator output exactly |
| 179 | + |
| 180 | +# 3. Evidence metrics (observable enforcement data) |
| 181 | +nftban metrics evidence |
| 182 | +nftban metrics evidence-json |
| 183 | + |
| 184 | +# 4. Kernel structure verification |
| 185 | +nft list tables |
| 186 | +nft list chain ip nftban input | grep ANCHOR |
| 187 | +# Must show 7 anchors: HYGIENE → TRUSTED → BAN → ESTABLISHED → DETECT → SERVICE → FINAL |
| 188 | +``` |
| 189 | + |
| 190 | +**System invariant:** Kernel == Validator == CLI |
| 191 | + |
| 192 | +If any of these commands disagree, the system state is invalid and must be |
| 193 | +treated as DEGRADED regardless of what individual surfaces report. |
| 194 | + |
| 195 | +--- |
| 196 | + |
| 197 | +## 8. Health Policy |
| 198 | + |
| 199 | +- Main branch is always green |
| 200 | +- Failed CI blocks merge — no exceptions |
| 201 | +- No manual overrides for truth-critical checks |
| 202 | +- Every release is CI-gated before tag |
| 203 | +- Evidence over claims — if it cannot be measured, it cannot be stated |
| 204 | +- Unknown state → DEGRADED (never PROTECTED) |
| 205 | + |
| 206 | +--- |
| 207 | + |
| 208 | +## 9. Interpretation Guide |
| 209 | + |
| 210 | +| Badge status | Meaning | |
| 211 | +|---|---| |
| 212 | +| **Green** | Workflow passed — invariant verified | |
| 213 | +| **Red** | Workflow failed — code cannot merge or release until resolved | |
| 214 | +| **Skipped** | Workflow not triggered for this event type (expected for some PR-only checks) | |
| 215 | +| **Neutral** | Advisory result (e.g., gosec code annotations) — does not block | |
| 216 | +| **No badge** | Workflow runs on a different trigger (release-only, scheduled) | |
| 217 | + |
| 218 | +--- |
| 219 | + |
| 220 | +## 10. Integrity Statement |
| 221 | + |
| 222 | +NFTBan does not claim protection. It **proves** protection through: |
| 223 | + |
| 224 | +- **Kernel evidence** — nftables counters, sets, and chain structure |
| 225 | +- **Automated validation** — Go validator reads kernel state (~1ms) |
| 226 | +- **Reproducible CI** — 24 workflows, 10 security tools, 9 contract gates |
| 227 | +- **Cryptographic provenance** — SLSA Level 3 attestation on every release |
| 228 | + |
| 229 | +If any invariant breaks, the system reports **DEGRADED**, not PROTECTED. |
| 230 | + |
| 231 | +This is not a design claim. It is enforced by CI and validator logic. |
| 232 | + |
| 233 | +--- |
| 234 | + |
| 235 | +> [SECURITY.md](SECURITY.md) — Vulnerability reporting and supported versions |
| 236 | +> [Design Principles](docs/DESIGN_PRINCIPLES.md) — Engineering contract for all components |
| 237 | +> [Wiki](https://github.com/itcmsgr/nftban/wiki) — Full system specification |
0 commit comments