Fix security, we check for broken API calls.
This commit is contained in:
@@ -46,6 +46,11 @@ const useAuthStore = create((set) => ({
|
||||
// Hit the new lightweight endpoint
|
||||
const res = await api.get('session/');
|
||||
|
||||
// 🔨 Security Fix a broken API call, Verify we actually got a user object back, not HTML fallback text
|
||||
if (typeof res.data === 'string' || !res.data.username) {
|
||||
throw new Error("Received invalid data format instead of user session");
|
||||
}
|
||||
|
||||
// Rehydrate the store with the user's info!
|
||||
set({
|
||||
isAuthenticated: true,
|
||||
|
||||
Reference in New Issue
Block a user