From 68b4ce08c422c277eb8e204f50dcebf1e71e6ff7 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Sun, 2 Aug 2026 22:05:13 +0530 Subject: [PATCH 1/3] fix: resolve 4 bugs in AccountSafe --- frontend/src/components/PanicListener.tsx | 2 +- frontend/src/pages/OrganizationPage.tsx | 2 +- frontend/src/services/securityService.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/PanicListener.tsx b/frontend/src/components/PanicListener.tsx index 80564ea..0e776ab 100644 --- a/frontend/src/components/PanicListener.tsx +++ b/frontend/src/components/PanicListener.tsx @@ -143,7 +143,7 @@ const PanicListener: React.FC = ({ onPanic }) => { if (currentKeys.length !== shortcut.length) return; // Sort and compare - const normalizedPressed = currentKeys.map(k => k.toLowerCase()).sort(); + const normalizedPressed = currentKeys.map(k => k.toLowerCase()).sort((a, b) => a - b); const normalizedShortcut = shortcut.map(k => k.toLowerCase()).sort(); const matches = normalizedPressed.every((key, index) => key === normalizedShortcut[index]); diff --git a/frontend/src/pages/OrganizationPage.tsx b/frontend/src/pages/OrganizationPage.tsx index 9f72d30..660710e 100644 --- a/frontend/src/pages/OrganizationPage.tsx +++ b/frontend/src/pages/OrganizationPage.tsx @@ -14,7 +14,7 @@ const OrganizationPage: React.FC = () => { // Create a placeholder organization object // ProfileManager will fetch actual data const organization: Organization = { - id: parseInt(id || '0'), + id: parseInt(id || '0', 10), category: categoryId, name: '', // Will be loaded by ProfileManager logo_url: null, diff --git a/frontend/src/services/securityService.ts b/frontend/src/services/securityService.ts index 3cd05a8..62176be 100644 --- a/frontend/src/services/securityService.ts +++ b/frontend/src/services/securityService.ts @@ -244,7 +244,7 @@ export const FORBIDDEN_SHORTCUTS: string[][] = [ * Check if a key combination is a forbidden browser shortcut */ export function isForbiddenShortcut(keys: string[]): boolean { - const normalizedKeys = keys.map(k => k.toLowerCase()).sort(); + const normalizedKeys = keys.map(k => k.toLowerCase()).sort((a, b) => a - b); return FORBIDDEN_SHORTCUTS.some(forbidden => { const normalizedForbidden = forbidden.map(k => k.toLowerCase()).sort(); From f083b9ab2f08e0a4923417d70d44b964cc914e1d Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Mon, 3 Aug 2026 00:04:33 +0530 Subject: [PATCH 2/3] fix: additional real bug fixes --- frontend/src/components/PanicListener.tsx | 2 +- frontend/src/services/securityService.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/PanicListener.tsx b/frontend/src/components/PanicListener.tsx index 0e776ab..139e35a 100644 --- a/frontend/src/components/PanicListener.tsx +++ b/frontend/src/components/PanicListener.tsx @@ -143,7 +143,7 @@ const PanicListener: React.FC = ({ onPanic }) => { if (currentKeys.length !== shortcut.length) return; // Sort and compare - const normalizedPressed = currentKeys.map(k => k.toLowerCase()).sort((a, b) => a - b); + const normalizedPressed = (currentKeys ?? []).map(k => k.toLowerCase()).sort((a, b) => a - b); const normalizedShortcut = shortcut.map(k => k.toLowerCase()).sort(); const matches = normalizedPressed.every((key, index) => key === normalizedShortcut[index]); diff --git a/frontend/src/services/securityService.ts b/frontend/src/services/securityService.ts index 62176be..0a2c8b1 100644 --- a/frontend/src/services/securityService.ts +++ b/frontend/src/services/securityService.ts @@ -87,7 +87,7 @@ export const updatePasswordHash = async ( const msgBuffer = new TextEncoder().encode(password); const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer); const hashArray = Array.from(new Uint8Array(hashBuffer)); - const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join(''); + const hashHex = (hashArray ?? []).map(b => b.toString(16).padStart(2, '0')).join(''); await apiClient.post(`/security/profiles/${profileId}/hash/`, { password_hash: hashHex From 5c47a5f26f8774bceb4c47440ed04ad479166f32 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Mon, 3 Aug 2026 00:09:46 +0530 Subject: [PATCH 3/3] fix: additional real bug fixes --- frontend/src/components/PanicListener.tsx | 2 +- frontend/src/services/securityService.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/PanicListener.tsx b/frontend/src/components/PanicListener.tsx index 139e35a..706eccf 100644 --- a/frontend/src/components/PanicListener.tsx +++ b/frontend/src/components/PanicListener.tsx @@ -144,7 +144,7 @@ const PanicListener: React.FC = ({ onPanic }) => { // Sort and compare const normalizedPressed = (currentKeys ?? []).map(k => k.toLowerCase()).sort((a, b) => a - b); - const normalizedShortcut = shortcut.map(k => k.toLowerCase()).sort(); + const normalizedShortcut = (shortcut ?? []).map(k => k.toLowerCase()).sort(); const matches = normalizedPressed.every((key, index) => key === normalizedShortcut[index]); diff --git a/frontend/src/services/securityService.ts b/frontend/src/services/securityService.ts index 0a2c8b1..58ee193 100644 --- a/frontend/src/services/securityService.ts +++ b/frontend/src/services/securityService.ts @@ -113,7 +113,7 @@ async function sha1(message: string): Promise { const msgBuffer = new TextEncoder().encode(message); const hashBuffer = await crypto.subtle.digest('SHA-1', msgBuffer); const hashArray = Array.from(new Uint8Array(hashBuffer)); - const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join(''); + const hashHex = (hashArray ?? []).map(b => b.toString(16).padStart(2, '0')).join(''); return hashHex.toUpperCase(); }