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.
This commit is contained in:
Sasha Sorokin 2021-10-13 10:02:55 +07:00 committed by GitHub
parent 89b5071fde
commit 6c88ebfd4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

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