Documentation
¶
Overview ¶
Package sessionlabel provides a framework-neutral trusted edge adapter for pseudonymising an application session before nginx writes access logs.
Index ¶
Constants ¶
const ( HeaderName = "X-Isutools-Session" ScenarioHeaderName = "X-Isutools-Scenario" TrustedSessionHeaderName = "X-Isutools-Trusted-Session" TrustedScenarioHeaderName = "X-Isutools-Trusted-Scenario" EnvGlobalMode = "ISUTOOLS" EnvFlowLabels = "ISUTOOLS_FLOW_LABELS" EnvSourceCookie = "ISUTOOLS_SESSION_COOKIE" EnvHMACKey = "ISUTOOLS_SESSION_HMAC_KEY" EnvScenario = "ISUTOOLS_SCENARIO" EnvTrustInbound = "ISUTOOLS_TRUST_INBOUND_FLOW_LABELS" MinKeyBytes = 32 LabelBytes = 18 MaxSourceBytes = 4096 MaxScenarioBytes = 64 MaxTrustedSessionBytes = 128 )
Variables ¶
This section is empty.
Functions ¶
func Scenario ¶ added in v1.6.0
Scenario returns framework-neutral middleware for assigning one explicit scenario to a route or route group.
func SetScenario ¶ added in v1.6.0
SetScenario assigns a bounded, non-secret scenario to the current request. It succeeds only when the request is inside Adapter.Middleware. Invalid labels clear any static fallback so a bad value cannot be misclassified.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter is immutable and safe for concurrent requests.
func New ¶
New validates the source cookie and HMAC key. Invalid configuration is a fail-closed adapter that strips spoofed labels but emits no replacement.
func (*Adapter) Middleware ¶
Middleware always removes an untrusted client label. When the configured source cookie is present, it writes only its pseudonym to the trusted upstream response header consumed by nginx.
func (*Adapter) WithObserver ¶ added in v1.6.0
WithObserver returns a shallow copy with one run-aligned flow sink.
type DetailedObserver ¶ added in v1.7.0
type DetailedObserver interface {
ObserveRequest(Observation)
}
DetailedObserver is optional so existing Observer implementations remain source compatible. Middleware calls exactly one of ObserveRequest/Observe.
type Health ¶
Health is bounded configuration state. It never includes a cookie, key, or raw environment value.
type Observation ¶ added in v1.7.0
type Observation struct {
Session string
Scenario string
Method string
Route string
Status int
Duration time.Duration
At time.Time
}
Observation is the richer, still secret-free flow event available to observers that want latency and status overlays. At is the request start; Session is already an HMAC pseudonym and Route is a registered template.