middleware

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RedactedValue = "***REDACTED***"
)

Variables

This section is empty.

Functions

func OTelMiddleware

func OTelMiddleware(handler http.Handler) http.Handler

OTelMiddleware extracts W3C trace context and enriches logger context

Flow: 1. otelhttp.NewHandler creates/continues span from W3C headers 2. enrichedHandler extracts trace_id/span_id from span context 3. Adds trace identifiers to logger context for log correlation

Satisfies HyperFleet Logging Specification: "Components must extract trace context from W3C headers"

func SchemaValidationMiddleware

func SchemaValidationMiddleware(validator *validators.SchemaValidator) func(http.Handler) http.Handler

SchemaValidationMiddleware validates cluster and nodepool spec fields against OpenAPI schemas

Types

type MaskingMiddleware

type MaskingMiddleware struct {
	// contains filtered or unexported fields
}

MaskingMiddleware handles sensitive data masking for logging Masks sensitive HTTP headers and JSON body fields to prevent PII/secrets leakage

func NewMaskingMiddleware

func NewMaskingMiddleware(cfg *config.LoggingConfig) *MaskingMiddleware

NewMaskingMiddleware creates a new masking middleware from logging config

func (*MaskingMiddleware) MaskBody

func (m *MaskingMiddleware) MaskBody(body []byte) []byte

MaskBody masks sensitive fields in JSON body Handles both top-level objects and top-level arrays If masking is disabled, returns original body unchanged If masking is enabled but JSON parsing fails, applies text-based fallback masking

func (*MaskingMiddleware) MaskHeaders

func (m *MaskingMiddleware) MaskHeaders(headers http.Header) http.Header

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL