Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ssl): ssl label upgrade max len #9301

Merged
merged 11 commits into from
May 5, 2023
2 changes: 1 addition & 1 deletion apisix/schema_def.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 40 additions & 0 deletions t/admin/ssl4.t
Original file line number Diff line number Diff line change
Expand Up @@ -364,3 +364,43 @@ location /t {
t.test('/apisix/admin/ssls/1', ngx.HTTP_DELETE)
}
}


Fabriceli marked this conversation as resolved.
Show resolved Hide resolved

=== 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