|
| 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