Set "SameSite=None" if CSRF Protection is disabled

PR #18843.
This commit is contained in:
七海千秋 2023-04-16 19:27:49 +08:00 committed by GitHub
parent eaee38a19e
commit 1e400df324
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -683,6 +683,8 @@ void WebApplication::sessionStart()
QByteArray cookieRawForm = cookie.toRawForm();
if (m_isCSRFProtectionEnabled)
cookieRawForm.append("; SameSite=Strict");
else if (cookie.isSecure())
cookieRawForm.append("; SameSite=None");
setHeader({Http::HEADER_SET_COOKIE, QString::fromLatin1(cookieRawForm)});
}