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(ip): Set x-forwarded-for header from gql to auth-server #15422

Merged
merged 1 commit into from
Jun 15, 2023
Merged

Conversation

vbudhram
Copy link
Contributor

@vbudhram vbudhram commented Jun 7, 2023

Because

  • The correct ip address was not being sent to auth-server from graphql server

This pull request

  • Sets the x-forwarded-for header to the cllient ip address, the auth-server uses this value to perform geo location

Issue that this pull request solves

Closes: https://mozilla-hub.atlassian.net/browse/FXA-6858

Checklist

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).

@vbudhram vbudhram requested a review from a team as a code owner June 7, 2023 18:27
// Set the x-forwarded-for header since the auth-server will use this
// to determine client geolocation
if (ctx.req?.ip) {
headers['x-forwarded-for'] = ctx.req?.ip;
Copy link
Member

@clouserw clouserw Jun 7, 2023

Choose a reason for hiding this comment

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

Just to be explicit here, ctx.req.ip does not come from a user-agent, right? (Meaning there is no possibility of injecting something here)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call out, this value is populated from Graphql request and not injected.

Copy link
Contributor

@LZoog LZoog left a comment

Choose a reason for hiding this comment

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

Makes sense / LGTM - I didn't test locally because IIRC this is not reproducible locally, let me know if that's incorrect and I will test locally.

@vbudhram vbudhram merged commit d8eb1e4 into main Jun 15, 2023
@vbudhram vbudhram deleted the fxa-6858 branch June 15, 2023 16:40
@vbudhram vbudhram restored the fxa-6858 branch July 7, 2023 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants