|
7 | 7 | (version "1.0.0") |
8 | 8 | (schema-version "1.0") |
9 | 9 | (created "2026-01-17") |
10 | | - (updated "2026-02-28") |
| 10 | + (updated "2026-02-28T3") |
11 | 11 | (project "http-capability-gateway") |
12 | 12 | (repo "github.com/hyperpolymath/http-capability-gateway")) |
13 | 13 |
|
|
19 | 19 | (OTP "27+") |
20 | 20 | (Plug "HTTP interface") |
21 | 21 | (Cowboy "HTTP server") |
22 | | - (ETS "Policy storage + rate limiter buckets") |
| 22 | + (ETS "Policy storage + rate limiter buckets + Minikaran windows") |
23 | 23 | (Prometheus "Metrics export"))) |
24 | 24 |
|
25 | 25 | (current-position |
26 | 26 | (phase "production-ready") |
27 | | - (overall-completion 98) |
| 27 | + (overall-completion 99) |
28 | 28 | (components |
29 | 29 | (policy-pipeline "100% - DSL v1 loader, validator, compiler, tiered lookup with dedicated regex ETS table") |
30 | 30 | (http-gateway "100% - Verb enforcement, proxy, stealth, security headers, SafeTrust integration") |
31 | 31 | (health-checks "100% - /health, /ready endpoints with dual-table and rate limiter stats") |
32 | | - (metrics "100% - Prometheus /metrics endpoint") |
| 32 | + (metrics "100% - Prometheus /metrics endpoint with Minikaran anomaly counters") |
33 | 33 | (mtls "100% - Certificate-based trust extraction") |
34 | 34 | (containerization "100% - Containerfile, docker-compose") |
35 | 35 | (performance "100% - Tiered ETS lookup (exact->regex->global), dedicated regex table, O(1) literal paths") |
36 | 36 | (security-hardening "100% - OWASP headers, safe verb allowlist, trust header spoofing protection, atomic dual-table reload, specific rescue clauses") |
37 | 37 | (safe-trust "100% - Verified trust hierarchy from proven/SafeTrust.idr, parse_trust/parse_exposure, evaluate/2") |
38 | 38 | (rate-limiter "100% - Token bucket per trust level, ETS-backed, 429+Retry-After, X-Forwarded-For client key") |
| 39 | + (minikaran "100% - Traffic shape anomaly detector with 5 detection strategies, ETS-backed sliding windows, telemetry integration, /api/v1/minikaran dashboard") |
| 40 | + (k9-contracts "100% - K9-SVC service contracts: per-route obligations, guarantees, breach policies (log/alert/circuit_break/fallback), ETS-backed O(1) lookup, wired into gateway pipeline") |
39 | 41 | (documentation "80% - ExDoc, README, TOPOLOGY, missing deployment guide")) |
40 | 42 | (working-features |
41 | 43 | "Policy loading and validation" |
|
52 | 54 | "Atomic dual-table policy reload (zero-downtime ETS swap)" |
53 | 55 | "SafeTrust verified trust hierarchy (replaces ad-hoc evaluate_access)" |
54 | 56 | "Token bucket rate limiting per trust level (10/100/unlimited rps)" |
55 | | - "Rate limiter wired into plug pipeline after trust extraction")) |
| 57 | + "Rate limiter wired into plug pipeline after trust extraction" |
| 58 | + "Minikaran traffic anomaly detector (z-score, trust shift, latency spike, path novelty, error spike)" |
| 59 | + "Minikaran telemetry handlers (access_decision, request_completed, rate_limit_exceeded)" |
| 60 | + "Minikaran dashboard endpoint (/api/v1/minikaran) with anomalies, baseline, status")) |
56 | 61 |
|
57 | 62 | (route-to-mvp |
58 | 63 | (milestones |
|
66 | 71 | (completed "2026-02-07")) |
67 | 72 | (v1.0.0 |
68 | 73 | (status "in-progress") |
69 | | - (description "Production ready - health checks, metrics, mTLS, containers, rate limiting") |
70 | | - (progress 98) |
| 74 | + (description "Production ready - health checks, metrics, mTLS, containers, rate limiting, anomaly detection") |
| 75 | + (progress 99) |
71 | 76 | (remaining |
72 | 77 | "Deployment guide documentation" |
73 | 78 | "Policy DSL reference documentation")))) |
|
81 | 86 | (low |
82 | 87 | "Example policy file uses old format (needs DSL v1 update)" |
83 | 88 | "Benchmark tiered lookup vs flat scan for different policy sizes" |
84 | | - "Rate limiter bucket cleanup for stale entries (low-priority, minimal memory)")) |
| 89 | + "Rate limiter bucket cleanup for stale entries (low-priority, minimal memory)" |
| 90 | + "Minikaran window bucket cleanup could be more efficient with :ets.select_delete")) |
85 | 91 |
|
86 | 92 | (critical-next-actions |
87 | 93 | (immediate |
|
93 | 99 | "Update performance tests for DSL v1") |
94 | 100 | (this-month |
95 | 101 | "Add request/response logging" |
96 | | - "Add rate limiter bucket cleanup (periodic sweep of stale entries)")) |
| 102 | + "Add rate limiter bucket cleanup (periodic sweep of stale entries)" |
| 103 | + "Add Minikaran alerting integration (webhook/email on anomaly)")) |
97 | 104 |
|
98 | 105 | (session-history |
| 106 | + (session |
| 107 | + (date "2026-02-28") |
| 108 | + (focus "K9-SVC service contracts") |
| 109 | + (accomplishments |
| 110 | + "Created K9Contract module with ETS-backed contract storage (O(1) lookup by route+verb)" |
| 111 | + "Contract registration with SHA-256 content-addressable IDs (deterministic, auditable)" |
| 112 | + "Pre-proxy enforcement: trust threshold checking via SafeTrust.satisfies?/2" |
| 113 | + "Post-proxy enforcement: response latency measured against max_latency_ms" |
| 114 | + "Four breach policies: :log, :alert, :circuit_break, :fallback" |
| 115 | + "Breach counter tracking for circuit_break policy with configurable threshold" |
| 116 | + "Wildcard route pattern matching (e.g., /api/users/* matches /api/users/123)" |
| 117 | + "Safe string-to-atom parsing for breach policies (never String.to_atom on user input)" |
| 118 | + "Wired into gateway.ex: enforce_with_contract wrapper around Proxy.forward" |
| 119 | + "Telemetry events: k9_contract.registered, k9_contract.fulfilled, k9_contract.breach, k9_contract.alert, k9_contract.circuit_break") |
| 120 | + (notes "K9 contracts sit above a2ml attestations — contracts declare obligations and guarantees, attestations handle identity/audit. Gateway enforces contracts by measuring actual performance against declared thresholds.")) |
| 121 | + (session |
| 122 | + (date "2026-02-28") |
| 123 | + (focus "Minikaran traffic shape anomaly detector") |
| 124 | + (accomplishments |
| 125 | + "Created Minikaran GenServer with 60-minute sliding window of 1-minute ETS-backed buckets" |
| 126 | + "Implemented 5 anomaly detection strategies: z-score traffic spikes, trust distribution shifts, latency p95 spikes, path novelty detection, error rate spikes" |
| 127 | + "Created TelemetryHandler module hooking into access_decision, request_completed, rate_limit_exceeded events" |
| 128 | + "Wired Minikaran into Application supervision tree (started before HTTP server)" |
| 129 | + "Attached telemetry handlers after supervision tree startup" |
| 130 | + "Added /api/v1/minikaran dashboard endpoint returning JSON (anomalies, baseline, status)" |
| 131 | + "Added Minikaran anomaly counter to Prometheus telemetry metrics" |
| 132 | + "Statistical helpers: z-score, percentile (nearest-rank), mean, stddev" |
| 133 | + "Learning phase: requires 5+ baseline windows before anomaly detection activates" |
| 134 | + "All observation recording is async (GenServer.cast) -- zero request pipeline blocking") |
| 135 | + (notes "Minikaran is a lightweight sentinel that observes without blocking. It learns traffic patterns and flags deviations using ETS for performance and Process.send_after for periodic checks every 30s.")) |
99 | 136 | (session |
100 | 137 | (date "2026-02-28") |
101 | 138 | (focus "SafeTrust integration, dedicated regex ETS table, rate limiter") |
|
0 commit comments