Skip to content

Commit b85ff8a

Browse files
committed
fix: never persist API keys in browser storage — require re-entry on refresh
1 parent 3794b47 commit b85ff8a

File tree

1 file changed

+3
-28
lines changed

1 file changed

+3
-28
lines changed

web/static/js/chat.js

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,7 @@ class EurusChat {
6262
this.apiKeysPanel.style.display = 'none';
6363
this.keysConfigured = true;
6464
} else {
65-
// No server keys — check localStorage for saved keys
66-
const savedOpenai = localStorage.getItem('eurus-openai-key');
67-
const savedArraylake = localStorage.getItem('eurus-arraylake-key');
68-
if (savedOpenai) {
69-
this.openaiKeyInput.value = savedOpenai;
70-
}
71-
if (savedArraylake) {
72-
this.arraylakeKeyInput.value = savedArraylake;
73-
}
65+
// No server keys — show panel, user must enter keys each session
7466
this.apiKeysPanel.style.display = 'block';
7567
this.keysConfigured = false;
7668
}
@@ -103,13 +95,7 @@ class EurusChat {
10395
return;
10496
}
10597

106-
// Save to localStorage (client-side only)
107-
localStorage.setItem('eurus-openai-key', openaiKey);
108-
if (arraylakeKey) {
109-
localStorage.setItem('eurus-arraylake-key', arraylakeKey);
110-
}
111-
112-
// Send keys via WebSocket
98+
// Send keys via WebSocket (never saved to storage)
11399
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
114100
this.saveKeysBtn.disabled = true;
115101
this.saveKeysBtn.textContent = 'Connecting...';
@@ -162,18 +148,7 @@ class EurusChat {
162148
this.reconnectAttempts = 0;
163149
this.updateConnectionStatus('connected');
164150

165-
// If server has no keys, auto-send saved keys from localStorage
166-
if (!this.serverKeysPresent.openai) {
167-
const savedOpenai = localStorage.getItem('eurus-openai-key');
168-
if (savedOpenai) {
169-
const savedArraylake = localStorage.getItem('eurus-arraylake-key') || '';
170-
this.ws.send(JSON.stringify({
171-
type: 'configure_keys',
172-
openai_api_key: savedOpenai,
173-
arraylake_api_key: savedArraylake,
174-
}));
175-
}
176-
} else {
151+
if (this.serverKeysPresent.openai) {
177152
this.sendBtn.disabled = false;
178153
}
179154
};

0 commit comments

Comments
 (0)