Skip to content

tls_renegotiation autest: gate the detection-line check to OpenSSL#13371

Merged
moonchen merged 1 commit into
apache:masterfrom
moonchen:mchen/tls-reneg-boringssl
Jul 8, 2026
Merged

tls_renegotiation autest: gate the detection-line check to OpenSSL#13371
moonchen merged 1 commit into
apache:masterfrom
moonchen:mchen/tls-reneg-boringssl

Conversation

@moonchen

@moonchen moonchen commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Problem

The tls_renegotiation.test.py gold test added in #13306 fails on BoringSSL. It passes on OpenSSL, so the ASF CI is green and the gap went unnoticed.

The test's ContainsExpression("trying to renegotiate from the client") asserts on a debug line emitted by ssl_callback_info() in SSLUtils.cc, which lives behind the state == SSL_ST_RENEGOTIATE branch. On BoringSSL that branch is compiled (SSL_ST_RENEGOTIATE is #defined) but never taken: per BoringSSL's ssl.h, SSL_get_state()/SSL_state() "only ever return SSL_ST_INIT or SSL_ST_OK", never SSL_ST_RENEGOTIATE. BoringSSL also rejects a peer-initiated renegotiation inside the library before the callback runs, so ATS never logs the line — the connection is refused safely, but the detection assertion has nothing to match.

Fix

Gate only the detection-line assertion behind Condition.IsOpenSSL(). The crash-safety ExcludesExpression stays unconditional, so BoringSSL keeps that coverage; only the detection-line check is now OpenSSL-only. This mirrors the Condition.IsOpenSSL() pattern already used in tls_async_handshake.test.py. tls_renegotiation_allowed.test.py needs no change — it only asserts on client-side output.

Follow-up (not in this PR)

On BoringSSL the SSL_ST_RENEGOTIATE branch in ssl_callback_info() is effectively dead, so ATS's own renegotiation logging/abort never fires and allow_client_renegotiation=1 is a no-op there. Not a security issue — BoringSSL enforces the refusal regardless — but the branch is misleading and could be cleaned up or wired to a mechanism that actually fires.

BoringSSL rejects a peer-initiated renegotiation inside the library
before ATS's SSL info callback runs -- SSL_get_state() there only ever
returns SSL_ST_INIT or SSL_ST_OK, never SSL_ST_RENEGOTIATE -- so the
"trying to renegotiate from the client" line is never logged and the
ContainsExpression fails on BoringSSL (Apache CI stays green because it
runs OpenSSL). The crash-safety check still runs on every SSL library;
only the detection-line assertion is now OpenSSL-only.
Copilot AI review requested due to automatic review settings July 8, 2026 16:26
@moonchen moonchen self-assigned this Jul 8, 2026
@moonchen moonchen modified the milestones: 10.2.0, 11.0.0 Jul 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a portability issue in the TLS renegotiation gold test by making the “renegotiation detected” log assertion OpenSSL-only, while preserving the cross-library “no crash” safety check so the test remains meaningful on BoringSSL.

Changes:

  • Gate the traffic.out detection-line ContainsExpression("trying to renegotiate from the client") behind Condition.IsOpenSSL().
  • Keep the crash-safety ExcludesExpression("received signal|failed assertion") unconditional for continued BoringSSL coverage.
  • Expand the in-test comment to document why the detection log line is not expected on BoringSSL.

@moonchen
moonchen requested a review from maskit July 8, 2026 16:38
@moonchen
moonchen merged commit 7c4fc5b into apache:master Jul 8, 2026
15 checks passed
@github-project-automation github-project-automation Bot moved this to For v10.2.0 in ATS v10.2.x Jul 8, 2026
@moonchen
moonchen deleted the mchen/tls-reneg-boringssl branch July 8, 2026 18:14
@cmcfarlen cmcfarlen moved this from For v10.2.0 to Picked v10.2.0 in ATS v10.2.x Jul 13, 2026
@cmcfarlen cmcfarlen modified the milestones: 11.0.0, 10.2.0 Jul 13, 2026
@cmcfarlen

Copy link
Copy Markdown
Contributor

Cherry-picked to 10.2.x

cmcfarlen pushed a commit that referenced this pull request Jul 13, 2026
…13371)

BoringSSL rejects a peer-initiated renegotiation inside the library
before ATS's SSL info callback runs -- SSL_get_state() there only ever
returns SSL_ST_INIT or SSL_ST_OK, never SSL_ST_RENEGOTIATE -- so the
"trying to renegotiate from the client" line is never logged and the
ContainsExpression fails on BoringSSL (Apache CI stays green because it
runs OpenSSL). The crash-safety check still runs on every SSL library;
only the detection-line assertion is now OpenSSL-only.

(cherry picked from commit 7c4fc5b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Picked v10.2.0

Development

Successfully merging this pull request may close these issues.

4 participants