Sfoglia il codice sorgente

fix: add missing null check

KernelDeimos 3 settimane fa
parent
commit
89b8c8de1d
1 ha cambiato i file con 5 aggiunte e 0 eliminazioni
  1. 5 0
      src/backend/src/services/auth/AntiCSRFService.js

+ 5 - 0
src/backend/src/services/auth/AntiCSRFService.js

@@ -94,6 +94,11 @@ class AntiCSRFService extends BaseService {
             if ( ! subdomain_check ) {
                 return res.status(404).send('Hey, stop that!');
             }
+            
+            if ( ! req.user ) {
+                res.status(403).send({});
+                return;
+            }
 
             // TODO: session uuid instead of user
             const token = this.create_token(req.user.uuid);