about summary refs log tree commit diff
path: root/streaming
diff options
context:
space:
mode:
authorSasha Sorokin <10401817+Brawaru@users.noreply.github.com>2021-10-13 10:02:55 +0700
committerGitHub <noreply@github.com>2021-10-13 05:02:55 +0200
commit6c88ebfd4b8e7d3d976cf3fd66c496394f845e87 (patch)
treea9c04d3bceb616108973b2bdc3ead566aebf7bb5 /streaming
parent89b5071fde2f111eaa53ce404712423de25a593d (diff)
fix(streaming): req.scopes can be nullable (#16823)
When checking for required OAuth scopes, an unexpected error could
happen due to missing (null-y) req.scopes. This commit fixes that by
checking if req.scopes are present before checking if any required
scopes are present, otherwise it skips that straight to rejection.
Diffstat (limited to 'streaming')
-rw-r--r--streaming/index.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/streaming/index.js b/streaming/index.js
index 67cd48b43..8b7477a44 100644
--- a/streaming/index.js
+++ b/streaming/index.js
@@ -430,7 +430,7 @@ const startWorker = (workerId) => {
       requiredScopes.push('read:statuses');
     }
 
-    if (requiredScopes.some(requiredScope => req.scopes.includes(requiredScope))) {
+    if (req.scopes && requiredScopes.some(requiredScope => req.scopes.includes(requiredScope))) {
       resolve();
       return;
     }