freetext

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package freetext provides bounded, token-redacting hygiene for untrusted text.

Index

Constants

View Source
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.

View Source
const RedactionMarker = "[REDACTED:hikyo-token]"

RedactionMarker replaces any substring matching the hikyo token grammar.

Variables

This section is empty.

Functions

func RedactTokens

func RedactTokens(s string) string

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

func SanitizeFreeText(s string) string

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.

Jump to

Keyboard shortcuts

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