Documentation
¶
Overview ¶
Package freetext provides bounded, token-redacting hygiene for untrusted text.
Index ¶
Constants ¶
const FreeTextBound = 1024
FreeTextBound is the byte bound on any single free-text field. The concrete value is the operations spec's (§ 20 audit ops / row 20: free text 1 KiB), applied under the threat model's bounded-payload baseline.
const RedactionMarker = "[REDACTED:hikyo-token]"
RedactionMarker replaces any substring matching the hikyo token grammar.
Variables ¶
This section is empty.
Functions ¶
func RedactTokens ¶
RedactTokens replaces every token-grammar match in s with the redaction marker. What this cannot catch is stated in the ADR: an arbitrary secret value in free text has no recognizable grammar; the bound and the schema-typed fields limit the blast.
func SanitizeFreeText ¶
SanitizeFreeText applies the full free-text hygiene: strip invalid UTF-8 and control characters, truncate to the bound (on a rune boundary), and redact token-grammar matches. Emitters call this once at capture; the write boundary re-checks with checkSanitized and refuses rather than silently re-cleaning.
Types ¶
This section is empty.