Skip to content

Commit f51c4ba

Browse files
authored
Merge pull request #432 from itcmsgr/feat/v1.90-contract-freeze
feat(metrics): v1.90 contract freeze — alias removal + governance
2 parents 54db2a5 + c0be6ed commit f51c4ba

15 files changed

Lines changed: 642 additions & 112 deletions

CODE_OF_CONDUCT.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Code of Conduct
2+
3+
## Purpose
4+
5+
NFTBan is a systems-level security project.
6+
Collaboration must remain clear, technical, and focused on verifiable outcomes.
7+
8+
This Code of Conduct defines expected behavior for all contributors,
9+
maintainers, and participants.
10+
11+
## Expected Behavior
12+
13+
All participants are expected to:
14+
15+
- Communicate clearly and directly
16+
- Focus on technical correctness and evidence
17+
- Respect differing viewpoints and experience levels
18+
- Accept feedback based on system requirements and constraints
19+
- Keep discussions relevant to the project scope
20+
21+
## Unacceptable Behavior
22+
23+
The following is not acceptable:
24+
25+
- Personal attacks, insults, or harassment
26+
- Dismissive or non-constructive responses
27+
- Off-topic or disruptive discussions
28+
- Misrepresentation of system behavior or capabilities
29+
- Introducing claims without technical basis
30+
31+
## Engineering Conduct
32+
33+
NFTBan operates under strict engineering principles:
34+
35+
- Kernel state is the only source of truth
36+
- All claims must be verifiable (CI, validator, or runtime evidence)
37+
- Changes must preserve system invariants
38+
- Discussions should reference code, metrics, or documented behavior
39+
40+
If a proposal cannot be verified, it must not be presented as fact.
41+
42+
See [Design Principles](docs/DESIGN_PRINCIPLES.md) for the full engineering
43+
contract.
44+
45+
## Decision Model
46+
47+
Decisions are made based on:
48+
49+
- System invariants ([Design Principles](docs/DESIGN_PRINCIPLES.md))
50+
- Measurable evidence (validator, metrics, CI)
51+
- Reproducibility across supported platforms
52+
53+
Preferences or opinions do not override these criteria.
54+
55+
## Enforcement
56+
57+
Maintainers are responsible for enforcing this Code of Conduct.
58+
59+
Actions may include:
60+
61+
- Requesting clarification or correction
62+
- Redirecting or closing discussions
63+
- Removing inappropriate content
64+
- Restricting participation in repeated violation cases
65+
66+
## Reporting
67+
68+
If you encounter behavior that violates this Code of Conduct:
69+
70+
- Open a private discussion with maintainers, or
71+
- Contact: security@nftban.com
72+
73+
Reports should include relevant context and examples.
74+
75+
## Scope
76+
77+
This Code of Conduct applies to:
78+
79+
- GitHub issues, pull requests, and discussions
80+
- Documentation and code reviews
81+
- Project communication channels
82+
83+
## Summary
84+
85+
NFTBan values:
86+
87+
- Technical clarity
88+
- Verifiable correctness
89+
- Respectful collaboration
90+
91+
All participation must support these goals.

CONTRIBUTING.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
# Contributing to NFTBan
22

3-
Thank you for your interest in contributing to NFTBAN! This document provides guidelines for contributing.
3+
Thank you for your interest in contributing to NFTBan! This document provides guidelines for contributing.
4+
5+
## System Integrity Model
6+
7+
NFTBan enforces correctness through:
8+
9+
- [STATUS.md](STATUS.md) — CI/CD audit surface (build, security, contract gates)
10+
- [docs/DESIGN_PRINCIPLES.md](docs/DESIGN_PRINCIPLES.md) — engineering contract
11+
12+
All contributions must preserve:
13+
14+
- Kernel-first authority
15+
- Validator-derived truth
16+
- Evidence-based protection
17+
- CI-enforced invariants
18+
19+
Changes that violate these principles must not be merged.
20+
21+
---
422

523
## About the Project
624

SECURITY.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Security Policy
22

