dograh/api/services/configuration
developer603 ecb331a53c fix: detect masked short secrets in contains_masked_key
contains_masked_key() guards against persisting a still-masked secret by
checking for the MASK_MARKER ("***") substring. But mask_key() only emits
3+ consecutive asterisks for keys longer than VISIBLE_CHARS + 2. For short
secrets it emits fewer: e.g. mask_key("EMPTY") == "*MPTY" (a single
asterisk). Such masked values slip past the guard, so a dashboard
"save without editing" round-trips the masked display string back and
overwrites the real stored value with e.g. "*MPTY".

This bites self-hosted/OpenAI-compatible providers that use a short
no-validate sentinel api_key such as "EMPTY".

Match the full shape mask_key() produces — a run of MASK_CHAR followed by
at most VISIBLE_CHARS revealed characters — in addition to the legacy
marker. Verified: masked short secrets ("*MPTY", "*", "*ykey") are now
detected while real unmasked values ("EMPTY", "sk-live-abcd", ...) are
not, so there are no false positives.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 16:54:41 +05:30
..
options Add Sarvam LLM, update Sarvam STT models, expose usage_info on run detail (#351) 2026-06-01 10:29:31 +05:30
__init__.py Initial Commit 🚀 🚀 2025-09-09 14:37:32 +05:30
check_validity.py feat: allow overriding base URL of OpenAI models (#368) 2026-05-27 13:07:45 +05:30
defaults.py feat: knowledge base functionality for the voice agent (#120) 2026-01-17 14:37:03 +05:30
masking.py fix: detect masked short secrets in contains_masked_key 2026-06-01 16:54:41 +05:30
merge.py feat: stamp API key into model override at save time to survive global provider change (#362) 2026-05-27 14:01:14 +05:30
registry.py Add Sarvam LLM, update Sarvam STT models, expose usage_info on run detail (#351) 2026-06-01 10:29:31 +05:30
resolve.py feat: stamp API key into model override at save time to survive global provider change (#362) 2026-05-27 14:01:14 +05:30