Skip to content

Axum: add safe production diagnostics and trusted-proxy handling #397

Description

@ChristianPavilonis

Description

Main native service can render internal error strings (crates/edgezero-adapter-axum/src/service.rs:194) and lacks a checked incoming-proxy production policy. PR #275 owns safe public error/response completion; PR #409 adds checked proxy metadata and native diagnostics on the #406/#407 stack. This is runtime integration with existing observability work.

Steps to reproduce

Inject fictional sentinel secrets into conversion/router/upstream errors and inspect public responses and ordinary logs. Send Forwarded/X-Forwarded-* from trusted and untrusted peers, including malformed chains; exercise post-header stream failures, rejections and draining.

Expected behavior

Only checked production metadata affects host/scheme/client facts. Correlated, privacy-safe request/terminal/lifecycle records use established completion boundaries; custom app logging ownership is respected.

Impact

Unchecked forwarding input can spoof metadata, while raw internal failures can leak application/provider details. New logging must not expose bodies, secrets or sensitive query values.

Proposed fix

Review/integrate #409 on accepted #275 error/completion contracts, coordinating #392/#393 state. Reuse one bounded forwarding parser/default-no-trust boundary and exactly-once observer path. Keep metrics/tracing vendor work and application authorization separate. Optional #389 timing must fit the established monotonic origin and lifecycle rather than add competing finalization.

Done when

  • Re-audit the accepted PR feat: implement portable outbound HTTP and request lifecycle contracts #275 implementation and record which checks are already covered. Add only residual changes and missing production acceptance evidence.
  • A sentinel secret in conversion, router, or upstream errors never appears in the client response or ordinary request logs; internal diagnostics retain only explicitly permitted detail.
  • Request completion and failure records correlate status, duration, and request identity, including stream failures after headers are sent.
  • Custom logging ownership does not install a competing logger/subscriber.
  • Spoofed Forwarded/X-Forwarded-* headers from untrusted peers cannot change effective production metadata; accepted trusted-proxy cases still work.
  • Tests cover trusted proxy matching, header precedence, malformed forwarding values, and direct-peer fallback.
  • Operators have a documented way to observe active work, rejections, and shutdown, using the existing observability contracts.
  • No secret values or body payloads become metric labels or diagnostic fields.

Related

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions