fix: when only tls.verify, skip the logic of judging client cert#12527
Merged
SkyeYoung merged 5 commits intoapache:masterfrom Aug 22, 2025
Merged
fix: when only tls.verify, skip the logic of judging client cert#12527SkyeYoung merged 5 commits intoapache:masterfrom
tls.verify, skip the logic of judging client cert#12527SkyeYoung merged 5 commits intoapache:masterfrom
Conversation
tls.verifytls.verify
tls.verifytls.verify, skip the logic of judging cert.
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where non-Kafka HTTPS/gRPCS upstreams were incorrectly processing TLS certificate logic when only tls.verify was specified. The change ensures that certificate-related processing is only triggered when actual client certificates are provided.
- Modifies the TLS processing condition to check for the presence of
client_certorclient_cert_idrather than just the existence of thetlsobject - Adds comprehensive test coverage for the
tls.verify-only scenario - Updates documentation to clarify that
tls.verifyis currently only supported for Kafka upstreams
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| apisix/upstream.lua | Updates condition to skip certificate processing when only tls.verify is present |
| t/node/upstream-mtls.t | Adds test cases for tls.verify-only and combined scenarios |
| t/core/schema_def.t | Adds schema validation test for tls.verify property |
| docs/en/latest/admin-api.md | Documents the tls.verify property with Kafka limitation |
| docs/zh/latest/admin-api.md | Documents the tls.verify property with Kafka limitation in Chinese |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
tls.verify, skip the logic of judging cert.tls.verify, skip the logic of judging client cert
bzp2010
reviewed
Aug 21, 2025
nic-6443
approved these changes
Aug 22, 2025
Baoyuantop
approved these changes
Aug 22, 2025
jizhuozhi
pushed a commit
to jizhuozhi/apisix
that referenced
this pull request
Oct 18, 2025
…pache#12527) * fix: judge cert in tls to avoid only `tls.verify` * docs(admin-api): add missing tls.verify * docs: typo * test: add tls.verify only cases * test: adjust cases
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.
Description
In #7046, a
tls.verifyproperty, only applicable to Kafka, was added to the upstream schema without being documented or reflected in the API. There's also a lack of handling for this property in other resources that use upstream.So in this PR, I've added that when using non-Kafka HTTPS or gRPCs upstream, the client certificate related processing logic should be skipped when only
tls.verify.Considering that only the parts below in reference tls, and there are no filter-like functions provided by Lua, it's changed to check for the existence of
tls.client_cert_idortls.client_cert.apisix/apisix/upstream.lua
Lines 265 to 273 in 0dde705
Which issue(s) this PR fixes:
Fixes #12501
Checklist