Safari で無限の SSO リダイレクトが発生

複数の Discourse インスタンスで「ログイン必須」が設定され、SSO を使用している場合、iOS の Safari でログイン時に無限リダイレクトが発生しています。状況は以下の通りです。

  1. ユーザーは Discourse および SSO マスターサイトにはログインしていない。
  2. ユーザーが Discourse インスタンスにアクセスする。
  3. Discourse が SSO ページにリダイレクトする。
  4. SSO ページで認証情報の入力を促す。ユーザーがログインする。
  5. ユーザーは SSO マスターサイトと Discourse の間でリダイレクトループに陥り、Safari がリトライを諦めるまでこの状態が続く。
  6. その後、ユーザーが手動で再度 Discourse にアクセスすると、ログイン済みとなっている。

デスクトップ版の Chrome ではこの現象を再現できません。
リダイレクトループ中にクライアントが存在する間、複数の「Started SSO process」と「User was logged on」のエントリが生成されています。これは SSO プロセスが成功しているように見えますが、何らかの理由で SSO 完了後、Discourse がユーザーをスタートページではなく、別の SSO ログイン画面へリダイレクトしてしまっているようです。

これは以前は正常に動作していた古いインスタンスにも影響しており、Discourse の設定問題ではないと考えています。

何か問題の原因についてご存知の方はいらっしゃいますか?

「いいね!」 4

Any ideas on this @sam?

I have seen this on sites that have the setting same site cookies set to Strict, if it is already on Lax recommend attempting to disable and see if it works around the Safari bug.

「いいね!」 6

Maybe the new Safari Tech Preview from today will fix it:

Fixed Same-Site Lax cookies to be sent with cross-site redirect from a client-initiated load (r241918)

「いいね!」 7

You are :100:% correct. It was on Lax, the default. Changing it to Disabled fixed the issue immediately. (I assume this is a defense-in-depth thing, on top of your usual CSRF protections, so disabling it is not overly terrible for security?)

Let’s hope for the best!

Thank you for your help!


I rate you :star2::star2::star2::star2::star2::mage::mage: (five stars plus wizarding level two)!

「いいね!」 7

:man_facepalming: I’ve spent a very long time figuring out a similar issue was caused by this samsite=lax behaviour:

This fixes my issue - at least on macOS Mojave - so I assume it fixes it on iOS too. Thanks!

I’d also like to know people’s opinions on this.

What with this being the Mozilla Discourse and all, we don’t have a huge amount of traffic from Safari, so don’t want to make ourselves vulnerable to CSRF attacks for something which will benefit a very small proportion of our users.

「いいね!」 6