Skip to content

Conversation

sreichel
Copy link
Contributor

@sreichel sreichel commented Oct 2, 2025

Description (*)

Setting cookie SameSite to "None" breaks admin login for unsecured pages.

Fixed Issues (if relevant)

@sreichel sreichel added the bug label Oct 2, 2025
@github-actions github-actions bot added Component: Core Relates to Mage_Core Component: Adminhtml Relates to Mage_Adminhtml phpunit labels Oct 2, 2025
@sreichel sreichel changed the title Don't set cookie samesite to "None" for unsecured pages Fix admin login for unsecured pages Oct 2, 2025
@sreichel sreichel changed the title Fix admin login for unsecured pages Fix admin login for non-secure cookies Oct 2, 2025
@sreichel sreichel requested a review from Copilot October 2, 2025 04:24
Copy link
Contributor

@Copilot Copilot AI left a comment

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 fixes admin login issues when using non-secure cookies by preventing the SameSite attribute from being set to "None" for non-HTTPS connections, which is incompatible with browser security requirements.

  • Adds logic to conditionally remove SameSite=None for non-secure cookies in session handling
  • Introduces constants for SameSite cookie values to improve code maintainability
  • Updates cookie handling to use consistent constant references instead of hardcoded strings

Reviewed Changes

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

File Description
app/code/core/Mage/Adminhtml/Model/System/Config/Source/Cookie/Samesite.php Adds constants for SameSite values (NONE, STRICT, LAX) and updates option array to use them
app/code/core/Mage/Core/Model/Cookie.php Updates cookie methods to use SameSite constants and improves type hints and documentation
app/code/core/Mage/Core/Model/Session/Abstract/Varien.php Adds conditional logic to remove SameSite=None for non-secure cookies and fixes namespace references
tests/unit/Mage/Core/Model/CookieTest.php Adds comprehensive unit tests for the Cookie model functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@sreichel sreichel marked this pull request as draft October 2, 2025 06:02
@sreichel sreichel marked this pull request as ready for review October 2, 2025 07:25
Copy link

sonarqubecloud bot commented Oct 2, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Component: Adminhtml Relates to Mage_Adminhtml Component: Core Relates to Mage_Core phpunit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] no login possible post-Update 20.13.0 -> 20.14.0 (and still 20.15.0) Install magento-lts-20.14.0 with ip address issue
1 participant