[3.3.0.2 backport] CBG-4964 create cookie with SameSite=None if CORS enabled#7843
Merged
adamcfraser merged 1 commit intorelease/3.3.0.2from Oct 29, 2025
Merged
[3.3.0.2 backport] CBG-4964 create cookie with SameSite=None if CORS enabled#7843adamcfraser merged 1 commit intorelease/3.3.0.2from
adamcfraser merged 1 commit intorelease/3.3.0.2from
Conversation
Redocly previews |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR backports CBG-4964 to the 3.3.0.2 release, adding support for setting the SameSite attribute on session cookies. When CORS is enabled, session cookies will automatically use SameSite=None, while allowing explicit configuration through the same_site_cookie unsupported option.
Key changes:
- Adds automatic SameSite=None for session cookies when CORS is enabled
- Implements
same_site_cookieconfiguration option in unsupported settings - Updates session cookie creation to accept and apply SameSite attribute
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| rest/utilities_testing.go | Adds SafeDatabaseName helper function for test database naming |
| rest/session_test.go | Adds test coverage for SameSite cookie behavior with and without CORS |
| rest/session_api.go | Updates makeSessionWithTTL to pass SameSite mode when creating session cookies |
| rest/server_context.go | Sets default SameSite=None when CORS enabled and handles unsupported config override |
| rest/cors_test.go | Extends CORS tests to verify SameSite cookie behavior with configuration options |
| rest/config_test.go | Adds validation tests for same_site_cookie configuration values |
| rest/config.go | Adds validation for SameSite cookie configuration during database config validation |
| docs/api/components/schemas.yaml | Documents the new same_site_cookie API field |
| db/database.go | Adds SameSiteCookieMode field and GetSameSiteCookieMode method |
| auth/session_test.go | Updates test calls to include SameSite parameter |
| auth/session.go | Updates MakeSessionCookie to accept and apply SameSite parameter |
| case "Default": | ||
| return http.SameSiteDefaultMode, nil | ||
| default: | ||
| return http.SameSiteDefaultMode, fmt.Errorf("unsupported_options.same_site_cookie option %q is not valid, choices are \"Lax\", \"Strict\", and \"None", *o.SameSiteCookie) |
There was a problem hiding this comment.
Corrected spelling of 'choices' to include 'None' and added closing quote and parenthesis.
Suggested change
| return http.SameSiteDefaultMode, fmt.Errorf("unsupported_options.same_site_cookie option %q is not valid, choices are \"Lax\", \"Strict\", and \"None", *o.SameSiteCookie) | |
| return http.SameSiteDefaultMode, fmt.Errorf("unsupported_options.same_site_cookie option %q is not valid, choices are \"Lax\", \"Strict\", and \"None\"", *o.SameSiteCookie) |
| require.Equal(t, test.origin, resp.Header().Get(accessControlAllowOrigin)) | ||
| } else { | ||
| require.Equal(t, test.origin, resp.Header().Get(accessControlAllowOrigin)) | ||
| RequireStatus(t, rt.CreateDatabase(SafeDatabaseName(t, dbTestCases.name), dbConfig), http.StatusCreated) |
There was a problem hiding this comment.
[nitpick] Database name created from test case name should be stored in a variable for better readability and potential reuse in the test.
Suggested change
| RequireStatus(t, rt.CreateDatabase(SafeDatabaseName(t, dbTestCases.name), dbConfig), http.StatusCreated) | |
| dbName := SafeDatabaseName(t, dbTestCases.name) | |
| RequireStatus(t, rt.CreateDatabase(dbName, dbConfig), http.StatusCreated) |
adamcfraser
approved these changes
Oct 29, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[3.3.0.2 backport] CBG-4964 create cookie with SameSite=None if CORS enabled
cherry-pick of 30ee4fe, minimal conflicts in
database.go