openresty / openresty/lua-resty-core
The sslhandshake function does not handle the scenario where ngx_http_lua_ffi_socket_tcp_sslhandshake directly returns FFI_OK.
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 853
- Forks
- 286
- Avg merge
- 35m
- Merged PRs (30d)
- 1
Description
When i test the sslhandshake future,i connect to local machine and i set the ssl_verify future, sometimes it failed in assert check.
log:
/usr/local/openresty/lualib/resty/core/socket.lua:281: assertion failed!
I add some log and found the ngx_http_lua_ffi_socket_tcp_sslhandshake return FFI_OK, when assert failed happen。
I think it should add check FFI_OK:
local rc = C.ngx_http_lua_ffi_socket_tcp_sslhandshake(r, u,
session_ptr[0],
reused_session ~= false,
server_name_str,
ssl_verify and 1 or 0,
send_status_req and 1 or 0,
cosocket[SOCKET_CLIENT_CERT_INDEX],
cosocket[SOCKET_CLIENT_PKEY_INDEX],
errmsg)
if rc == FFI_NO_REQ_CTX then
error("no request ctx found", 2)
end
if rc == FFI_OK then
if reused_session == false then
return true
end
rc = C.ngx_http_lua_ffi_socket_tcp_get_sslhandshake_result(r, u,
session_ptr, errmsg, openssl_error_code)
end
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at /usr/local/openresty/lualib/resty/core/socket.lua around line 281 and inspect the sslhandshake function and its FFI return handling. Reproduce the local SSL handshake with ssl_verify enabled if possible, then verify the FFI_OK path no longer reaches the failing assertion and that the handshake result is handled correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- backend, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100