-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Current Behavior
Schema does not allow using secret/env variables in SSL Client CA value.
curl http://127.0.0.1:9180/apisix/admin/ssls/1 -H "X-API-KEY: REDACTED" -X PUT -d '
{
"cert" : "$env://SERVER_CERT",
"key": "$env://SERVER_KEY",
"snis": ["example.com"],
"client": {
"ca": "$env://CA_CERT"
},
"ssl_protocols": [
"TLSv1.2",
"TLSv1.3"
]
}'
{"error_msg":"invalid configuration: property \"client\" validation failed: property \"ca\" validation failed: string too short, expected at least 128, got 18"}
Line 841 in 2500db7
| ca = certificate_scheme, |
I can prepare a PR.
Expected Behavior
ADC schema allows secret var (secret, env) in this property.
I would expect APISIX to process this value as well. Current implementation via secret.fetch_secrets should already work.
https://github.com/api7/adc/blob/main/schema.json#L1129
"client": {
"type": "object",
"properties": {
"ca": {
"anyOf": [
{
"type": "string",
"minLength": 128,
"maxLength": 65536
},
{
"type": "string",
"pattern": "^\\$(secret|env):\\/\\/"
}
]
},
...
APISIX should allow certificate_scheme and secret_uri_schema.
Line 771 in 2500db7
| local secret_uri_schema = { |
{
type = "array",
items = {
oneOf = {
certificate_scheme,
secret_uri_schema
}
}
},
Error Logs
{"error_msg":"invalid configuration: property "client" validation failed: property "ca" validation failed: string too short, expected at least 128, got 18"}
Steps to Reproduce
Try to create SSL object with "$env://" as client ca value.
curl http://127.0.0.1:9180/apisix/admin/ssls/1 -H "X-API-KEY: REDACTED" -X PUT -d '
{
"cert" : "$env://SERVER_CERT",
"key": "$env://SERVER_KEY",
"snis": ["example.com"],
"client": {
"ca": "$env://CA_CERT"
},
"ssl_protocols": [
"TLSv1.2",
"TLSv1.3"
]
}'
Environment
- APISIX version (run
apisix version): 3.15.0 - Operating system (run
uname -a): Ubuntu - OpenResty / Nginx version (run
openresty -Vornginx -V): penresty/1.27.1.2 - etcd version, if relevant (run
curl http://127.0.0.1:9090/v1/server_info): - - APISIX Dashboard version, if relevant: -
- Plugin runner version, for issues related to plugin runners: -
- LuaRocks version, for installation issues (run
luarocks --version): -
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
🏗 In progress