Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Fix API key exposure in toast notifications, resolves #1477 (#1480)

amodev62e4fb47b21a
diff --git a/frontend/src/components/modals/settings/SettingsModal.tsx b/frontend/src/components/modals/settings/SettingsModal.tsx
index d3e636c142..cf815a7f05 100644
--- a/frontend/src/components/modals/settings/SettingsModal.tsx
+++ b/frontend/src/components/modals/settings/SettingsModal.tsx
@@ -76,8 +76,14 @@ function SettingsModal({ isOpen, onOpenChange }: SettingsProps) {
i18next.changeLanguage(settings.LANGUAGE);
initializeAgent(settings); // reinitialize the agent with the new settings
+ const sensitiveKeys = ['LLM_API_KEY'];
+
Object.entries(updatedSettings).forEach(([key, value]) => {
- toast.settingsChanged(`${key} set to "${value}"`);
+ if (!sensitiveKeys.includes(key)) {
+ toast.settingsChanged(`${key} set to "${value}"`);
+ } else {
+ toast.settingsChanged(`${key} has been updated securely.`);
+ }
});
localStorage.setItem(