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.
th-downstream
Sasha Sorokin 3 years ago committed by GitHub
parent 0f50a97175
commit 9906bc20d2

@ -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;
}

Loading…
Cancel
Save