-
Notifications
You must be signed in to change notification settings - Fork 256
feat: Implement cross-domain cookie sharing #15849
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -83,7 +83,7 @@ | |||||
| }, | ||||||
| "dependencies": { | ||||||
| "@axe-core/playwright": "^4.8.5", | ||||||
| "@canonical/cookie-policy": "^3.7.4", | ||||||
| "@canonical/cookie-policy": "3.8.0", | ||||||
|
||||||
| "@canonical/cookie-policy": "3.8.0", | |
| "@canonical/cookie-policy": "3.8.1", |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,6 +10,8 @@ | |||||||
| import talisker.requests | ||||||||
| from jinja2 import ChoiceLoader, FileSystemLoader | ||||||||
| import yaml | ||||||||
| from flask_caching import Cache | ||||||||
| from datetime import timedelta | ||||||||
|
|
||||||||
| from canonicalwebteam.blog import BlogAPI, BlogViews, build_blueprint | ||||||||
| from canonicalwebteam.discourse import ( | ||||||||
|
|
@@ -31,6 +33,7 @@ | |||||||
| from canonicalwebteam.search import build_search_view | ||||||||
| from canonicalwebteam.templatefinder import TemplateFinder | ||||||||
| from canonicalwebteam.form_generator import FormGenerator | ||||||||
| from canonicalwebteam.cookie_service import CookieConsent | ||||||||
|
|
||||||||
| from webapp.certified.views import certified_routes | ||||||||
| from webapp.handlers import init_handlers | ||||||||
|
|
@@ -263,6 +266,38 @@ | |||||||
|
|
||||||||
| init_handlers(app, sentry) | ||||||||
|
|
||||||||
| # Configuration for shared cookie service | ||||||||
|
|
||||||||
| # Configure Flask session | ||||||||
| app.config["PERMANENT_SESSION_LIFETIME"] = timedelta(days=365) | ||||||||
| app.config["SESSION_COOKIE_SAMESITE"] = "Lax" | ||||||||
| app.config["SESSION_COOKIE_HTTPONLY"] = True | ||||||||
| app.config["SESSION_COOKIE_SECURE"] = True | ||||||||
|
|
||||||||
| # Number of days before preference cookies expire (default: 365) | ||||||||
| app.config["PREFERENCES_COOKIE_EXPIRY_DAYS"] = 365 | ||||||||
|
|
||||||||
| # Initialize Flask-Caching | ||||||||
| app.config["CACHE_TYPE"] = "SimpleCache" | ||||||||
|
||||||||
| app.config["CACHE_TYPE"] = "SimpleCache" | |
| app.config["CACHE_TYPE"] = "FileSystemCache" | |
| app.config["CACHE_DIR"] = "/tmp/flask_cache" |
Copilot
AI
Dec 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing documentation for the cookie service configuration. Consider adding comments explaining:
- What the COOKIE_SERVICE_API_KEY environment variable is used for (defined in konf/site.yaml but not explicitly referenced here)
- The purpose of each configuration option
- Why SimpleCache is being used and its limitations for production deployments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version specifier has changed from a flexible semantic version range (
^3.7.4) to an exact version pin (3.8.0). This inconsistency with other dependencies (which use flexible ranges like^) may make future updates more difficult. Consider using^3.8.0or~3.8.0to allow automatic patch updates while maintaining the current minor version, consistent with other dependencies like@canonical/global-nav.