File tree Expand file tree Collapse file tree
extensions/services/dashboard-api/tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5454 },
5555 "TARGET_API_KEY" : {
5656 "type" : " string" ,
57- "description" : " API key for Privacy Shield upstream target (set to LITELLM_KEY in lemonade mode)"
57+ "description" : " API key for Privacy Shield upstream target (set to LITELLM_KEY in lemonade mode)" ,
58+ "secret" : true
5859 },
5960 "ANTHROPIC_API_KEY" : {
6061 "type" : " string" ,
61- "description" : " Anthropic API key (cloud/hybrid modes)"
62+ "description" : " Anthropic API key (cloud/hybrid modes)" ,
63+ "secret" : true
6264 },
6365 "OPENAI_API_KEY" : {
6466 "type" : " string" ,
65- "description" : " OpenAI API key (cloud/hybrid modes)"
67+ "description" : " OpenAI API key (cloud/hybrid modes)" ,
68+ "secret" : true
6669 },
6770 "TOGETHER_API_KEY" : {
6871 "type" : " string" ,
69- "description" : " Together AI API key (optional)"
72+ "description" : " Together AI API key (optional)" ,
73+ "secret" : true
7074 },
7175 "WEBUI_SECRET" : {
7276 "type" : " string" ,
407411 },
408412 "LIVEKIT_API_KEY" : {
409413 "type" : " string" ,
410- "description" : " LiveKit API key"
414+ "description" : " LiveKit API key" ,
415+ "secret" : true
411416 },
412417 "LIVEKIT_API_SECRET" : {
413418 "type" : " string" ,
Original file line number Diff line number Diff line change @@ -309,3 +309,32 @@ def test_render_env_preserves_extras_with_empty_values():
309309 rendered = _render_env_from_values (values )
310310 assert "TENSOR_SPLIT=" in rendered
311311 assert "GPU_UUID=GPU-abc123" in rendered
312+
313+
314+ # --- Production schema secret-flag coverage ---
315+
316+
317+ @pytest .mark .parametrize (
318+ "key" ,
319+ [
320+ "TARGET_API_KEY" ,
321+ "ANTHROPIC_API_KEY" ,
322+ "OPENAI_API_KEY" ,
323+ "TOGETHER_API_KEY" ,
324+ "LIVEKIT_API_KEY" ,
325+ ],
326+ )
327+ def test_production_schema_marks_provider_api_keys_secret (key ):
328+ """Credential API keys in the production schema must carry ``secret: true``.
329+
330+ Regression guard: without the explicit flag, masking in both
331+ ``dream config show`` and ``GET /api/settings/env`` falls back to a
332+ name-pattern match. The schema should be the authoritative source.
333+ """
334+ import pathlib
335+
336+ schema_path = pathlib .Path (__file__ ).resolve ().parents [4 ] / ".env.schema.json"
337+ schema = json .loads (schema_path .read_text (encoding = "utf-8" ))
338+ entry = schema ["properties" ].get (key )
339+ assert entry is not None , f"schema missing entry for { key } "
340+ assert entry .get ("secret" ) is True , f"{ key } must have 'secret': true in .env.schema.json"
You can’t perform that action at this time.
0 commit comments