Skip to content

Allow WORKING_COOKIES on cross-site requests#61

Merged
buckett merged 3 commits into
masterfrom
better-working-cookies
Jun 10, 2026
Merged

Allow WORKING_COOKIES on cross-site requests#61
buckett merged 3 commits into
masterfrom
better-working-cookies

Conversation

@buckett

@buckett buckett commented Jun 10, 2026

Copy link
Copy Markdown
Member

Browsers often ignore or withhold cookies on cross-site requests unless they are marked explicitly for that use.

WORKING_COOKIES may be used in an embedded cross-site LTI launch. Marking it SameSite=None; Secure allows browsers to include it in that third-party context, where the default cookie policy would otherwise prevent it from being sent. This improves compatibility, though some browsers may still block third-party cookies.

Browsers often ignore or withhold cookies on cross-site requests unless
they are marked explicitly for that use.

WORKING_COOKIES may be used in an embedded cross-site LTI launch. Marking it SameSite=None; Secure allows browsers to include it in that third-party context, where the default cookie policy would otherwise prevent it from being sent. This improves compatibility, though some browsers may still block third-party cookies.
Copilot AI review requested due to automatic review settings June 10, 2026 10:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates how the WORKING_COOKIES marker cookie is issued so that it can be sent in embedded / third-party (cross-site) LTI launch flows by explicitly setting SameSite=None; Secure. This aligns the cookie behavior with modern browser cross-site cookie requirements and adds a regression test to validate the cookie attributes.

Changes:

  • Set SameSite=None on the WORKING_COOKIES cookie when marking a session as working.
  • Extend the Step 3 stateful test to assert cookie attributes (value, path, Secure, HttpOnly, SameSite).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/main/java/uk/ac/ox/ctl/lti13/security/oauth2/client/lti/web/OptimisticAuthorizationRequestRepository.java Marks WORKING_COOKIES as cross-site capable via SameSite=None and updates related inline documentation.
src/test/java/uk/ac/ox/ctl/lti13/stateful/Lti13Step3Test.java Adds assertions to ensure the WORKING_COOKIES cookie is emitted with the intended security and SameSite attributes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +11 to +14
* Checks to see if we already have a valid HTTP Session containing a token, if so we store details of the login
* in the HTTP Session, otherwise we use store based on the state.
* in the HTTP Session, otherwise we use store based on the state. When debugging things you can tell on the client if
* the login was done using the session as the redirect to the tool in step 3 is done as a HTTP 302 redirect, if the
* check is done by the browser using LTI Storage the step 3 is a HTTP 200 response where JS does the redirect.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the class Javadoc for grammar and clarity, and removed the trailing whitespace in commit 747c88a.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@buckett buckett merged commit 03ae33a into master Jun 10, 2026
1 check passed
@buckett buckett deleted the better-working-cookies branch June 10, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants