| 1 |
// Copyright The OpenTelemetry Authors |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
// Package configopaque implements a String type alias to mask sensitive information. |
| 5 |
// Use configopaque.String on the type of sensitive fields, to mask the |
| 6 |
// opaque string as `[REDACTED]`. |
| 7 |
// |
| 8 |
// This ensures that no sensitive information is leaked in logs or when printing the |
| 9 |
// full Collector configurations. |
| 10 |
// |
| 11 |
// The only way to view the value stored in a configopaque.String is to first convert |
| 12 |
// it to a string by casting with the builtin `string` function. |
| 13 |
// |
| 14 |
// To achieve this, configopaque.String implements standard library interfaces |
| 15 |
// like fmt.Stringer, encoding.TextMarshaler and others to ensure that the |
| 16 |
// underlying value is masked when printed or serialized. |
| 17 |
// |
| 18 |
// If new interfaces that would leak opaque values are added to the standard library |
| 19 |
// or become widely used in the Go ecosystem, these will eventually be implemented |
| 20 |
// by configopaque.String as well. This is not considered a breaking change. |
| 21 |
package configopaque // import "go.opentelemetry.io/collector/config/configopaque" |