3+
## Integrity & Build Verification
4+
5+
NFTBan enforces security through a kernel-first validation model and automated
6+
CI/CD pipelines.
7+
8+
**Full audit surface:** [Integrity & Build Status (STATUS.md)](STATUS.md)
9+
10+
This includes:
11+
- CI pipeline results (build, security, compliance)
12+
- Contract gate enforcement
13+
- Supply chain verification (SLSA Level 3)
14+
- Runtime verification commands
15+
16+
This page describes vulnerability reporting and security policy.
17+
STATUS.md provides machine-verifiable system integrity.
18+
19+
---
20+
321
## About NFTBan
422

523
NFTBan is an open-source Linux Intrusion Prevention System (IPS) and firewall manager built on nftables. Security is foundational to the architecture, featuring capability-based privilege separation, systemd sandboxing, Unix socket IPC, and strict input validation at all layers.

STATUS.md

Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
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 | [![Go](https://github.com/itcmsgr/nftban/actions/workflows/ci-go.yml/badge.svg)](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 | [![Bash](https://github.com/itcmsgr/nftban/actions/workflows/ci-bash.yml/badge.svg)](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 | [![ShellCheck](https://github.com/itcmsgr/nftban/actions/workflows/shellcheck.yml/badge.svg)](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 | [![Build](https://github.com/itcmsgr/nftban/actions/workflows/build-packages.yml/badge.svg)](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 | [![Docker](https://github.com/itcmsgr/nftban/actions/workflows/docker.yml/badge.svg)](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 | [![Smoke](https://github.com/itcmsgr/nftban/actions/workflows/ci-smoke.yml/badge.svg)](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 | [![Release](https://github.com/itcmsgr/nftban/actions/workflows/release.yml/badge.svg)](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 | [![Architecture](https://github.com/itcmsgr/nftban/actions/workflows/ci-architecture.yml/badge.svg)](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 | [![Docs](https://github.com/itcmsgr/nftban/actions/workflows/ci-docs.yml/badge.svg)](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 | [![Health](https://github.com/itcmsgr/nftban/actions/workflows/project-health.yml/badge.svg)](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 | [![CodeQL](https://github.com/itcmsgr/nftban/actions/workflows/codeql.yml/badge.svg)](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 | [![Semgrep](https://github.com/itcmsgr/nftban/actions/workflows/semgrep.yml/badge.svg)](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 | [![SecureGo](https://github.com/itcmsgr/nftban/actions/workflows/secure-go.yml/badge.svg)](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 | [![OSV](https://github.com/itcmsgr/nftban/actions/workflows/osv-scanner.yml/badge.svg)](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 | [![Gitleaks](https://github.com/itcmsgr/nftban/actions/workflows/gitleaks.yml/badge.svg)](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 | [![Fuzz](https://github.com/itcmsgr/nftban/actions/workflows/fuzz.yml/badge.svg)](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 | [![DepReview](https://github.com/itcmsgr/nftban/actions/workflows/dependency-review.yml/badge.svg)](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 | [![Socket](https://github.com/itcmsgr/nftban/actions/workflows/socket-supplychain.yml/badge.svg)](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 | [![SecSummary](https://github.com/itcmsgr/nftban/actions/workflows/security-summary.yml/badge.svg)](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 | [![OSSRA](https://github.com/itcmsgr/nftban/actions/workflows/ossra-remediation.yml/badge.svg)](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 | [![Scorecard](https://github.com/itcmsgr/nftban/actions/workflows/scorecard.yml/badge.svg)](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 | [![SLSA 3](https://slsa.dev/images/gh-badge-level3.svg)](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

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.89.0
1+
1.90.0

cli/lib/nftban/core/nftban_fhs_spec.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env bash
22
# =============================================================================
3-
# NFTBan v1.89.0 - FHS Specification (GENERATED)
3+
# NFTBan v1.90.0 - FHS Specification (GENERATED)
44
# =============================================================================
55
# SPDX-License-Identifier: MPL-2.0
66
#
77
# meta:name="nftban_fhs_spec"
88
# meta:type="core"
99
# meta:header="FHS Specification"
10-
# meta:version="1.89.0"
10+
# meta:version="1.90.0"
1111
# meta:owner="Antonios Voulvoulis <contact@nftban.com>"
1212
# meta:homepage="https://nftban.com"
1313
#

0 commit comments

Comments
 (0)