Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix OIDC csrf issue #940

Merged
merged 2 commits into from
Feb 27, 2025
Merged
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
5 changes: 2 additions & 3 deletions src/javascript/_common/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
};

export const requestSingleSignOn = async () => {
const _requestSingleSignOn = async () => {

Check warning on line 130 in src/javascript/_common/auth.js

View workflow job for this annotation

GitHub Actions / build_and_deploy_preview_link

Unexpected dangling '_' in '_requestSingleSignOn'

Check warning on line 130 in src/javascript/_common/auth.js

View workflow job for this annotation

GitHub Actions / build_and_deploy_preview_link

Unexpected dangling '_' in '_requestSingleSignOn'

Check warning on line 130 in src/javascript/_common/auth.js

View workflow job for this annotation

GitHub Actions / build_and_deploy_preview_link

Unexpected dangling '_' in '_requestSingleSignOn'

Check warning on line 130 in src/javascript/_common/auth.js

View workflow job for this annotation

GitHub Actions / Build and Test

Unexpected dangling '_' in '_requestSingleSignOn'

Check warning on line 130 in src/javascript/_common/auth.js

View workflow job for this annotation

GitHub Actions / Build and Test

Unexpected dangling '_' in '_requestSingleSignOn'
// if we have previously logged in,
// this cookie will be set by the Callback page (which is exported from @deriv-com/auth-client library) to true when we have successfully logged in from other apps
const isLoggedInCookie = Cookies.get('logged_state') === 'true';
Expand All @@ -146,7 +146,7 @@

const hasMissingToken = Object.values(clientAccounts).some((account) => {
// Check if current account is missing token
if (!account?.token) {
if (!account?.token && !account?.is_disabled !== 1) {
return true; // No linked accounts and no token
}
return false;
Expand All @@ -156,8 +156,7 @@
isLoggedInCookie &&
!isCallbackPage &&
!isEndpointPage &&
(!isClientAccountsPopulated ||
(isClientAccountsPopulated && hasMissingToken)) &&
(!isClientAccountsPopulated || hasMissingToken) &&
isAuthEnabled;

if (shouldRequestSignOn) {
Expand Down
Loading