feat(auth): harden session management and security
- Implement server-side session revocation on logout - Add IP extraction utility and admin setup error handling - Improve error codes and response consistency for auth endpoints - Refine landing page redirect logic to handle transient DB outages - Update deployment documentation and configuration defaults
This commit is contained in:
1 parent
935f12a1e9
commit
89e4d68690
81 files changed
+11530
-6916
No files matched your search
@@ -15,3 +15,36 @@ export function setCached<T>(key: string, value: T): T {
|
||||
memoryStore.set(key, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
export async function clearAuthCaches(): Promise<void> {
|
||||
memoryStore.clear();
|
||||
if (typeof window === 'undefined') return;
|
||||
try {
|
||||
if ('serviceWorker' in navigator && navigator.serviceWorker.controller) {
|
||||
navigator.serviceWorker.controller.postMessage({ type: 'CLEAR_AUTH_CACHE' });
|
||||
}
|
||||
if ('caches' in window) {
|
||||
const keys = await window.caches.keys();
|
||||
await Promise.all(
|
||||
keys.map(async (cacheKey) => {
|
||||
const cache = await window.caches.open(cacheKey);
|
||||
const requests = await cache.keys();
|
||||
await Promise.all(
|
||||
requests
|
||||
.filter((req) => {
|
||||
try {
|
||||
const u = new URL(req.url);
|
||||
return u.pathname === '/vcon' || u.pathname.startsWith('/vcon/');
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.map((req) => cache.delete(req))
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
} catch {
|
||||
// Best-effort cache cleanup
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user