Description
Two small privacy / UX issues on error paths:
-
PII scan fallback fail-OPEN via window.confirm — if scanPii throws, ConversationContext.tsx:326-336 pops a native window.confirm("...Send anyway?"). For a privacy-forward HR product, the right default is to fail closed (reject send) with an in-app error, not delegate the decision to a native blocking dialog.
-
Raw upstream API errors surfaced to UI — chat.rs:221,311 formats errors as format!("HTTP {}: {}", status, parsed) which can echo provider error messages containing partial API key substrings (sk-ant-..., AIzaSy...). Low-probability key leak to UI / logs / support emails.
Current State
src/contexts/ConversationContext.tsx:326-336 — window.confirm on PII scan failure
src-tauri/src/chat.rs:221,311 + providers' parse_error_response — passthrough of raw API error body
Suggested Fix
Verification
Automation Hints
scope: src/contexts/ConversationContext.tsx, src-tauri/src/chat.rs, src-tauri/src/providers/*.rs
do-not-touch: pii.rs
approach: add-declarations
risk: low
max-files-changed: 5
blocked-by: none
bail-if: none
Priority
Medium — two small but real privacy / UX issues.
Description
Two small privacy / UX issues on error paths:
PII scan fallback fail-OPEN via
window.confirm— ifscanPiithrows,ConversationContext.tsx:326-336pops a nativewindow.confirm("...Send anyway?"). For a privacy-forward HR product, the right default is to fail closed (reject send) with an in-app error, not delegate the decision to a native blocking dialog.Raw upstream API errors surfaced to UI —
chat.rs:221,311formats errors asformat!("HTTP {}: {}", status, parsed)which can echo provider error messages containing partial API key substrings (sk-ant-...,AIzaSy...). Low-probability key leak to UI / logs / support emails.Current State
src/contexts/ConversationContext.tsx:326-336— window.confirm on PII scan failuresrc-tauri/src/chat.rs:221,311+ providers'parse_error_response— passthrough of raw API error bodySuggested Fix
window.confirmwith an in-app error state + retry button. Fail closed by default.sk-[A-Za-z0-9_-]{10,}orAIzaSy[A-Za-z0-9_-]{20,}or other known key prefixes, replace with[API_KEY_REDACTED].sk-ant-abc123...→ UI-facing string has[API_KEY_REDACTED].Verification
cargo test+npm run type-checkpassAutomation Hints
scope: src/contexts/ConversationContext.tsx, src-tauri/src/chat.rs, src-tauri/src/providers/*.rs
do-not-touch: pii.rs
approach: add-declarations
risk: low
max-files-changed: 5
blocked-by: none
bail-if: none
Priority
Medium — two small but real privacy / UX issues.