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

Geoip filter #24318

Merged
merged 29 commits into from
Apr 18, 2023
Merged

Geoip filter #24318

merged 29 commits into from
Apr 18, 2023

Conversation

nezdolik
Copy link
Member

@nezdolik nezdolik commented Dec 2, 2022

This change introduces IP Geolocation filter. Implementation according to design doc.

Commit Message: IP Geolocation filter
Additional Description:
Risk Level: Low (new extension)
Testing: unit tests
Docs Changes: Done
Release Notes: tbd
Platform Specific Features: NA
Fixes moby/moby#23736

Kateryna Nezdolii added 2 commits December 2, 2022 10:43
Signed-off-by: Kateryna Nezdolii <[email protected]>
Signed-off-by: Kateryna Nezdolii <[email protected]>
@repokitteh-read-only
Copy link

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #24318 was opened by nezdolik.

see: more, trace.

@repokitteh-read-only
Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @markdroth
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #24318 was opened by nezdolik.

see: more, trace.

@nezdolik nezdolik force-pushed the geoip branch 3 times, most recently from 1b13a11 to c1cb979 Compare December 6, 2022 23:17
@nezdolik nezdolik force-pushed the geoip branch 18 times, most recently from 569c360 to c162dd4 Compare December 22, 2022 15:16
@nezdolik nezdolik force-pushed the geoip branch 3 times, most recently from ad8bf60 to 1e9846b Compare December 27, 2022 18:48
@nezdolik
Copy link
Member Author

nezdolik commented Apr 6, 2023

tsan ci failure seems to be unrelated, will merge main and check if it helps

@nezdolik
Copy link
Member Author

@ravenblackx ci is fixed now. Think I have addressed all review comments, but please lmk if smth is missing.

ravenblackx
ravenblackx previously approved these changes Apr 11, 2023
CODEOWNERS Outdated
@@ -291,6 +291,8 @@ extensions/filters/http/oauth2 @derekargueta @snowp
/*/extensions/load_balancing_policies/round_robin @wbpcode @UNOWNED
# Early header mutation
/*/extensions/http/early_header_mutation/header_mutation @wbpcode @UNOWNED
# IP Geolocation
/*/extensions/filters/http/geoip @nezdolik @mattklein123
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess. It's not really my field, but it would make sense since having reviewed some of it I now have the best context to review the rest of it.

Signed-off-by: Kateryna Nezdolii <[email protected]>
ravenblackx
ravenblackx previously approved these changes Apr 11, 2023
@nezdolik
Copy link
Member Author

nezdolik commented Apr 12, 2023

cc @sc0ttbeardsley i have started working on plugging the maxmind geoip provider for this filter in a separate change. If your company uses some other geolocation provider, you will need to submit a patch for it.

@nezdolik
Copy link
Member Author

@mattklein123 could you please take the final look? :)

@mattklein123 mattklein123 self-assigned this Apr 12, 2023
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks a few high level API comments. Can you also add a release note? Or do we want to wait on that until the maxmind provider is added per my other comment?

/wait

GeolocationHeadersToAdd geo_headers_to_add = 3 [(validate.rules).message = {required: true}];

// Geolocation provider specific configuration.
GeolocationProvider provider = 4 [(validate.rules).message = {required: true}];
Copy link
Member

Choose a reason for hiding this comment

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

This should use TypedExtensionConfig I think?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeap, did not know about that core message TypedExtensionConfig

Comment on lines 75 to 85
// If set to true, the `xff_num_trusted_hops` field will be used to determine
// trusted client address from `x-forwarded-for` header.
// Otherwise, the immediate downstream connection source address will be used.
bool use_xff = 1;

// The number of additional ingress proxy hops from the right side of the
// :ref:`config_http_conn_man_headers_x-forwarded-for` HTTP header to trust when
// determining the origin client's IP address. The default is zero if this option
// is not specified. See the documentation for
// :ref:`config_http_conn_man_headers_x-forwarded-for` for more information.
uint32 xff_num_trusted_hops = 2;
Copy link
Member

Choose a reason for hiding this comment

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

I would refactor this into an XffConfig message, with the presence of the message indicating that XFF should be consulted, and the num_trusted_hops inside of it. This will be a bit clearer from an API perspective.

Comment on lines 44 to 45
// If set, the IP address will be checked if it belongs to any type of anonymization network (e.g. VPN, public proxy etc)
// and header will be populated with the check result.
Copy link
Member

Choose a reason for hiding this comment

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

Can you specify the concrete values? Is it true/false? Something else? Same for all of the ones that aren't obviously strings.

Comment on lines +44 to +45
provider:
name: "envoy.geoip_providers.maxmind"
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't actually exist. Is this going to be added in some future PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's correct. I have initially suggested to split this work into implementing filter itself and then implementing the provider.

Signed-off-by: Kateryna Nezdolii <[email protected]>
Signed-off-by: Kateryna Nezdolii <[email protected]>
@nezdolik
Copy link
Member Author

/retest

@repokitteh-read-only
Copy link

Retrying Azure Pipelines:
Check envoy-presubmit isn't fully completed, but will still attempt retrying.
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #24318 (comment) was created by @nezdolik.

see: more, trace.

@phlax
Copy link
Member

phlax commented Apr 17, 2023

not sure what is causing the docker fail - but ticket is here moby/moby#26634 - ive reported upstream also moby/buildkit#3801

@nezdolik
Copy link
Member Author

@mattklein123 regarding release note, i think is better to wait until provider is implemented.

Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks!

@mattklein123 mattklein123 merged commit 46aecfc into envoyproxy:main Apr 18, 2023
@nezdolik nezdolik deleted the geoip branch April 18, 2023 20:58
@daum3ns daum3ns mentioned this pull request Jun 1, 2023
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.

8 participants