security

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package security provides helpers for handling sensitive fields and data safety.

It is primarily used by logging and telemetry packages to detect and obfuscate secrets before data leaves process boundaries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultSensitiveFields

func DefaultSensitiveFields() []string

DefaultSensitiveFields returns a copy of the default sensitive field names. The returned slice is a clone — callers cannot mutate shared state.

func DefaultSensitiveFieldsMap

func DefaultSensitiveFieldsMap() map[string]bool

DefaultSensitiveFieldsMap provides a map version of DefaultSensitiveFields for lookup operations. All field names are lowercase for case-insensitive matching. The underlying cache is initialized only once; each call returns a shallow clone so callers cannot mutate shared state.

func IsSensitiveField

func IsSensitiveField(fieldName string) bool

IsSensitiveField checks if a field name is considered sensitive based on the default sensitive fields list. The check is case-insensitive and handles camelCase field names by normalizing them to underscore-delimited tokens. Short tokens (like "key", "auth") use exact token matching to avoid false positives, while longer patterns use word-boundary matching.

Types

This section is empty.

Jump to

Keyboard shortcuts

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