bneradt opened a new pull request, #13974:
URL: https://github.com/apache/trafficserver/pull/13974

   This fixes a regression that two earlier changes create when combined. 
Neither release has it: the first change shipped in 10.2.1, and the second is 
on master and 10.2.x but in no release yet.
   
   ## History
   
   1. **9fbc2bbf1e, "Fix mTLS for TLS resumption scenarios" (#13865, released 
in 10.2.1).** This added `bind_session_id_context_to_verify_scope()`. At the 
end of `ssl_client_hello_callback()`, it binds each inbound connection's 
session id context to its SNI and its client-verify scope: the `verify_client` 
policy and the trust store. A session issued under one scope then cannot resume 
under another, and a client facing a stricter policy or a different CA gets a 
full handshake instead.
   2. **#13799, "Fix TLS callback retries after paused hooks" (milestone 
10.2.2).** When a `TS_EVENT_SSL_CLIENT_HELLO` hook does not reenable inline, 
the callback returns `CLIENT_HELLO_RETRY`, and OpenSSL calls it again once the 
hook reenables. #13799 made that second call return success early, once the 
ClientHello hooks have finished, so the hooks are not dispatched a second time.
   
   ## The regression
   
   These two changes conflict whenever a ClientHello hook pauses. The paused 
pass returns `CLIENT_HELLO_RETRY` before it reaches the bind from 9fbc2bbf1e. 
The pass after the reenable takes the early return from #13799. So the bind 
never runs on that connection.
   
   The result is that a TLS 1.3 session issued for one SNI can resume on 
another SNI whose `verify_client` policy or CA differs, and the request is 
served without that SNI's client certificate check. Before #13799, the retried 
call ran the whole callback and reached the bind, so 10.2.1 behaves correctly.
   
   The regression only appears when some plugin pauses at the ClientHello hook. 
rate_limit's SNI queue does, and so does any plugin that reenables 
asynchronously.
   
   ## The fix
   
   - The early-return path from #13799 now runs 
`bind_session_id_context_to_verify_scope()` before returning success, on 
OpenSSL builds. On BoringSSL the bind runs in the certificate callback, which 
this path does not affect.
   - Renegotiation reaches the second finished-hooks return in the same 
callback and skipped the bind the same way. That path now falls through to the 
bind instead of returning early.
   
   ## Testing
   
   `test_tls_ticket_verify_client_scope` now also runs every case with 
`ssl_hook_test -client_hello=1` loaded, which pauses the ClientHello hook. 
These are the new `paused-client-hello` variants.
   
   - **Without the fix**, both paused variants fail. The session resumes 
(`Reused`) on the SNI that requires the other policy, and the request gets a 
200.
   - **With the fix**, they pass, like the existing variants with no hook.
   
   On master in the Fedora 44 image with the `ci-fedora-urtest` preset:
   
   - ctest: 1345/1345.
   - Uranium: 1489 passed, 1 failed, 39 skipped. The failure is 
`test_h3_python_client`, a flaky access-log assertion that also fails 3 runs in 
6 on master without this change.
   
   This should be backported to 10.2.x along with #13799, before 10.2.2.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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