Skip to content

[PB-6516]: fix/add-secure-and-samesite-strict-flags-to-i18next-lang-cookie#2008

Merged
sg-gs merged 3 commits into
masterfrom
fix/i18next-secure-cookie
Jun 25, 2026
Merged

[PB-6516]: fix/add-secure-and-samesite-strict-flags-to-i18next-lang-cookie#2008
sg-gs merged 3 commits into
masterfrom
fix/i18next-secure-cookie

Conversation

@sg-gs

@sg-gs sg-gs commented Jun 25, 2026

Copy link
Copy Markdown
Member

Description

The i18next-browser-language detector was caching the language preference in a cookie without the Secure flag, allowing it to be sent over HTTP. Adds cookieOptions to the detection config to harden the cookie.

Related Issues

None

Related Pull Requests

#2007

Checklist

  • Changes have been tested locally.
  • Unit tests have been written or updated as necessary.
  • The code adheres to the repository's coding standards.
  • Relevant documentation has been added or updated.
  • No new warnings or errors have been introduced.
  • SonarCloud issues have been reviewed and addressed.
  • QA Passed

Testing Process

Switch between languages to ensure i18next did not broke.

Additional Notes

Nothing

@sg-gs sg-gs requested a review from xabg2 June 25, 2026 08:29
@sg-gs sg-gs self-assigned this Jun 25, 2026
@sg-gs sg-gs requested review from CandelR and larryrider as code owners June 25, 2026 08:29
@sg-gs sg-gs added the enhancement New feature or request label Jun 25, 2026
@sg-gs sg-gs changed the title [_]: fix/add-secure-and-samesite-strict-flags-to-i18next-lang-cookie [PB-6516]: fix/add-secure-and-samesite-strict-flags-to-i18next-lang-cookie Jun 25, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 25, 2026

Copy link
Copy Markdown

Deploying drive-web with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0979583
Status: ✅  Deploy successful!
Preview URL: https://0a542ed7.drive-web.pages.dev
Branch Preview URL: https://fix-i18next-secure-cookie.drive-web.pages.dev

View logs

…ge cookie

The i18next-browser-languagedetector was caching the language preference
in a cookie without the Secure flag, allowing it to be sent over HTTP.
Adds cookieOptions to the detection config to harden the cookie.
await import('./i18n.service');
});

it('When initialised, then the language cookie has the Secure flag so it is never sent over HTTP', async () => {

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.

Better use test instead.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done

@sg-gs sg-gs force-pushed the fix/i18next-secure-cookie branch from 00a1c17 to 85b5d96 Compare June 25, 2026 08:35
@sg-gs sg-gs requested a review from xabg2 June 25, 2026 08:45
@sonarqubecloud

Copy link
Copy Markdown

@sg-gs sg-gs merged commit 0768183 into master Jun 25, 2026
10 of 11 checks passed
@sg-gs sg-gs deleted the fix/i18next-secure-cookie branch June 25, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants