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

Policy: IPCheck validate that port is not used. #1192

Merged
merged 1 commit into from
May 27, 2020

Conversation

eloycoto
Copy link
Contributor

This commit fix the issue when port is added into the forwarder-for
header and IPCheck will not match correctly.

Fix THREESCALE-5258

Signed-off-by: Eloy Coto eloy.coto@acalustra.com

@eloycoto eloycoto requested a review from a team as a code owner May 25, 2020 16:56
This commit fix the issue when port is added into the forwarder-for
header and IPCheck will not match correctly.

Fix THREESCALE-5258

Signed-off-by: Eloy Coto <eloy.coto@acalustra.com>
@palmieric
Copy link

Looks great to me!

-- host
-- `:` split is not valid in case that it's IPv6 notation.
local host = re.split(forwarded_for, ',', 'oj')[1]
local uri = resty_url.parse("my://".. host)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is my:// needed 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.

if no scheme, the resty_url will fail, so it's the safest way to detect if IP/PORT is in there, also with IPv4/IPv6 combitation.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍
It'd be useful to add a comment that clarifies that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's already in there :\

Copy link
Contributor

Choose a reason for hiding this comment

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

ah sorry, I missed that.

@eloycoto eloycoto merged commit e6e7ef1 into 3scale:master May 27, 2020
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