Skip to content

Fully autonomous AI Agents system capable of performing complex penetration testing tasks

fix(webui): redirect to login when the GraphQL subscription WS auth fails

Sergey Kozyrenkoec608d7091b8
diff --git a/frontend/src/lib/apollo.ts b/frontend/src/lib/apollo.ts
index 088c0390..36f353b3 100644
--- a/frontend/src/lib/apollo.ts
+++ b/frontend/src/lib/apollo.ts
@@ -390,21 +390,9 @@ const createApolloClient = () => {
error: (error) => {
Log.error('GraphQL WebSocket error:', error);
- if (error && typeof error === 'object') {
- const errorMessage = 'message' in error ? String(error.message) : '';
- const errorString = errorMessage.toLowerCase();
-
- if (
- errorString.includes('403') ||
- errorString.includes('401') ||
- errorString.includes('unauthorized') ||
- errorString.includes('auth required') ||
- errorString.includes('forbidden')
- ) {
- Log.warn('WebSocket authorization error detected, refreshing auth info');
- window.dispatchEvent(new Event('auth:refresh'));
- }
- }
+ // A WebSocket error event doesn't expose the handshake HTTP status, so a
+ // 403 can't be detected here — let /info classify it via auth:refresh.
+ window.dispatchEvent(new Event('auth:refresh'));
},
ping: () => Log.debug('GraphQL WebSocket ping'),
pong: () => Log.debug('GraphQL WebSocket pong'),