Skip to content

Commit c5561f6

Browse files
Tom Maloneyclaude
andcommitted
fix: Clear credentials in all YNAB budget selection error paths
Address security review comment by ensuring temp_backend.clear_auth() and creds.clear() are called when user cancels budget selection or when an exception occurs. Also use generic error message to avoid potentially logging sensitive information. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 5d8f499 commit c5561f6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

moneyflow/app.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,8 @@ async def _handle_add_new_account(self, account_manager: AccountManager):
623623

624624
if budget_id is None:
625625
# User cancelled budget selection - clean up
626+
temp_backend.clear_auth()
627+
creds.clear()
626628
account_manager.delete_account(account.id)
627629
return None
628630
elif len(budgets) == 1:
@@ -642,10 +644,12 @@ async def _handle_add_new_account(self, account_manager: AccountManager):
642644
break
643645
account_manager.save_registry(registry)
644646

645-
except Exception as e:
647+
except Exception:
646648
logger = get_logger(__name__)
647-
logger.error(f"Failed to fetch YNAB budgets: {e}")
648-
# Clean up the account if budget selection fails
649+
logger.error("Failed to fetch YNAB budgets during account setup")
650+
# Clean up credentials and account if budget selection fails
651+
temp_backend.clear_auth()
652+
creds.clear()
649653
account_manager.delete_account(account.id)
650654
return None
651655
else:

0 commit comments

Comments
 (0)