Skip to content

Commit 6262a10

Browse files
committed
fix: decrypt plugin conf before schema validation in plugin_checker
Reorder plugin_checker to run decrypt_conf before check_schema, matching the gateway's approach. This fixes content-level validation failures (e.g. ai-proxy's service_account_json JSON parsing) when fields are encrypted — the encrypted values are now decrypted back to plaintext before validation runs.
1 parent 99d9d41 commit 6262a10

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

apisix/plugin.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,16 +1170,16 @@ _M.stream_check_schema = stream_check_schema
11701170

11711171
function _M.plugin_checker(item, schema_type)
11721172
if item.plugins then
1173-
local skip_disabled_plugins = not (core.config.type == "yaml" or core.config.type == "json")
1174-
local ok, err = check_schema(item.plugins, schema_type, skip_disabled_plugins)
1175-
1176-
if ok and enable_gde() then
1177-
-- decrypt conf
1173+
if enable_gde() then
1174+
-- decrypt conf before validation so that content-level checks
1175+
-- (e.g. ai-proxy service_account_json JSON parsing) see plaintext
11781176
for name, conf in pairs(item.plugins) do
11791177
decrypt_conf(name, conf, schema_type)
11801178
end
11811179
end
1182-
return ok, err
1180+
1181+
local skip_disabled_plugins = not (core.config.type == "yaml" or core.config.type == "json")
1182+
return check_schema(item.plugins, schema_type, skip_disabled_plugins)
11831183
end
11841184

11851185
return true

0 commit comments

Comments
 (0)