T09 · Insecure Skill Coding Practices
- Location
MirrorRoom-3.8.jsx:384- Finding
Anthropic API Keys Persisted in Plaintext Browser Storage
- Content
View full analysis
loadJSON("mr_api_profiles", []) ); useEffect(() => { try { localStorage.setItem( "mr_api_profiles", JSON.stringify(apiProfiles) ); } catch {} }, [apiProfiles]); const saveProfile = () => { const name = newProfName.trim(); const key = newProfKey.trim(); if (!name || !key) { setErr("Profile name and API key required."); return; } const prof = { id: uid(), name, provider: "anthropic", apiKey: key }; setApiProfiles((prev) => [...prev, prof]); setNewProfName(""); setNewProfKey(""); setErr(null); if (chatProfileId === "host") setChatProfileId(prof.id); if (evalProfileId === "host") setEvalProfileId(prof.id); }; ``` ### Technical Analysis The application stores complete Anthropic API keys in `localStorage` as part of the serialized `mr_api_profiles` value. Browser local storage is persistent, unencrypted, and available to any JavaScript executing under the same origin. The interface masks keys when displaying them, but this is only a presentation control. The complete credential remains available through `localStorage.getItem("mr_api_profiles")`. This exceeds the minimum privilege necessary for ordinary chat operation because an API key only needs to remain available while making an authorized request. Persistent storage is optional convenience rather than a functional requirement. There is no evidence that the application intentionally sends API keys to an undeclared endpoint. Keys are attached as `x-api-key` only when directly contacting the official Anthropic endpoint. The vulnerability is the durability and accessibility of the stored secret. ### Attack Path 1. A user enters an Anthropic API key and saves a named profile. 2. ...[truncated 1174 chars]- Remediation
View remediation
