From e2aa88835ed29bef334a9f0796905cc79efcb690 Mon Sep 17 00:00:00 2001 From: Aapo Talvensaari Date: Wed, 4 Sep 2024 15:43:48 +0300 Subject: [PATCH] fix(key-auth): retain order of query arguments when hiding the credentials Fixes #12758 reported by @battlebyte. Signed-off-by: Aapo Talvensaari --- changelog/unreleased/kong/fix-key-auth-retain-query-order.yml | 3 +++ kong/plugins/key-auth/handler.lua | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelog/unreleased/kong/fix-key-auth-retain-query-order.yml diff --git a/changelog/unreleased/kong/fix-key-auth-retain-query-order.yml b/changelog/unreleased/kong/fix-key-auth-retain-query-order.yml new file mode 100644 index 0000000000000..215e131536806 --- /dev/null +++ b/changelog/unreleased/kong/fix-key-auth-retain-query-order.yml @@ -0,0 +1,3 @@ +message: Fixed *key-auth* to retain order of query arguments when hiding the credentials. +type: bugfix +scope: Plugin diff --git a/kong/plugins/key-auth/handler.lua b/kong/plugins/key-auth/handler.lua index 73902e2e3bc4f..89786aa7520a4 100644 --- a/kong/plugins/key-auth/handler.lua +++ b/kong/plugins/key-auth/handler.lua @@ -143,8 +143,7 @@ local function do_authentication(conf) key = v if conf.hide_credentials then - query[name] = nil - kong.service.request.set_query(query) + kong.service.request.clear_query_arg(name) kong.service.request.clear_header(name) if conf.key_in_body then