Skip to content

Commit e440fbd

Browse files
hyperpolymathclaude
andcommitted
docs: add TEST-NEEDS.md and/or PROOF-NEEDS.md from audit
Documents testing and proof gaps identified during batch audit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c8cde53 commit e440fbd

2 files changed

Lines changed: 84 additions & 0 deletions

File tree

PROOF-NEEDS.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# PROOF-NEEDS.md — php-aegis
2+
3+
## Current State
4+
5+
- **src/abi/*.idr**: NO
6+
- **Dangerous patterns**: 0
7+
- **LOC**: ~10,200 (PHP)
8+
- **ABI layer**: Missing
9+
10+
## What Needs Proving
11+
12+
| Component | What | Why |
13+
|-----------|------|-----|
14+
| Security header generation | Generated headers are well-formed and complete | Malformed security headers leave sites unprotected |
15+
| CSP policy construction | Content Security Policy prevents all XSS vectors | Incomplete CSP allows cross-site scripting |
16+
| Webmention validation | IndieWeb Webmention verification is correct | Spoofed webmentions inject malicious content |
17+
| Input validation | All validators reject malicious input | Validator bypass is a security vulnerability |
18+
19+
## Recommended Prover
20+
21+
**Idris2** — Create `src/abi/` with security header correctness types. CSP policy completeness is a natural fit for exhaustive pattern matching. PHP code would need a separate verification approach (potentially PHPStan + custom rules).
22+
23+
## Priority
24+
25+
**MEDIUM** — Security library deployed on production websites (lcb-website uses it). Incorrect security headers directly expose users to attacks. CSP completeness is the highest-value proof target.

TEST-NEEDS.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# TEST-NEEDS.md — php-aegis
2+
3+
> Generated 2026-03-29 by punishing audit.
4+
5+
## Current State
6+
7+
| Category | Count | Notes |
8+
|-------------|-------|-------|
9+
| Unit tests | 11 | HeadersTest, SanitizerTest, TurtleEscaperTest, ValidatorTest, WordPress/AdapterTest, IndieWeb/(MicropubTest, IndieAuthTest, WebmentionTest), RateLimit/(TokenBucketTest, StoreTest, RateLimiterTest) |
10+
| Integration | 3 | validation/RealWorldTest.php, run-tests.php, test-cf7-xss.php |
11+
| E2E | 0 | None |
12+
| Benchmarks | 0 | None |
13+
14+
**Source modules:** 14 PHP source files in src/. Covers: headers, sanitizer, turtle escaper, validator, WordPress adapter, IndieWeb (Micropub, IndieAuth, Webmention), RateLimit (TokenBucket, Store, RateLimiter).
15+
16+
## What's Missing
17+
18+
### P2P (Property-Based) Tests
19+
- [ ] Sanitizer: property tests with arbitrary HTML/JS input
20+
- [ ] Validator: property tests for all input types
21+
- [ ] Rate limiter: property tests for token bucket invariants (never negative, refill correctness)
22+
- [ ] Headers: property tests for CSP generation correctness
23+
24+
### E2E Tests
25+
- [ ] Full request lifecycle: incoming request -> sanitize -> validate -> rate check -> process -> headers
26+
- [ ] WordPress integration: full plugin activation -> request -> response with security headers
27+
- [ ] IndieWeb: full Micropub/IndieAuth/Webmention flow with validation
28+
29+
### Aspect Tests
30+
- **Security:** XSS test exists (test-cf7-xss.php, good). Missing: SQL injection, CSRF bypass, header injection, rate limiter bypass, authentication timing attacks — a security library needs exhaustive security tests
31+
- **Performance:** No request processing overhead benchmarks
32+
- **Concurrency:** No tests for rate limiter under concurrent requests
33+
- **Error handling:** No tests for malformed headers, invalid token formats, WordPress incompatibility
34+
35+
### Build & Execution
36+
- [ ] PHPUnit runner setup
37+
- [ ] Composer autoload verification
38+
- [ ] WordPress test environment
39+
40+
### Benchmarks Needed
41+
- [ ] Header generation overhead per request
42+
- [ ] Sanitizer throughput per input size
43+
- [ ] Rate limiter decision time
44+
- [ ] Validator throughput
45+
46+
### Self-Tests
47+
- [ ] Security header compliance verification
48+
- [ ] Rate limiter self-test under load
49+
- [ ] Validator coverage report (all input types tested)
50+
51+
## Priority
52+
53+
**HIGH.** 14 source files with 11 test files is actually a good ratio (79%). But this is a SECURITY library — the test depth needs to be extreme, not just file-count-adequate. The XSS real-world test is commendable. Missing: fuzzing, property tests for all security functions, concurrency tests for the rate limiter. No benchmarks means you cannot prove the security overhead is acceptable.
54+
55+
## FAKE-FUZZ ALERT
56+
57+
- `tests/fuzz/placeholder.txt` is a scorecard placeholder inherited from rsr-template-repo — it does NOT provide real fuzz testing
58+
- Replace with an actual fuzz harness (see rsr-template-repo/tests/fuzz/README.adoc) or remove the file
59+
- Priority: P2 — creates false impression of fuzz coverage

0 commit comments

Comments
 (0)