Webhook alerts, Prometheus metrics, and 1.2.0 #3

Merged
lucasrguerra merged 2 commits from feat/alertas-metricas into main 2026-11-03 14:50:16 +00:00
Owner

Stacked on #2: base feat/robustez. After #2 is merged, retarget it to main.

What

  • [[webhook]]: each ingested sweep sends its surface changes, filtered by event kind and group, as Xexéu JSON or as a Slack/Discord message. Optional HMAC-SHA256 signature (X-Xexeu-Signature, key from the variable named in segredo_env, never stored in the file). Delivery runs in the background with retries on network errors, 5xx and 429, so ingestion never blocks. config check validates the URL, events, groups and variable name.
  • GET /metrics (Prometheus): hosts by status, open ports, findings by severity and KEV, CVE database and last sync, last sweep per group (time, duration, completeness, events), and webhook deliveries.
  • Security: GET /api/config and the logs show webhook URLs as scheme://host/…, because chat webhook URLs are credentials and reads are open.
  • Version: 1.2.0, with CHANGELOG, ROADMAP, README, configuration and CLI docs, the example config, compose and .env.example.

Verified

  • scripts/check.sh --full passes.
  • New e2e test (alerts_metrics_e2e), driving a real serve and scan:
    • a local receiver gets the POST with only the subscribed events and a valid signature;
    • a webhook pointing at a closed port is retried and counted as a failure;
    • /metrics reflects the sweep;
    • /api/config does not leak the URL path.
  • Unit tests:
    • filtering by event kind and group;
    • all three body formats and long-message truncation for Discord;
    • the HMAC against the RFC 4231 test vector;
    • webhook validation and redaction.

🤖 Generated with Claude Code

**Stacked on #2**: base `feat/robustez`. After #2 is merged, retarget it to `main`. ## What - **`[[webhook]]`:** each ingested sweep sends its surface changes, filtered by event kind and group, as Xexéu JSON or as a Slack/Discord message. Optional HMAC-SHA256 signature (`X-Xexeu-Signature`, key from the variable named in `segredo_env`, never stored in the file). Delivery runs in the background with retries on network errors, 5xx and 429, so ingestion never blocks. `config check` validates the URL, events, groups and variable name. - **`GET /metrics`** (Prometheus): hosts by status, open ports, findings by severity and KEV, CVE database and last sync, last sweep per group (time, duration, completeness, events), and webhook deliveries. - **Security:** `GET /api/config` and the logs show webhook URLs as `scheme://host/…`, because chat webhook URLs are credentials and reads are open. - **Version:** 1.2.0, with CHANGELOG, ROADMAP, README, configuration and CLI docs, the example config, compose and `.env.example`. ## Verified - `scripts/check.sh --full` passes. - New e2e test (`alerts_metrics_e2e`), driving a real `serve` and `scan`: - a local receiver gets the POST with only the subscribed events and a valid signature; - a webhook pointing at a closed port is retried and counted as a failure; - `/metrics` reflects the sweep; - `/api/config` does not leak the URL path. - Unit tests: - filtering by event kind and group; - all three body formats and long-message truncation for Discord; - the HMAC against the RFC 4231 test vector; - webhook validation and redaction. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
lucasrguerra changed target branch from feat/robustez to main 2026-11-03 14:38:22 +00:00
lucasrguerra added 2 commits 2026-11-03 14:38:22 +00:00
[[webhook]] receivers get each ingested sweep's changes, filtered by kind
and group, as Xexéu JSON or a Slack/Discord message, optionally signed with
HMAC-SHA256 from an environment variable. Delivery runs in the background
with retries and never blocks ingestion. GET /api/config and the logs show
webhook URLs as scheme://host/… because chat webhook URLs are credentials.

/metrics exposes hosts, ports, findings by severity, feed state, per-group
last sweep and webhook delivery counters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chore(release): 1.2.0
CI / Format and clippy (pull_request) Successful in 24s
CI / Dependency audit (pull_request) Successful in 10s
CI / Tests (Linux) (pull_request) Successful in 2m31s
CI / Docker image (build and smoke test) (pull_request) Successful in 5m47s
a6e4d43c51
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lucasrguerra merged commit 1dc754a561 into main 2026-11-03 14:50:16 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ciberfauna/harpia#3