Sanitize PromptKit profile fingerprint errors

This commit is contained in:
2026-08-03 17:25:44 +00:00
parent 394278e1f2
commit 12ac25bd63
2 changed files with 30 additions and 2 deletions

View File

@@ -431,6 +431,34 @@ func TestPromptKitClientCheckpointFingerprintTracksProfileSource(t *testing.T) {
}
}
func TestPromptKitProfileFingerprintReadErrorsDoNotExposeSourcePaths(t *testing.T) {
for _, source := range []struct {
name string
profileDir string
profileFile string
}{
{
name: "file",
profileFile: filepath.Join(t.TempDir(), "missing-profile.yaml"),
},
{
name: "directory",
profileDir: filepath.Join(t.TempDir(), "missing-profiles"),
},
} {
t.Run(source.name, func(t *testing.T) {
_, err := promptKitProfileFingerprint(source.profileDir, source.profileFile, "")
if err == nil {
t.Fatal("promptKitProfileFingerprint() error = nil, want source read failure")
}
if (source.profileDir != "" && strings.Contains(err.Error(), source.profileDir)) ||
(source.profileFile != "" && strings.Contains(err.Error(), source.profileFile)) {
t.Fatalf("fingerprint error exposes profile source path: %q", err)
}
})
}
}
func TestPromptKitClientUsesFallbackProfilesForExecutionAndInspection(t *testing.T) {
assets := newTestPromptKitAssets(t)
const profileID = "fallback-profile"