fix: explicitly clear storage for new account logins to prevent session leakage
This commit is contained in:
@@ -528,6 +528,12 @@ ipcMain.handle('open-steam-login', async (event, expectedSteamId: string) => {
|
|||||||
const partitionId = expectedSteamId ? `persist:steam-login-${expectedSteamId}` : 'persist:steam-login-new';
|
const partitionId = expectedSteamId ? `persist:steam-login-${expectedSteamId}` : 'persist:steam-login-new';
|
||||||
const loginSession = session.fromPartition(partitionId);
|
const loginSession = session.fromPartition(partitionId);
|
||||||
|
|
||||||
|
// If adding a brand new account, explicitly clear previous trash
|
||||||
|
if (!expectedSteamId) {
|
||||||
|
console.log('[Auth] Clearing session for new account login...');
|
||||||
|
await loginSession.clearStorageData({ storages: ['cookies', 'localstorage', 'indexdb'] });
|
||||||
|
}
|
||||||
|
|
||||||
// If we have an existing cookie string for this account, pre-inject it
|
// If we have an existing cookie string for this account, pre-inject it
|
||||||
if (expectedSteamId) {
|
if (expectedSteamId) {
|
||||||
const accounts = store.get('accounts') as Account[];
|
const accounts = store.get('accounts') as Account[];
|
||||||
|
|||||||
Reference in New Issue
Block a user