This is an automated email from the ASF dual-hosted git repository.

baoyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 55234b4b9 fix: remove credential-leaking log statements in sls-logger, 
hmac-auth, tcp-logger, udp-logger (#13205)
55234b4b9 is described below

commit 55234b4b9beefe42d7aa658026b76ebc87d4c575
Author: AlinsRan <[email protected]>
AuthorDate: Tue Apr 14 09:57:18 2026 +0800

    fix: remove credential-leaking log statements in sls-logger, hmac-auth, 
tcp-logger, udp-logger (#13205)
---
 apisix/plugins/hmac-auth.lua  |  6 ------
 apisix/plugins/sls-logger.lua |  2 --
 apisix/plugins/tcp-logger.lua |  1 -
 apisix/plugins/udp-logger.lua |  1 -
 t/plugin/sls-logger.t         | 13 +++++++++++++
 t/plugin/tcp-logger.t         | 23 +++++++++++++++++++++++
 t/plugin/udp-logger.t         | 23 +++++++++++++++++++++++
 7 files changed, 59 insertions(+), 10 deletions(-)

diff --git a/apisix/plugins/hmac-auth.lua b/apisix/plugins/hmac-auth.lua
index 97dda11fe..6c53a6f40 100644
--- a/apisix/plugins/hmac-auth.lua
+++ b/apisix/plugins/hmac-auth.lua
@@ -153,16 +153,10 @@ local function generate_signature(ctx, secret_key, params)
               if h == "@request-target" then
                 local request_target = request_method .. " " .. uri
                 core.table.insert(signing_string_items, request_target)
-                core.log.info("canonical_header name:", 
core.json.delay_encode(h))
-                core.log.info("canonical_header value: ",
-                              core.json.delay_encode(request_target))
               end
             else
               core.table.insert(signing_string_items,
                                 h .. ": " .. canonical_header)
-              core.log.info("canonical_header name:", 
core.json.delay_encode(h))
-              core.log.info("canonical_header value: ",
-                            core.json.delay_encode(canonical_header))
             end
         end
     end
diff --git a/apisix/plugins/sls-logger.lua b/apisix/plugins/sls-logger.lua
index aa0b13f5d..320198064 100644
--- a/apisix/plugins/sls-logger.lua
+++ b/apisix/plugins/sls-logger.lua
@@ -142,7 +142,6 @@ local function combine_syslog(entries)
     local items = {}
     for _, entry in ipairs(entries) do
         table.insert(items, entry.data)
-        core.log.info("buffered logs:", entry.data)
     end
 
     return table.concat(items)
@@ -185,7 +184,6 @@ function _M.log(conf, ctx)
     }
     local rf5424_data = rf5424.encode("SYSLOG", "INFO", ctx.var.host, "apisix",
                                       ctx.var.pid, json_str, structured_data)
-    core.log.info("collect_data:" .. rf5424_data)
     local process_context = {
         data = rf5424_data,
         route_conf = conf
diff --git a/apisix/plugins/tcp-logger.lua b/apisix/plugins/tcp-logger.lua
index 45d44ae14..d2cf97874 100644
--- a/apisix/plugins/tcp-logger.lua
+++ b/apisix/plugins/tcp-logger.lua
@@ -101,7 +101,6 @@ local function send_tcp_data(conf, log_message)
     sock:settimeout(conf.timeout)
 
     core.log.info("sending a batch logs to ", conf.host, ":", conf.port)
-    core.log.info("sending log_message: ", log_message)
 
     local ok, err = sock:connect(conf.host, conf.port)
     if not ok then
diff --git a/apisix/plugins/udp-logger.lua b/apisix/plugins/udp-logger.lua
index 2b3e75149..2ea049777 100644
--- a/apisix/plugins/udp-logger.lua
+++ b/apisix/plugins/udp-logger.lua
@@ -93,7 +93,6 @@ local function send_udp_data(conf, log_message)
     sock:settimeout(conf.timeout * 1000)
 
     core.log.info("sending a batch logs to ", conf.host, ":", conf.port)
-    core.log.info("sending log_message: ", log_message)
 
     local ok, err = sock:setpeername(conf.host, conf.port)
 
diff --git a/t/plugin/sls-logger.t b/t/plugin/sls-logger.t
index febbea289..ce3c7c558 100644
--- a/t/plugin/sls-logger.t
+++ b/t/plugin/sls-logger.t
@@ -27,6 +27,19 @@ add_block_preprocessor(sub {
         $block->set_value("request", "GET /t");
     }
 
+        my $extra_init_by_lua = <<_EOC_;
+    local bp_manager = require("apisix.utils.batch-processor-manager")
+    local core = require("apisix.core")
+    local old_f = bp_manager.add_entry_to_new_processor
+    bp_manager.add_entry_to_new_processor = function(self, conf, entry, ctx, 
func, max_pending_entries)
+        ngx.log(ngx.INFO, "batch_entry: ", entry.data or 
core.json.encode(entry))
+        return old_f(self, conf, entry, ctx, func, max_pending_entries)
+    end
+_EOC_
+
+    if (!defined $block->extra_init_by_lua) {
+         $block->set_value("extra_init_by_lua", $extra_init_by_lua);
+    }
 });
 
 run_tests();
diff --git a/t/plugin/tcp-logger.t b/t/plugin/tcp-logger.t
index b3c29ee51..76aca2112 100644
--- a/t/plugin/tcp-logger.t
+++ b/t/plugin/tcp-logger.t
@@ -19,6 +19,29 @@ use t::APISIX 'no_plan';
 repeat_each(1);
 no_long_string();
 no_root_location();
+
+add_block_preprocessor(sub {
+    my ($block) = @_;
+
+    if (!defined $block->request) {
+        $block->set_value("request", "GET /t");
+    }
+
+        my $extra_init_by_lua = <<_EOC_;
+    local bp_manager = require("apisix.utils.batch-processor-manager")
+    local core = require("apisix.core")
+    local old_f = bp_manager.add_entry_to_new_processor
+    bp_manager.add_entry_to_new_processor = function(self, conf, entry, ctx, 
func, max_pending_entries)
+        ngx.log(ngx.INFO, "batch_entry: ", core.json.encode(entry))
+        return old_f(self, conf, entry, ctx, func, max_pending_entries)
+    end
+_EOC_
+
+    if (!defined $block->extra_init_by_lua) {
+         $block->set_value("extra_init_by_lua", $extra_init_by_lua);
+    }
+});
+
 run_tests;
 
 __DATA__
diff --git a/t/plugin/udp-logger.t b/t/plugin/udp-logger.t
index b20248b19..da81fcb49 100644
--- a/t/plugin/udp-logger.t
+++ b/t/plugin/udp-logger.t
@@ -19,6 +19,29 @@ use t::APISIX 'no_plan';
 repeat_each(1);
 no_long_string();
 no_root_location();
+
+add_block_preprocessor(sub {
+    my ($block) = @_;
+
+    if (!defined $block->request) {
+        $block->set_value("request", "GET /t");
+    }
+
+        my $extra_init_by_lua = <<_EOC_;
+    local bp_manager = require("apisix.utils.batch-processor-manager")
+    local core = require("apisix.core")
+    local old_f = bp_manager.add_entry_to_new_processor
+    bp_manager.add_entry_to_new_processor = function(self, conf, entry, ctx, 
func, max_pending_entries)
+        ngx.log(ngx.INFO, "batch_entry: ", core.json.encode(entry))
+        return old_f(self, conf, entry, ctx, func, max_pending_entries)
+    end
+_EOC_
+
+    if (!defined $block->extra_init_by_lua) {
+         $block->set_value("extra_init_by_lua", $extra_init_by_lua);
+    }
+});
+
 run_tests;
 
 __DATA__

Reply via email to