Skip to content

feat(netprobe): HTTP/DoH probes v2 — success criteria, TLS cert expiry, headers/proxy/mTLS#793

Draft
leoparente wants to merge 14 commits into
developfrom
feat/netprobe-v2
Draft

feat(netprobe): HTTP/DoH probes v2 — success criteria, TLS cert expiry, headers/proxy/mTLS#793
leoparente wants to merge 14 commits into
developfrom
feat/netprobe-v2

Conversation

@leoparente

Copy link
Copy Markdown
Contributor

Summary

v2 of the netprobe HTTP/DoH probes (#792 follow-up): benchmark parity with cloudprober's HTTP probe and a superset of the OTel httpcheckreceiver's feature set.

New capabilities (http test type unless noted):

  • Success criteriaexpected_status / failure_status (exact codes, Nxx classes, A-B ranges; failure list evaluated first, cloudprober semantics) and response-body checks (expected_body substring AND expected_body_regex), with a new content_failures counter distinct from http_status_failures.
  • TLS cert expiry metrictls_cert_expiry_epoch_sec per target (unix timestamp of the chain's earliest notAfter, blackbox_exporter convention; http + doh) via CURLOPT_CERTINFO on the existing transfers. A probe-side cache stamps the last-known expiry onto every sample so the metric doesn't flap with keep-alive connection reuse (CERTINFO only populates on fresh handshakes).
  • Per-target request headers (e.g. Authorization) with strict redaction: header values, proxy value, and request body never appear in info_json, the taps API, logs, or error messages — only header names are surfaced.
  • Request body (body, POST/PUT/PATCH only) and response_size_bytes quantiles.
  • Proxy (proxy, http+doh) and TLS options (tls.verify / tls.ca_file / tls.cert_file+tls.key_file for mTLS).
  • Default User-Agent: pktvisor/<version> (overridable via headers).

Design notes

  • Check evaluation happens probe-side (config lives on the input); results travel in a single HttpSample POD so future fields don't churn the signal signatures.
  • Status/body grammar and cert-date parsing live in a new pure HttpCheck unit with direct tests; cert dates parse via curl_getdate() and file checks use std::filesystem (MSVC-portable — no POSIX-only APIs).
  • Security: because v2 introduces the first secret-bearing input config keys, the raw tap-config echo (GET /api/v1/taps, Policy::info_json) became a disclosure path — fixed via a new InputModulePlugin::redact_config_json() hook that Tap serialization invokes, backed by the same scrub used by the input's own info_json, with dump-and-grep tests proving no secret literal survives either path.
  • topn_count/topn_percentile_threshold apply to the netprobe TopN metrics; keep-alive comes free from the per-stream curl_multi connection pool (documented).

Out of scope (future)

json_path/size validations, OAuth token refresh, header validators, requests_per_probe, resolve_first, ip_version forcing, DoH EDNS/DNSSEC. A pre-existing scrape-time pattern (emit-vehicle counters mutated under a shared lock, same as v1 response_min_us/max_us) is noted for a separate cleanup.

Testing

  • unit-tests-visor-http-check (32) — status grammar, body checks, cert-date parsing (incl. leading-space CERTINFO format).
  • unit-tests-visor-http-client (51) — proxy-through-forward-proxy (absolute-form proof against a TEST-NET target), UA echo, response size, TLS option wiring, cert==0 on plain http, plus all v1 cases.
  • unit-tests-input-netprobe (148) — config grammar/scoping/consistency errors (secret-free messages), both redaction paths (module info_json + tap-shaped scrub), and e2e: per-target auth headers (both outcomes), expected_status 401-flip, failure_status precedence, body match/mismatch → content_failures, POST body echo.
  • unit-tests-handler-netprobe (100) — classification matrix, cert-expiry latest-wins/merge-max, response_size_bytes gating, merge coverage.

All suites pass locally (Release, 3× stable on the e2e suite).

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown

LCOV of commit 139232d during Debug Builds #209

  lines......: 84.2% (16368 of 19443 lines)
  functions..: 75.4% (1614 of 2142 functions)
  branches...: no data found

Files changed coverage rate: n/a

Full coverage report

@leoparente

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2a43a61c78

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/inputs/netprobe/HttpProbe.cpp Outdated
@leoparente

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f7b8d411da

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread libs/visor_http_client/HttpCheck.cpp Outdated
…ul wrap could accept them as an in-range code)
@leoparente

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e439a84aac

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/handlers/netprobe/NetProbeStreamHandler.cpp Outdated
@leoparente

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ce21bf9701

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/inputs/netprobe/NetProbeInputStream.cpp
@leoparente

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c0ec1b0f57

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/inputs/netprobe/HttpProbe.cpp
…ders (libcurl re-sends them cross-host, leaking secret headers)
@leoparente

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3c6976e4d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/inputs/netprobe/HttpProbe.cpp Outdated
…8 resends the payload to the redirect target)
@leoparente

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 139232db46

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@leoparente leoparente self-assigned this Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant