fix(admin): strip SSL private keys array in GET single and list responses#13227
Open
AlinsRan wants to merge 1 commit intoapache:masterfrom
Open
fix(admin): strip SSL private keys array in GET single and list responses#13227AlinsRan wants to merge 1 commit intoapache:masterfrom
AlinsRan wants to merge 1 commit intoapache:masterfrom
Conversation
…nses
Admin API GET /apisix/admin/ssls/{id} cleared the `key` field (single-cert
private key) but left the `keys` array (multi-cert private keys) intact.
The list response (GET /apisix/admin/ssls) did not sanitize either `key` or
`keys` at all.
- Strip `keys = nil` alongside `key = nil` in single-resource GET
- Add list response sanitization loop stripping both `key` and `keys` from
every item
d22e2f3 to
9c1b71e
Compare
nic-6443
approved these changes
Apr 16, 2026
Baoyuantop
approved these changes
Apr 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two security fixes for the Admin API SSL resource handler.
Fix 1: Admin API SSL GET single response exposes
keysarrayGET /apisix/admin/ssls/{id}cleared thekeyfield (single-cert private key) but left thekeysarray (multi-cert private keys) intact, so callers retrieving a multi-cert SSL object received all additional private keys in plain text.Root cause: The sanitization block only set
value.key = niland did not touchvalue.keys.Fix: Set
value.keys = nilalongsidevalue.key = nilin the single-resource GET path.Fix 2: Admin API SSL list response does not sanitize private keys at all
GET /apisix/admin/ssls(range / list query) returned every item'skeyandkeysfields without any sanitization.Root cause: The sanitization logic only ran on
res.body.node.value(single-item path); the list path (res.body.list) was never covered.Fix: After the single-item sanitization block, add a loop over
res.body.listthat strips bothkeyandkeysfrom every item'svalue.Changes
apisix/admin/resource.lua: stripkeys = nilin single GET; add list sanitization loop for bothkeyandkeyst/admin/ssl.t: TEST 24 verifieskeysis absent in single GET; TEST 25 verifies both fields absent in list GET; TEST 26 cleans upTests
keynorkeysappears in the response body.keynorkeysis present.