Skip to content

Commit 8a28db1

Browse files
authored
feat: formalize security contracts and stabilize benchmark gate (#3)
1 parent 99aabf9 commit 8a28db1

20 files changed

Lines changed: 446 additions & 49 deletions

.github/workflows/benchmark.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ jobs:
3030
- name: Run benchmarks
3131
run: |
3232
./build-bench/aegisbpf_bench \
33+
--benchmark_min_time=0.2 \
34+
--benchmark_repetitions=8 \
35+
--benchmark_report_aggregates_only=true \
3336
--benchmark_format=json \
3437
--benchmark_out=benchmark.json \
3538
--benchmark_out_format=json
@@ -43,8 +46,21 @@ jobs:
4346
echo "exists=false" >> "$GITHUB_OUTPUT"
4447
fi
4548
46-
- name: Store benchmark result
47-
if: steps.benchmark-history.outputs.exists == 'true'
49+
- name: Store benchmark result (PR advisory)
50+
if: steps.benchmark-history.outputs.exists == 'true' && github.event_name == 'pull_request'
51+
uses: benchmark-action/github-action-benchmark@v1
52+
with:
53+
tool: googlecpp
54+
output-file-path: benchmark.json
55+
github-token: ${{ secrets.GITHUB_TOKEN }}
56+
auto-push: false
57+
alert-threshold: '150%'
58+
fail-on-alert: false
59+
comment-on-alert: false
60+
summary-always: true
61+
62+
- name: Store benchmark result (main strict)
63+
if: steps.benchmark-history.outputs.exists == 'true' && github.event_name != 'pull_request'
4864
uses: benchmark-action/github-action-benchmark@v1
4965
with:
5066
tool: googlecpp

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,9 @@ sudo aegisbpf run --enforce --seccomp
488488

489489
See [SECURITY.md](SECURITY.md) for vulnerability reporting, environment variables, and hardening details.
490490

491+
Security boundaries, attacker model, and known blind spots are documented in
492+
[docs/THREAT_MODEL.md](docs/THREAT_MODEL.md).
493+
491494
## Documentation
492495

493496
### Core Documentation
@@ -498,7 +501,9 @@ See [SECURITY.md](SECURITY.md) for vulnerability reporting, environment variable
498501
| [API_REFERENCE.md](docs/API_REFERENCE.md) | API reference for types, functions, and BPF maps |
499502
| [DEVELOPER_GUIDE.md](docs/DEVELOPER_GUIDE.md) | Development setup, coding standards, and contribution guide |
500503
| [POLICY.md](docs/POLICY.md) | Policy file format and semantics |
504+
| [POLICY_SEMANTICS.md](docs/POLICY_SEMANTICS.md) | Precise runtime rule semantics and edge-case behavior |
501505
| [NETWORK_LAYER_DESIGN.md](docs/NETWORK_LAYER_DESIGN.md) | Network blocking architecture |
506+
| [THREAT_MODEL.md](docs/THREAT_MODEL.md) | Threat model, coverage boundaries, and known bypass surface |
502507

503508
### Operations
504509

@@ -510,6 +515,7 @@ See [SECURITY.md](SECURITY.md) for vulnerability reporting, environment variable
510515
| [RELEASE_DRILL.md](docs/RELEASE_DRILL.md) | Pre-release packaging and upgrade drill |
511516
| [KEY_MANAGEMENT.md](docs/KEY_MANAGEMENT.md) | Policy signing key rotation and revocation runbook |
512517
| [INCIDENT_RESPONSE.md](docs/INCIDENT_RESPONSE.md) | Incident handling procedures |
518+
| [METRICS_OPERATIONS.md](docs/METRICS_OPERATIONS.md) | Metric interpretation, thresholds, and operator actions |
513519
| [runbooks/](docs/runbooks/) | Alert/incident/maintenance operational runbooks |
514520
| [VENDORED_DEPENDENCIES.md](docs/VENDORED_DEPENDENCIES.md) | Vendored dependency inventory and review cadence |
515521
| [TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md) | Common issues and solutions |

SECURITY.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ not include exploit details.
2020

2121
Initial triage target: acknowledgement within 48 hours.
2222

23+
## Threat Model and Security Boundaries
24+
25+
Authoritative security scope is documented in `docs/THREAT_MODEL.md`.
26+
27+
At a high level:
28+
- **In scope:** unprivileged process/container attempts to perform denied
29+
file/network operations.
30+
- **Out of scope:** host root compromise, malicious kernel modules, and
31+
physical/firmware attacks.
32+
- **Important boundary:** if BPF LSM is unavailable, AegisBPF degrades to
33+
audit-only behavior and cannot enforce file denial.
34+
2335

2436
## Security Hardening
2537

@@ -164,3 +176,8 @@ The following environment variables affect security behavior. In production, avo
164176
1. **BPF LSM requirement**: Full blocking requires BPF LSM to be enabled in the kernel.
165177
2. **Root namespace only**: The agent must run in the host PID/cgroup namespace.
166178
3. **No live policy reload**: Policy changes require agent restart.
179+
4. **Namespace/path ambiguity**: Path canonicalization occurs in the agent mount
180+
namespace; bind-mount and overlay paths can differ from workload-visible
181+
paths.
182+
5. **Coverage limits**: Network enforcement currently focuses on connect/bind
183+
hooks; other socket paths are not yet covered.

config/required_checks.txt

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
Benchmark / benchmark
2-
CI / build (ubuntu-22.04)
3-
CI / build (ubuntu-24.04)
4-
CI / clang-tidy
5-
CI / coverage
6-
CI / lint
7-
CI / label-contract
8-
CI / required-checks-contract
9-
CI / sanitizers (asan)
10-
CI / sanitizers (tsan)
11-
CI / sanitizers (ubsan)
12-
CI / sbom
13-
CI / smoke-fuzz
14-
CI / test
15-
Security / dependency-review
16-
Security / codeql
17-
Security / gitleaks
18-
Security / semgrep
19-
Release Readiness / readiness (ubuntu-22.04)
20-
Release Readiness / readiness (ubuntu-24.04)
1+
benchmark
2+
build (ubuntu-22.04)
3+
build (ubuntu-24.04)
4+
clang-tidy
5+
coverage
6+
lint
7+
label-contract
8+
required-checks-contract
9+
sanitizers (asan)
10+
sanitizers (tsan)
11+
sanitizers (ubsan)
12+
sbom
13+
smoke-fuzz
14+
test
15+
dependency-review
16+
codeql
17+
gitleaks
18+
semgrep
19+
readiness (ubuntu-22.04)
20+
readiness (ubuntu-24.04)

config/required_checks_release.txt

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
Benchmark / benchmark
2-
CI / build (ubuntu-22.04)
3-
CI / build (ubuntu-24.04)
4-
CI / clang-tidy
5-
CI / coverage
6-
CI / lint
7-
CI / label-contract
8-
CI / required-checks-contract
9-
CI / sanitizers (asan)
10-
CI / sanitizers (tsan)
11-
CI / sanitizers (ubsan)
12-
CI / sbom
13-
CI / smoke-fuzz
14-
CI / test
15-
Release Branch Guard / guard
16-
Release Readiness / readiness (ubuntu-22.04)
17-
Release Readiness / readiness (ubuntu-24.04)
18-
Security / dependency-review
19-
Security / codeql
20-
Security / gitleaks
21-
Security / semgrep
1+
benchmark
2+
build (ubuntu-22.04)
3+
build (ubuntu-24.04)
4+
clang-tidy
5+
coverage
6+
lint
7+
label-contract
8+
required-checks-contract
9+
sanitizers (asan)
10+
sanitizers (tsan)
11+
sanitizers (ubsan)
12+
sbom
13+
smoke-fuzz
14+
test
15+
guard
16+
readiness (ubuntu-22.04)
17+
readiness (ubuntu-24.04)
18+
dependency-review
19+
codeql
20+
gitleaks
21+
semgrep

docs/API_REFERENCE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,5 +849,7 @@ inline constexpr uint32_t kLayoutVersion = 1;
849849

850850
- [ARCHITECTURE.md](ARCHITECTURE.md) - System design overview
851851
- [POLICY.md](POLICY.md) - Policy file format details
852+
- [POLICY_SEMANTICS.md](POLICY_SEMANTICS.md) - Runtime semantics and edge cases
853+
- [THREAT_MODEL.md](THREAT_MODEL.md) - Security boundaries and blind spots
852854
- [NETWORK_LAYER_DESIGN.md](NETWORK_LAYER_DESIGN.md) - Network blocking design
853855
- [KEY_MANAGEMENT.md](KEY_MANAGEMENT.md) - Key rotation procedures

docs/BRANCH_PROTECTION.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ in sync by `.github/workflows/label-sync.yml`.
2626

2727
Use `config/required_checks.txt` as the source of truth.
2828

29+
Check names are stored as **job names** (for example, `build (ubuntu-24.04)`
30+
or `semgrep`) to match GitHub branch-protection contexts directly.
31+
2932
For protected `release/*` branches, use `config/required_checks_release.txt`.
3033

3134
## Audit command

docs/COMPATIBILITY.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,20 @@ AegisBPF cannot run if:
7676

7777
\* Requires adding `lsm=bpf` or `lsm=landlock,lockdown,yama,bpf` to kernel boot parameters.
7878

79+
## Distribution and Runtime Quirks
80+
81+
- **Ubuntu 22.04 (5.15)**: stable baseline for LSM hooks; ensure BTF package is present on custom kernels.
82+
- **Ubuntu 24.04 (6.5+)**: newer libbpf/kernel combos are generally smoother for CO-RE.
83+
- **RHEL 9.x (5.14)**: verify backported BPF features; some behavior differs from upstream 5.14 docs.
84+
- **Container hosts**: run the agent in host PID/cgroup/mount namespaces for deterministic cgroup and path behavior.
85+
- **Kubernetes**: privileged pods (or pods with host-level capabilities) are outside normal workload threat assumptions.
86+
87+
## Filesystem and Namespace Notes
88+
89+
- Path canonicalization is performed in the agent namespace at policy-apply time.
90+
- Bind mounts and overlay filesystems can present alternative path views for the same inode.
91+
- Inode-based rules remain the primary enforcement primitive; path-only expectations can diverge in namespaced setups.
92+
7993
## Enabling BPF LSM
8094

8195
### Method 1: GRUB (Recommended)

docs/DEVELOPER_GUIDE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,5 +739,7 @@ git push origin v0.2.0
739739

740740
- [API_REFERENCE.md](API_REFERENCE.md) - API documentation
741741
- [ARCHITECTURE.md](ARCHITECTURE.md) - System design
742+
- [THREAT_MODEL.md](THREAT_MODEL.md) - Security scope and blind spots
743+
- [POLICY_SEMANTICS.md](POLICY_SEMANTICS.md) - Runtime policy behavior
742744
- [TROUBLESHOOTING.md](TROUBLESHOOTING.md) - Common issues
743745
- [VENDORED_DEPENDENCIES.md](VENDORED_DEPENDENCIES.md) - Vendored dependency tracking

docs/KEY_MANAGEMENT.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
This runbook defines how to rotate and revoke policy-signing keys used by
44
AegisBPF signed policy bundles.
55

6+
## Strategy
7+
8+
- Keep private keys outside hosts (KMS/HSM or offline signer).
9+
- Trust only root-owned public keys on hosts.
10+
- Enforce monotonic `policy_version` to block rollback bundles.
11+
- Treat key add/remove operations as security-change events with two-person review.
12+
613
## Model
714

815
- Trusted public keys are loaded from `/etc/aegisbpf/keys` (or

0 commit comments

Comments
 (0)