feat(webhook,hibp): add dunite-webhook and dunite-hibp leaf crates #37
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/DEV-527-webhook-hibp-crates"
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 two leaf crates (DEV-527, under BUNYIP-340), per the leaf-crate topology already used for geoip / ipenrich / image-upload: keep
reqwestand the crypto out ofdunite-core's foundation, and let a consumer adopt one without moving itsdunite-corerev.dunite-webhook- outbound HMAC-SHA256 signed webhook sender.WebhookSender::new(secret),sign(),send(url, payload)(fire-and-forget: logs, never errors),dispatch_with_retries(url, body, max_attempts)(signs once, exponential backoff, returns the last error on exhaustion so the caller can persist a replayable failure). The payload shape and endpoint are the caller's.dunite-hibp- HaveIBeenPwned k-anonymity password-breach check.check_password_breach(),is_breached(),BreachCheckOutcome. In-process SHA-1, only the 5-char prefix leaves the process, fail-open on outage.Both are the bunyip implementations made framework-neutral (no product strings). geoip was the third "stateless service" in DEV-527's spec and already shipped as
dunite-geoip(DEV-531), so this issue's remaining scope is breach + webhook.Deps
Adds
sha1 = "0.10"to[workspace.dependencies](the HIBP range API requires SHA-1).reqwest/hmac/sha2/hex/wiremockwere already workspace deps.Validation
cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspacegreen in the pinned rust-builder image. Tests: HMAC determinism + per-payload / per-secret distinctness, plus wiremock deliver-with-valid-signature and retry-then-exhaust for the webhook; SHA-1 hash pinning for HIBP.Consumer follow-up (bunyip, after merge)
crates/bunyip-domain/src/services/password_breach.rs-> a re-export shim overdunite_hibp(the geoip pattern).crates/bunyip-domain/src/services/webhook.rs-> keep theWebhookServicewrapper (it builds the event payloads from bunyip'sApplication) over adunite_webhook::WebhookSender.Pinned as leaves, so consuming them does not move bunyip's
dunite-corerev.#DEV-527