membphis commented on code in PR #12629:
URL: https://github.com/apache/apisix/pull/12629#discussion_r2389863999


##########
apisix/consumer.lua:
##########
@@ -244,11 +245,25 @@ local function fill_consumer_secret(consumer)
 end
 
 
-function create_consume_cache(consumers_conf, key_attr)
+function create_consume_cache(plugin_name, consumers_conf, key_attr)
     local consumer_names = {}
 
     for _, consumer in ipairs(consumers_conf.nodes) do
-        core.log.info("consumer node: ", core.json.delay_encode(consumer))

Review Comment:
   can we just remove this line? which is easier to implement



##########
apisix/plugins/hmac-auth.lua:
##########
@@ -130,8 +133,11 @@ local function get_consumer(key_id)
     if not cur_consumer then
         return nil, err or "Invalid key_id"
     end
-    core.log.info("consumer: ", core.json.delay_encode(consumer, true))
 
+    core.log.info("consumer: ", core.json.delay_encode(consumer, true, 
function (cur_consumer)

Review Comment:
   ditto



##########
apisix/init.lua:
##########
@@ -267,7 +269,27 @@ local function parse_domain_in_route(route)
     resource.set_nodes_ver_and_nodes(route.value.upstream.resource_key,
                                                     nodes_ver, new_nodes)
     core.log.info("parse route which contain domain: ",
-                  core.json.delay_encode(route, true))
+                core.json.delay_encode(route, true, function (route)

Review Comment:
   same issue, we can remove this `core.log.info`



##########
apisix/plugin.lua:
##########
@@ -733,14 +735,33 @@ local function merge_consumer_route(route_conf, 
consumer_conf, consumer_group_co
         new_route_conf.value.plugins[name] = conf
     end
 
-    core.log.info("merged conf : ", core.json.delay_encode(new_route_conf))
     return new_route_conf
 end
 
 
 function _M.merge_consumer_route(route_conf, consumer_conf, 
consumer_group_conf, api_ctx)
     core.log.info("route conf: ", core.json.delay_encode(route_conf))
-    core.log.info("consumer conf: ", core.json.delay_encode(consumer_conf))
+    core.log.info("consumer conf: ", core.json.delay_encode(consumer_conf, 
false,

Review Comment:
   ditto



##########
apisix/plugins/hmac-auth.lua:
##########
@@ -111,13 +111,16 @@ end
 
 
 function _M.check_schema(conf, schema_type)
-    core.log.info("input conf: ", core.json.delay_encode(conf))
-
+    local cur_schema
+    local conf_to_log = conf
     if schema_type == core.schema.TYPE_CONSUMER then
-        return core.schema.check(consumer_schema, conf)
+        cur_schema = consumer_schema
+        conf_to_log = core.utils.redact_encrypted(conf, consumer_schema)
     else
-        return core.schema.check(schema, conf)
+        cur_schema = schema
     end
+    core.log.info("input conf: ", core.json.delay_encode(conf_to_log, false))

Review Comment:
   ditto



##########
apisix/plugins/basic-auth.lua:
##########
@@ -160,7 +161,7 @@ end
 
 
 function _M.rewrite(conf, ctx)
-    core.log.info("plugin access phase, conf: ", core.json.delay_encode(conf))
+    core.log.info("plugin access phase, conf: ", core.json.delay_encode(conf, 
false))

Review Comment:
   ditto



##########
apisix/core/json.lua:
##########
@@ -22,6 +22,7 @@
 local cjson = require("cjson.safe")
 local json_encode = cjson.encode
 local clear_tab = require("table.clear")
+local table = require("apisix.core.table")

Review Comment:
   we do not need to update this library if we only remove some `core.log(....)`



##########
apisix/plugin.lua:
##########
@@ -885,8 +906,19 @@ end
 
 
 local function check_single_plugin_schema(name, plugin_conf, schema_type, 
skip_disabled_plugin)
+    local ok, plugin = pcall(require, "apisix.plugins."..name)
+    local redacted_plugin_conf = plugin_conf
+    if ok then
+        local schema
+        if plugin.type == "auth" then
+            schema = plugin.consumer_schema
+        else
+            schema = plugin.schema
+        end
+        redacted_plugin_conf = redact_encrypted(plugin_conf, schema)
+    end
     core.log.info("check plugin schema, name: ", name, ", configurations: ",
-        core.json.delay_encode(plugin_conf, true))
+        core.json.delay_encode(redacted_plugin_conf, true))

Review Comment:
   ditto



##########
apisix/plugins/jwe-decrypt.lua:
##########
@@ -174,8 +175,16 @@ local function get_consumer(key)
     if not consumers then
         return nil
     end
-    core.log.info("consumers: ", core.json.delay_encode(consumers))
-    return consumers[key]
+    local consumer = consumers[key]

Review Comment:
   ditto



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to