Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: add state parameter to OAuth strategies for enhanced security #1902

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/auth/bitbucket/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const bitbucketAuth = module.exports = Router()
passport.use(new BitbucketStrategy({
clientID: config.bitbucket.clientID,
clientSecret: config.bitbucket.clientSecret,
callbackURL: config.serverURL + '/auth/bitbucket/callback'
callbackURL: config.serverURL + '/auth/bitbucket/callback',
state: true
}, passportGeneralCallback))

bitbucketAuth.get('/auth/bitbucket', function (req, res, next) {
Expand Down
3 changes: 2 additions & 1 deletion lib/auth/dropbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ passport.use(new DropboxStrategy({
apiVersion: '2',
clientID: config.dropbox.clientID,
clientSecret: config.dropbox.clientSecret,
callbackURL: config.serverURL + '/auth/dropbox/callback'
callbackURL: config.serverURL + '/auth/dropbox/callback',
state: true
}, passportGeneralCallback))

dropboxAuth.get('/auth/dropbox', function (req, res, next) {
Expand Down
3 changes: 2 additions & 1 deletion lib/auth/facebook/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const facebookAuth = module.exports = Router()
passport.use(new FacebookStrategy({
clientID: config.facebook.clientID,
clientSecret: config.facebook.clientSecret,
callbackURL: config.serverURL + '/auth/facebook/callback'
callbackURL: config.serverURL + '/auth/facebook/callback',
state: true
}, passportGeneralCallback))

facebookAuth.get('/auth/facebook', function (req, res, next) {
Expand Down
3 changes: 2 additions & 1 deletion lib/auth/github/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ passport.use(new GithubStrategy({
callbackURL: config.serverURL + '/auth/github/callback',
authorizationURL: githubUrl('login/oauth/authorize'),
tokenURL: githubUrl('login/oauth/access_token'),
userProfileURL: githubUrl('api/v3/user')
userProfileURL: githubUrl('api/v3/user'),
state: true
}, async (accessToken, refreshToken, profile, done) => {
if (!config.github.organizations) {
return passportGeneralCallback(accessToken, refreshToken, profile, done)
Expand Down
3 changes: 2 additions & 1 deletion lib/auth/gitlab/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const gitlabAuthStrategy = new GitlabStrategy({
clientID: config.gitlab.clientID,
clientSecret: config.gitlab.clientSecret,
scope: config.gitlab.scope,
callbackURL: config.serverURL + '/auth/gitlab/callback'
callbackURL: config.serverURL + '/auth/gitlab/callback',
state: true
}, passportGeneralCallback)

if (process.env.https_proxy) {
Expand Down
3 changes: 2 additions & 1 deletion lib/auth/google/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ passport.use(new GoogleStrategy({
clientID: config.google.clientID,
clientSecret: config.google.clientSecret,
callbackURL: config.serverURL + '/auth/google/callback',
userProfileURL: 'https://www.googleapis.com/oauth2/v3/userinfo'
userProfileURL: 'https://www.googleapis.com/oauth2/v3/userinfo',
state: true
}, passportGeneralCallback))

googleAuth.get('/auth/google', function (req, res, next) {
Expand Down
3 changes: 2 additions & 1 deletion lib/auth/twitter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const twitterAuth = module.exports = Router()
passport.use(new TwitterStrategy({
consumerKey: config.twitter.consumerKey,
consumerSecret: config.twitter.consumerSecret,
callbackURL: config.serverURL + '/auth/twitter/callback'
callbackURL: config.serverURL + '/auth/twitter/callback',
state: true
}, passportGeneralCallback))

twitterAuth.get('/auth/twitter', function (req, res, next) {
Expand Down