feat(observability): error-log ring + trusted-proxy client-IP in dunite-core #39
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/DEV-529-error-log-client-ip"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Adds the request-observability edge to
dunite-core(DEV-529, under BUNYIP-340), extracted from bunyip-api:error_logmodule - an in-memory bounded ERROR-log ring (ErrorLogBuffer) + atracing_subscriber::Layer(ErrorLogLayer) that captures ERROR events with their structured fields (category/route/clientsplit out, the rest retained). Already generic; only the doc was de-branded.middleware::client_ip- trusted-proxy client-IP resolution:resolve_client_ip(peer, xff, real_ip, trusted_proxies)(pure) +client_ip(&HttpRequest, trusted_proxies)(actix wrapper). HonoursX-Forwarded-For/X-Real-IPonly when the socket peer is inside the configured trusted-proxy CIDR set, so an untrusted client cannot spoof its address. Joins the existing middleware (request_id, security_headers, csrf).Deps
Adds
tracing-subscriber = "0.3"to the workspace and dunite-core (theLayer/Registrythe ring plugs into), andipnetworkto dunite-core (CIDR matching; already a workspace dep).Validation
cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test -p dunite-coregreen in the pinned rust-builder image. Tests: ERROR-captured-not-warning, category filter, ring rotation, field retention (log); trusted-proxy XFF / real-ip, untrusted-peer-ignores-headers, empty-proxies, unparseable-forwarded, and the actix request reader (client-IP).Consumer follow-up (bunyip, after merge)
error_log.rs-> re-export shim overdunite_core::error_log; the admin log view and theErrorLogLayerwiring inmain.rsconsume the crate types.extract_client_ipin bunyip-domainauth.rskeeps its thin wrapper (it reads bunyip's trusted-proxy config) but delegates todunite_core::middleware::client_ip;resolve_client_ipis removed from bunyip. The ~30crate::middleware::extract_client_ipcall sites are unchanged.Bumps the dunite-core graph rev (not
dunite-user-core), so it does not cross theMembershipTierrename.Topology note
error_log lands in dunite-core per the DEV-529 spec (a foundational observability primitive). It adds
tracing-subscriberto the foundation; if you'd rather keep it a leaf crate, it's easy to move pre-consumption.#DEV-529