MCPcopy Create free account
hub / github.com/codehamr/codehamr / TestResolvedKeyLiteralDollarSurvives

Function TestResolvedKeyLiteralDollarSurvives

internal/config/config_test.go:702–716  ·  view source on GitHub ↗

TestResolvedKeyLiteralDollarSurvives: expansion applies ONLY when the whole key is a ${VAR} reference. A literal proxy key containing '$' (llama.cpp --api-key, LiteLLM master keys) must pass through byte-identical: os.ExpandEnv would silently corrupt it ("pa$$word" -> "paword") and every request 401

(t *testing.T)

Source from the content-addressed store, hash-verified

700// os.ExpandEnv would silently corrupt it ("pa$$word" -> "paword") and every
701// request 401s with nothing anywhere hinting the key was rewritten.
702func TestResolvedKeyLiteralDollarSurvives(t *testing.T) {
703 for _, key := range []string{
704 "pa$$word123",
705 "sk-abc$def",
706 "trailing$",
707 "$UPFRONT-rest",
708 "${not-a-valid-name}", // ${...} but not an env-var name: literal
709 "prefix-${REAL_VAR}", // reference not the whole key: literal
710 } {
711 p := &Profile{Key: key}
712 if got := p.ResolvedKey(); got != key {
713 t.Errorf("ResolvedKey(%q) = %q, want the literal back", key, got)
714 }
715 }
716}
717
718// TestURLOverrideDoesNotPersist: a CODEHAMR_URL override lives in
719// cfg.URLOverride and ActiveURL reflects it, but Save writes only the stored

Callers

nothing calls this directly

Calls 1

ResolvedKeyMethod · 0.95

Tested by

no test coverage detected