mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 14:11:13 -05:00
Fix MFA bypass vulnerability
This commit is contained in:
@@ -43,6 +43,7 @@ export function useRequireMFA() {
|
|||||||
isEnrolled,
|
isEnrolled,
|
||||||
needsEnrollment: requiresMFA && !isEnrolled,
|
needsEnrollment: requiresMFA && !isEnrolled,
|
||||||
needsVerification,
|
needsVerification,
|
||||||
|
isBlocked: requiresMFA && (!isEnrolled || (isEnrolled && aal === 'aal1')), // Convenience flag
|
||||||
aal,
|
aal,
|
||||||
loading: loading || roleLoading,
|
loading: loading || roleLoading,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export default function AdminDashboard() {
|
|||||||
useDocumentTitle('Dashboard - Admin');
|
useDocumentTitle('Dashboard - Admin');
|
||||||
const { user, loading: authLoading } = useAuth();
|
const { user, loading: authLoading } = useAuth();
|
||||||
const { isModerator, loading: roleLoading } = useUserRole();
|
const { isModerator, loading: roleLoading } = useUserRole();
|
||||||
const { needsEnrollment, loading: mfaLoading } = useRequireMFA();
|
const { needsEnrollment, needsVerification, loading: mfaLoading } = useRequireMFA();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [isRefreshing, setIsRefreshing] = useState(false);
|
const [isRefreshing, setIsRefreshing] = useState(false);
|
||||||
const [activeTab, setActiveTab] = useState('moderation');
|
const [activeTab, setActiveTab] = useState('moderation');
|
||||||
@@ -138,8 +138,8 @@ export default function AdminDashboard() {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MFA enforcement
|
// MFA enforcement - CRITICAL: Block if EITHER not enrolled OR needs verification
|
||||||
if (needsEnrollment) {
|
if (needsEnrollment || needsVerification) {
|
||||||
return (
|
return (
|
||||||
<AdminLayout>
|
<AdminLayout>
|
||||||
<MFARequiredAlert />
|
<MFARequiredAlert />
|
||||||
|
|||||||
Reference in New Issue
Block a user