bhuvan-somisetty opened a new pull request, #14057:
URL: https://github.com/apache/apisix/pull/14057

   ### Description
   
   In `verify_https_client(ctx)` (`apisix/init.lua`), `local matched_ssl = 
ngx.ctx.matched_ssl` is read and immediately indexed via 
`matched_ssl.value.client` without checking whether `matched_ssl` or 
`matched_ssl.value` is nil.
   
   When an HTTPS request arrives without a matching custom SSL configuration in 
APISIX (for example, falling back to default certificates configured via Nginx 
directives or when connecting to an unknown SNI / IP), `ngx.ctx.matched_ssl` is 
`nil`. This causes a runtime crash:
   ```text
   attempt to index local 'matched_ssl' (a nil value)
   ```
   and aborts request handling with HTTP 500.
   
   This patch adds nil guards for `matched_ssl` and `matched_ssl.value` before 
accessing `matched_ssl.value.client`.
   
   #### Which issue(s) this PR fixes:
   Fixes #14056
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [x] I have verified that this change is backward compatible (If not, 
please discuss on the [APISIX mailing 
list](https://github.com/apache/apisix/tree/master#community) first)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to