-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Compare admin domain from the start, not as a substring #38791
base: 2.4-develop
Are you sure you want to change the base?
Compare admin domain from the start, not as a substring #38791
Conversation
Hi @zapotocnylubos. Thank you for your contribution! Add the comment under your pull request to deploy test or vanilla Magento instance:
❗ Automated tests can be triggered manually with an appropriate comment:
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
@magento run all tests |
@magento run Functional Tests B2B, Functional Tests CE, Functional Tests EE |
@magento run WebAPI Tests, Sample Data Tests B2B, Sample Data Tests CE, Sample Data Tests EE |
d69b65c
to
2599b3e
Compare
I rebased the branch for easier integration (GitHub suggested that and proposed easy button here). |
@magento run all tests |
@magento run Sample Data Tests B2B, Sample Data Tests CE, Sample Data Tests EE |
Failed to run the builds. Please try to re-run them later. |
Thank you for your input @zapotocnylubos, this resolves the issue we are having on a few projects. Please don't make any changes to the PR, don't update it with the latest leading branch. I brought some 👍🏻 for you, so the PR will be processed (hopefully) sooner. |
@ihor-sviziev and @andrewbess - I need your review in order to proceed with this ticket. |
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.
Hi @zapotocnylubos ,
Could you please cover your change with a unit test?
@zapotocnylubos or @ihor-sviziev Could you cherry pick these two commits zapotocnylubos#1 to current PR? |
cherry picked, thank you @lbajsarowicz |
@magento run all tests |
'url' => 'https://magento.loc', | ||
'host' => 'magento.loc', | ||
'useCustomAdminUrl' => '1', | ||
'customAdminUrl' => 'https://admin.magento.loc', | ||
'expectedValue' => false | ||
], | ||
'visitingAdminInSubdomain' => [ | ||
'url' => 'https://magento.loc', | ||
'host' => 'admin.magento.loc', | ||
'useCustomAdminUrl' => '1', | ||
'customAdminUrl' => 'https://admin.magento.loc', | ||
'expectedValue' => true |
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.
@zapotocnylubos @lbajsarowicz, shouldn't it be a URL ending with a slash like this? (I didn't test it)
Could you check what the actual value you're having here?
'url' => 'https://magento.loc', | |
'host' => 'magento.loc', | |
'useCustomAdminUrl' => '1', | |
'customAdminUrl' => 'https://admin.magento.loc', | |
'expectedValue' => false | |
], | |
'visitingAdminInSubdomain' => [ | |
'url' => 'https://magento.loc', | |
'host' => 'admin.magento.loc', | |
'useCustomAdminUrl' => '1', | |
'customAdminUrl' => 'https://admin.magento.loc', | |
'expectedValue' => true | |
'url' => 'https://magento.loc/', | |
'host' => 'magento.loc', | |
'useCustomAdminUrl' => '1', | |
'customAdminUrl' => 'https://admin.magento.loc/', | |
'expectedValue' => false | |
], | |
'visitingAdminInSubdomain' => [ | |
'url' => 'https://magento.loc/', | |
'host' => 'admin.magento.loc', | |
'useCustomAdminUrl' => '1', | |
'customAdminUrl' => 'https://admin.magento.loc/', | |
'expectedValue' => true |
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.
Just wondering why we have a "starts with" logic for the admin hostname. Shouldn't it be fully compared?
In theory, we can proxy any domain to something like
admin.m2website.com
to admin.m2website.com.myowndomain.com
, and it will pass. I'm not sure if that could cause any issues directly, but might lead to finding additional vulnerabilities based on this behavior.
What do you think?
@magento run all tests |
We are moving this PR to |
Hi @zapotocnylubos, Thanks for your Contribution!!. As per this comment #37663 (comment) The Magento core engineering team is working on the issue which you have addressed in this PR. Team will cherry pick the commits from your PR and may do further implementation to cover few more scenarios as needed. We will reach out to you if we need more information. For now, you can pause work on this PR.we are moving this PR to On Hold Thank you once again! |
Description (*)
When custom admin URL is used, the current algorithm wrongly detects custom admin URL, when its in a form of subdomain (for example admin.domain.com)
Related Pull Requests
None
Fixed Issues (if relevant)
Manual testing scenarios (*)
Install Magento and make sure it is working URL should be m2.domain.local
Questions or comments
None
Contribution checklist (*)