Skip to content

Store longer X-Forwarded-For header #27221

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

Conversation

ihor-sviziev
Copy link
Contributor

@ihor-sviziev ihor-sviziev commented Mar 10, 2020

Description (*)

Header X-Forwarded-For could contains multiple IPs
This PR allow to store longer values

For instance in my DB I had value like this:
4x.xxx.xx.xx, 1xx.xxx.xx.xx, 10., where xxx - masked IP address of customer, while last IP address was just cut due to limit on the field in DB.

Related Pull Requests

N/A

Fixed Issues (if relevant)

Fixes #28693

Manual testing scenarios (*)

  1. Install Magento behind reverse proxy and Varnish
  2. Go to website and place order
  3. Go to admin > Sales > Orders
  4. Navigate to your order, see data in field "Placed from IP"

Actual result:
X-Forwarded-For header is cut

Expected result:
It shouldn't be cut

Questions or comments

Ma

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Mar 10, 2020

Hi @ihor-sviziev. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Guide documentation.

Copy link
Contributor

@dmytro-ch dmytro-ch left a comment

Choose a reason for hiding this comment

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

Nice catch, @ihor-sviziev!
The issue is relevant and must be fixed.

I guess this change can be covered by an integration test. We can either update an existing fixture or create a new one.
What do you think?

Thank you!

@ihor-sviziev
Copy link
Contributor Author

ihor-sviziev commented Mar 12, 2020 via email

@ihor-sviziev ihor-sviziev added the Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. label May 28, 2020
@ihor-sviziev
Copy link
Contributor Author

Unfortunately I don't have free time for implementing tests for my change.

@engcom-Golf @engcom-Charlie could you help with test coverage?

@engcom-Charlie
Copy link
Contributor

@magento run all tests

@engcom-Charlie engcom-Charlie self-assigned this Jun 25, 2020
@ihor-sviziev
Copy link
Contributor Author

@engcom-Charlie maybe it's better to have more real value, like IPV6 address, or multiple ipv4 IPs?

@engcom-Charlie
Copy link
Contributor

engcom-Charlie commented Jun 25, 2020

@ihor-sviziev,
In my opinion, it doesn't matter if there are IP addresses or symbols, because the PR change is the length of characters in the column.

@ihor-sviziev ihor-sviziev requested a review from dmytro-ch June 25, 2020 19:40
@ihor-sviziev
Copy link
Contributor Author

@dmytro-ch could you review again this pr?

@dmytro-ch dmytro-ch added Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Award: bug fix labels Jun 29, 2020
Copy link
Contributor

@dmytro-ch dmytro-ch left a comment

Choose a reason for hiding this comment

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

The changes look good to me. Thank you!

@magento-engcom-team
Copy link
Contributor

Hi @dmytro-ch, thank you for the review.
ENGCOM-7756 has been created to process this Pull Request

@engcom-Delta engcom-Delta self-assigned this Jul 9, 2020
@engcom-Delta
Copy link
Contributor

✔️ QA passed
Was checked value longer than 32 symbols is saved in x_forwarded_for in database
#27221PR

@engcom-Charlie engcom-Charlie added the QA: Ready to add to Regression Scope Should be analyzed and added to Regression Testing Scope(if applicable) label Jul 9, 2020
@engcom-Delta engcom-Delta added QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope and removed QA: Ready to add to Regression Scope Should be analyzed and added to Regression Testing Scope(if applicable) labels Jul 10, 2020
@VladimirZaets VladimirZaets added the Priority: P3 May be fixed according to the position in the backlog. label Jul 21, 2020
@magento-engcom-team magento-engcom-team merged commit 90e3efa into magento:2.4-develop Jul 23, 2020
@m2-assistant
Copy link

m2-assistant bot commented Jul 23, 2020

Hi @ihor-sviziev, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@ihor-sviziev ihor-sviziev deleted the store-longed-x-forwarded-for branch August 4, 2020 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Award: bug fix Component: Sales Priority: P3 May be fixed according to the position in the backlog. Progress: accept QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope Release Line: 2.4 Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

IPv6 values of X_FORWARDED_FOR in sales orders are truncated to 32 characters.
6 participants