Skip to content

fix: enforce negotiated TLS peer-close policy - #15

Merged
kentbull merged 1 commit into
release/v0.6.20from
p0/tls-peer-close-policy-v0.6.20
Aug 27, 2026
Merged

kentbull merged 1 commit into
release/v0.6.20from
p0/tls-peer-close-policy-v0.6.20

Conversation

@kentbull

@kentbull kentbull commented Aug 27, 2026 •

Copy link
Copy Markdown
Collaborator

What

  • Apply authenticated peer-close policy using SSLSocket.version().
  • Keep accepted output sendable after TLS 1.3 close_notify.
  • Start reciprocal shutdown after TLS 1.2 close_notify and report the exact stranded-byte count.
  • Fail closed when the negotiated version is missing or unsupported.
  • Drain plaintext buffered by TLS before local unwrap().

Why

TLS 1.2 requires reciprocal closure and discarded pending writes. TLS 1.3 ends only the peer's write direction, leaving local transmission available. Applying one policy to both versions either loses valid output or permits forbidden transmission.

Background

SSLSocket.unwrap() drives OpenSSL shutdown recurrently through WANT states. This PR adds the policy for the version actually negotiated on the connection and keeps accepted-output loss observable.

Boundary

PR #16 fixes a later unwrap() retry race and expands shutdown coverage. HTTP framing, owner deadlines, close invocation, package metadata, and publication remain separate concerns.

Branch clean peer close on SSLSocket.version(). TLS 1.3 preserves accepted output, TLS 1.2 starts reciprocal close_notify immediately and records the exact unsent count, and missing or unknown versions fail closed.

Service already-buffered TLS plaintext before the first local unwrap so shutdown does not strand accepted ingress. Real loopback tests cover both endpoint roles and TLS versions.
@kentbull
kentbull merged commit 35a1c69 into release/v0.6.20 Aug 27, 2026
6 checks passed
@kentbull
kentbull deleted the p0/tls-peer-close-policy-v0.6.20 branch August 27, 2026 11:13
@kentbull

Copy link
Copy Markdown
Collaborator Author

Upstream prerequisite: the recurrent unwrap() shutdown state machine from #14, including truthful close_notify detection and the accepted unsent-output/error contract from #9–#12.

Once that exists, upstream can add negotiated TLS 1.2 versus TLS 1.3 peer-close policy, exact stranded-output reporting, and fail-closed handling for unknown negotiated versions.

@kentbull

Copy link
Copy Markdown
Collaborator Author

Implements the primary downstream fix for ioflo#177: negotiated TLS 1.2 versus TLS 1.3 peer-close policy, exact stranded-output reporting, and fail-closed handling for missing or unsupported negotiated versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant