Skip to main content

Module redact

Module redact 

Source
Expand description

Redact secret settings keys from the full-config JSON before it is sent to any renderer/frontend connection.

Found in PR #2751 review: voice:groqApiKey’s own doc comment claims “Read server-side only, never sent to the renderer,” but get_full_config()’s outbound JSON (the initial config event, the getfullconfig RPC, and the post-setconfig broadcast — all three call sites in server/websocket.rs) was never actually filtered, so the real plaintext key has always reached every renderer connection’s JS memory. PR #2751 introduced a masked-dot Settings UI for this key (MaskedKeyField) that visually implies the opposite. This module makes the doc comment’s claim actually true.

The renderer’s UI only needs to know a value IS set, never what it is, so redaction replaces the real value with a fixed non-empty placeholder (distinguishable from “unset”) rather than merely blanking it. The write path (setconfig → merge_settings_to_disk/merge_settings_into_current) is untouched — this only filters the server → renderer read direction.

Functions§

redact_full_config_for_renderer
Redact known-secret keys in-place on an already-serialized full-config JSON value. Call this on every path that sends config to a renderer; never on the in-memory ConfigState state or the on-disk file.