Skip to main content

Module safe_label

Module safe_label 

Source
Expand description

The allowlisted safe-label boundary for /preview-request (#1004).

Every free-form string that reaches a manifest surface — human table or JSON — crosses this module first. Nothing here is a “scrubber” that tries to find secrets in arbitrary text: a value either matches a narrow allowlist and is published verbatim, or it is replaced by a stable sha256:<12 hex> fingerprint. Two previews of the same route still compare equal, and nothing that was not on the allowlist is ever printed.

Why this exists at all: the obvious “identifier” fields are not safe by construction. A custom [providers.<name>] key is user-authored text, and a model id can be a filesystem path (/models/llama-3.gguf), a URL, a URL path, or a deployment id that is itself a credential. Bounding the shape of what may be printed is the only way to keep those out of a manifest a user will paste into an issue tracker.

Error strings get the same treatment through safe_error_text, which is path- and URL-path-safe: an MCP or request-preparation failure often carries an absolute workspace path or an endpoint URL, and neither may reach the transcript.

Structs§

SafeLabel
A string that is safe to publish on a manifest surface.

Functions§

safe_error_text
Bound an error string so it can be shown in the transcript.
safe_receipt_field
sanitize_persisted_route_label