Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!sessionData) { throw new Error('Please log in to continue') }
if (
(data.action.indexOf('resque') < 0) &&
(!data.params.csrfToken || data.params.csrfToken !== sessionData.csrfToken)
) { throw new Error('CSRF error') }
data.session = sessionData
const key = api.session.prefix + data.connection.fingerprint
await redis.expire(key, api.session.ttl)
}
}
}
}
api.actions.addMiddleware(api.session.middleware['logged-in-session'])
api.params.globalSafeParams.push('csrfToken')
}
}