shreemaan-abhishek commented on code in PR #13645:
URL: https://github.com/apache/apisix/pull/13645#discussion_r3518064907
##########
t/admin/plugin-metadata3.t:
##########
@@ -228,3 +228,50 @@ GET /t
--- response_body_like
nil
\{"message":"Key not found"\}
+
+
+
+=== TEST 8: first successful GET decrypts even when enable_data_encryption is
not yet initialized
+--- config
+ location /t {
+ content_by_lua_block {
+ local core = require("apisix.core")
+ local plugin = require("apisix.plugin")
+ local t = require("lib.test_admin").test
+
+ local code, body =
t('/apisix/admin/plugin_metadata/azure-functions',
+ ngx.HTTP_PUT,
+ [[{
+ "master_apikey": "foo"
+ }]]
+ )
+ if code >= 300 then
+ ngx.status = code
+ ngx.say(body)
+ return
+ end
+ ngx.sleep(0.1)
+
+ -- etcd keeps the field encrypted
+ local etcd = require("apisix.core.etcd")
+ local res = assert(etcd.get('/plugin_metadata/azure-functions'))
+ ngx.say("etcd encrypted: ",
tostring(res.body.node.value.master_apikey ~= "foo"))
Review Comment:
Good catch. Tightened in 0c6d9c4a5 to require a non-empty string that
differs from the plaintext, so a missing/empty stored value no longer reads as
"encrypted".
--
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]