Documentation
¶
Overview ¶
Vendored from bot-agent internal/agent/redact (Apache-2.0, see ../NOTICE). DD changes: encoding/json replaces bot-agent's protocol.Marshal; Values and Empty are added.
Package redact applies the contract's cmdline rule before a value is sent.
Vendored from bot-agent internal/agent/redact (Apache-2.0, see ../NOTICE).
Index ¶
Constants ¶
const ( // CmdlineMax is bot-agent's protocol.CmdlineMax (DD: kept local). CmdlineMax = 1024 // JournalLineMax is the per-line cap for program logs (v1.3). JournalLineMax = 2048 // JournalBytes is the total cap for one program log result. JournalBytes = 64 * 1024 )
Variables ¶
This section is empty.
Functions ¶
func Cmdline ¶
Cmdline replaces URL userinfo and secret assignments, then truncates to 1024 characters. Invalid UTF-8 is dropped so the frame stays valid JSON.
func Journal ¶
Journal redacts each line, caps each line at 2048 characters, and keeps the newest lines that fit in 64 KiB. truncated is set when a line or the total was cut. journalctl prints the oldest of the window first, so lines dropped from the front are the older ones.
func JournalTask ¶
JournalTask is Journal with this set applied to each line before the caps.
func SecretPreview ¶
SecretPreview is copied verbatim from bot-api-server/internal/catalog/preview.go. SecretPreview is the v1.13 preview of one secret value. Sixteen or more runes show the first four runes and an ellipsis (U+2026). Fewer runes show four bullets (U+2022). The value itself is never returned.
Types ¶
type Exact ¶
type Exact struct {
// contains filtered or unexported fields
}
Exact is the per-task set of secret values. It replaces each value of at least 6 bytes, plus its base64 and JSON-escaped forms, before the v1.0.1 regex. NewExact uses [REDACTED]. NewExactEnv uses the preview of the raw value. The set is not a secrecy boundary: a value can still be printed in some other encoding.
func Merge ¶
Merge joins sets. Forms are longest first. The same form keeps [REDACTED] when either set uses it; otherwise the earlier set wins.
func NewExact ¶
NewExact builds the set. Values shorter than 6 bytes are left out. The same bytes are also stored as standard and URL base64, padded and raw, and as a JSON string body with HTML escaping off and on. Every form is replaced with [REDACTED].
func NewExactEnv ¶
NewExactEnv is NewExact for env secret values. Every form of a value is replaced with SecretPreview of that raw value.
func (*Exact) Clear ¶
func (e *Exact) Clear()
Clear drops the set. Go strings cannot be overwritten in place; the caller also has to drop every other copy of the values.