logd_dio 0.1.2
logd_dio: ^0.1.2 copied to clipboard
Seamless Dio HTTP logging interceptor for logd with cURL generation, security redaction, and ambient distributed tracing.
Changelog #
0.1.2 #
- Security & Command Injection Fix (
LogdCurlGenerator):- Posix shell escape single quotes (
'\'') in generated cURL targets and headers. - Strip control characters and newlines (
\r\n) from header keys, header values, and target URIs to prevent terminal command execution breakouts when pasting generated commands. - Validate and fallback HTTP method names against shell breakout characters.
- Posix shell escape single quotes (
- URI Query Parameter Redaction:
- Added
LogdSanitizer.sanitizeUrito automatically sanitize sensitive query parameters (e.g.,token,api_key,secret,password) in logged request/response messages and generated cURL command URLs.
- Added
- Payload & Body Key Redaction:
- Added
sensitiveBodyKeystoLogdDioOptions(with default redaction for passwords, tokens, API keys, secrets, credit cards, CVVs, SSNs). - Added
LogdSanitizer.sanitizeBodyfor recursive redaction across nested maps, lists, and raw JSON strings. - Integrated body redaction into
LogdSanitizer.safeBodyPreview,LogdCurlGenerator.generate, and request/response/error logging.
- Added
- Dependency Alignment: Updated minimum
logddependency constraint to^0.10.2.
0.1.1 #
- Dependency Constraints: Raised minimum
diodependency constraint to^5.2.0for compatibility withDioExceptionandDioExceptionType.
0.1.0: Initial Release #
LogdDioInterceptor: First-class HTTP request and response logging interceptor for Dio.- Monotonic Latency Timing: Uses monotonic
Stopwatchtimers for accurate, clock-skew-immune latency tracking. - Security & Compliance Redaction: Automatically redacts sensitive headers (
Authorization,Cookie,x-api-key, etc.) and query parameters (token,password,secret). - cURL Command Generation: Generates copy-pasteable, executable cURL strings with sanitized headers.
- Payload Safety: Safely handles and previews
FormData, binary streams, and truncates large payloads to prevent out-of-memory errors. - Ambient Context / MDC Propagation: Automatically injects ambient
LogContext.current['requestId']into outgoingx-request-idheaders with case-insensitive collision protection. - Cancellation Awareness: Gracefully logs
DioExceptionType.cancelas non-failure events at configurable log levels. - Showcase Gallery & Modular Examples:
example/showcase_gallery.dart: Interactive CLI runner to run demos individually (1-5) or sequentially (all).example/main.dart: Clean, minimal Dio integration.example/security/sanitization_example.dart: Custom header/query redaction, custom replacement tokens, and binary/FormData safety.example/tracing/distributed_tracing_example.dart: Ambient context forwarding and concurrent async zone isolation.example/resilience/error_and_cancellation_example.dart: User cancellations vs 4xx/5xx server diagnostics.example/advanced/custom_pipeline_example.dart: cURL output, response headers inspection, and custom logger pipelines.