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): ensure ngx.ctx.host_port is a number (and not a string) #12806

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

bungle
Copy link
Member

@bungle bungle commented Mar 28, 2024

Summary

It turns out that ngx.ctx.host_port may be a string in some cases, which leads to bugs elsewhere where it may be expected to be a number. This adds tonumber call to ensure that it is a number.

This bug affects for example PDK function kong.request.get_forwarded_port().

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

https://konghq.atlassian.net/browse/KAG-4158

Signed-off-by: Aapo Talvensaari <aapo.talvensaari@gmail.com>
@bungle bungle marked this pull request as ready for review April 10, 2024 18:30
@bungle bungle merged commit 7263210 into master Apr 11, 2024
53 checks passed
@bungle bungle deleted the fix/ctx-host-port branch April 11, 2024 12:30
@team-gateway-bot
Copy link
Collaborator

Backport failed for release/2.8.x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release/2.8.x
git worktree add -d .worktree/backport-12806-to-release/2.8.x origin/release/2.8.x
cd .worktree/backport-12806-to-release/2.8.x
git switch --create backport-12806-to-release/2.8.x
git cherry-pick -x 72632106b61949de69ae4dd7b59deedea4ed7626

@team-gateway-bot
Copy link
Collaborator

Backport failed for release/3.3.x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release/3.3.x
git worktree add -d .worktree/backport-12806-to-release/3.3.x origin/release/3.3.x
cd .worktree/backport-12806-to-release/3.3.x
git switch --create backport-12806-to-release/3.3.x
git cherry-pick -x 72632106b61949de69ae4dd7b59deedea4ed7626

@team-gateway-bot
Copy link
Collaborator

Backport failed for release/3.4.x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release/3.4.x
git worktree add -d .worktree/backport-12806-to-release/3.4.x origin/release/3.4.x
cd .worktree/backport-12806-to-release/3.4.x
git switch --create backport-12806-to-release/3.4.x
git cherry-pick -x 72632106b61949de69ae4dd7b59deedea4ed7626

@team-gateway-bot
Copy link
Collaborator

Backport failed for release/3.5.x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release/3.5.x
git worktree add -d .worktree/backport-12806-to-release/3.5.x origin/release/3.5.x
cd .worktree/backport-12806-to-release/3.5.x
git switch --create backport-12806-to-release/3.5.x
git cherry-pick -x 72632106b61949de69ae4dd7b59deedea4ed7626

@team-gateway-bot
Copy link
Collaborator

Successfully created cherry-pick PR for master:

@team-gateway-bot
Copy link
Collaborator

Backport failed for release/3.6.x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release/3.6.x
git worktree add -d .worktree/backport-12806-to-release/3.6.x origin/release/3.6.x
cd .worktree/backport-12806-to-release/3.6.x
git switch --create backport-12806-to-release/3.6.x
git cherry-pick -x 72632106b61949de69ae4dd7b59deedea4ed7626

bungle added a commit that referenced this pull request Apr 11, 2024
…12806)

Signed-off-by: Aapo Talvensaari <aapo.talvensaari@gmail.com>
bungle added a commit that referenced this pull request Apr 11, 2024
…12806)

Signed-off-by: Aapo Talvensaari <aapo.talvensaari@gmail.com>
bungle added a commit that referenced this pull request Apr 11, 2024
…12806)

Signed-off-by: Aapo Talvensaari <aapo.talvensaari@gmail.com>
bungle added a commit that referenced this pull request Apr 16, 2024
…12806)

Signed-off-by: Aapo Talvensaari <aapo.talvensaari@gmail.com>
bungle added a commit that referenced this pull request Apr 16, 2024
…12806)

Signed-off-by: Aapo Talvensaari <aapo.talvensaari@gmail.com>
bungle added a commit that referenced this pull request Apr 16, 2024
…12806)

Signed-off-by: Aapo Talvensaari <aapo.talvensaari@gmail.com>
@kikito
Copy link
Member

kikito commented May 14, 2024

We won't backport this further than 3.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee core/logs core/proxy core/router size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants