Skip to content
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

fix(core): use realip_remote_addr function to extract ip address #4653

Merged
merged 2 commits into from
May 16, 2024

Conversation

Narayanbhat166
Copy link
Member

Type of Change

  • Bugfix

Description

Previously we were relying on the X_FORWARDED_FOR header value for extracting the ip address. This value would be available if there were proxies that populate this value. But if this has been done from the localhost or if there were no reverse proxies behind the application, then this header value would not be present. This has been fixed in this PR.

We are using the realip_remote_addr function to extract the ip address from the request. This will look for the X_FORWARDED_FOR header, if not found, fallback to the socket ip address.

Motivation and Context

How did you test it?

  • Confirm a payment and then check for the log line

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code

@Narayanbhat166 Narayanbhat166 added C-bug Category: Bug S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels May 15, 2024
@Narayanbhat166 Narayanbhat166 self-assigned this May 15, 2024
@Narayanbhat166 Narayanbhat166 requested a review from a team as a code owner May 15, 2024 13:22
lsampras
lsampras previously approved these changes May 15, 2024
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue May 16, 2024
Merged via the queue into main with commit 8427b60 May 16, 2024
9 of 10 checks passed
@Gnanasundari24 Gnanasundari24 deleted the fix_ip_address_extraction branch May 16, 2024 18:25
@SanchithHegde SanchithHegde removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants