You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by mo...@apache.org on 2023/05/05 01:12:16 UTC

[apisix] branch master updated: fix(ssl): ssl label upgrade max len (#9301)

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

monkeydluffy 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 fc372affa fix(ssl): ssl label upgrade max len (#9301)
fc372affa is described below

commit fc372affa4bf71a6bb3b8d6cae32c03b8b29c771
Author: fabriceli <yi...@hotmail.com>
AuthorDate: Fri May 5 09:12:09 2023 +0800

    fix(ssl): ssl label upgrade max len (#9301)
---
 apisix/schema_def.lua |  2 +-
 t/admin/ssl4.t        | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/apisix/schema_def.lua b/apisix/schema_def.lua
index bae273c96..25c698753 100644
--- a/apisix/schema_def.lua
+++ b/apisix/schema_def.lua
@@ -82,7 +82,7 @@ local label_value_def = {
     description = "value of label",
     type = "string",
     pattern = [[^\S+$]],
-    maxLength = 64,
+    maxLength = 256,
     minLength = 1
 }
 _M.label_value_def = label_value_def
diff --git a/t/admin/ssl4.t b/t/admin/ssl4.t
index dcb18ce39..fe3b8fcae 100644
--- a/t/admin/ssl4.t
+++ b/t/admin/ssl4.t
@@ -364,3 +364,43 @@ location /t {
         t.test('/apisix/admin/ssls/1', ngx.HTTP_DELETE)
     }
 }
+
+
+
+=== TEST 11: set ssl(sni: www.test.com) with long label
+--- yaml_config
+apisix:
+    node_listen: 1984
+    ssl:
+        key_encrypt_salt: null
+--- config
+location /t {
+    content_by_lua_block {
+        local core = require("apisix.core")
+        local t = require("lib.test_admin")
+
+        local ssl_cert = t.read_file("t/certs/apisix.crt")
+        local ssl_key =  t.read_file("t/certs/apisix.key")
+        local data = {cert = ssl_cert, key = ssl_key, sni = "www.test.com",
+                      labels = {secret = "js-design-test-bigdata-data-app-service-router-my-secret-number-123456"}}
+
+        local code, body = t.test('/apisix/admin/ssls/1',
+            ngx.HTTP_PUT,
+            core.json.encode(data),
+            [[{
+                "value": {
+                    "sni": "www.test.com",
+                    "labels": {
+                        "secret": "js-design-test-bigdata-data-app-service-router-my-secret-number-123456"
+                    },
+                },
+                "key": "/apisix/ssls/1"
+            }]]
+            )
+
+        ngx.status = code
+        ngx.say(body)
+    }
+}
+--- response_body
+passed