Skip to content

Fix read and alpn_selected returning data from authentication-failed sessions - #136

Merged
SeanTAllen merged 1 commit into
mainfrom
fix-read-and-alpn-auth-fail-guard
Aug 2, 2026
Merged

Fix read and alpn_selected returning data from authentication-failed sessions#136
SeanTAllen merged 1 commit into
mainfrom
fix-read-and-alpn-auth-fail-guard

Conversation

@SeanTAllen

Copy link
Copy Markdown
Member

SSL.read on a session in SSLAuthFail called SSL_read, which returned an error that overwrote _state with SSLError -- losing the distinction between an authentication failure and any other SSL-layer error. SSL.alpn_selected returned the peer-supplied ALPN protocol from the same failed session. SSL.receive accepted ciphertext from a peer whose identity had been rejected.

Guard all three methods so they return immediately when the session has already failed. receive also guards against SSLError, since feeding ciphertext into a session that has failed for any reason is pointless.

Closes #125

@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Aug 2, 2026
@SeanTAllen SeanTAllen changed the title Guard read, alpn_selected, and receive against SSLAuthFail Fix read and alpn_selected returning data from authentication-failed sessions Aug 2, 2026
@SeanTAllen SeanTAllen added the changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge label Aug 2, 2026
…sessions

Calling `read` on a session in `SSLAuthFail` overwrote the state with
`SSLError`, so code that branched on the state to distinguish
authentication failures from other errors lost the distinction after
the first `read`.  Calling `alpn_selected` on the same session
returned the ALPN protocol the rejected peer had negotiated.  Calling
`receive` accepted ciphertext from a peer whose identity had been
rejected.

Guard all three methods so they return immediately when the session
has already failed: `read` and `alpn_selected` return `None`, and
`receive` does nothing.  `receive` also guards against `SSLError`,
since feeding ciphertext into a session that has failed for any reason
is pointless.

Closes #125
@SeanTAllen
SeanTAllen force-pushed the fix-read-and-alpn-auth-fail-guard branch from 208b3ac to 3fef24f Compare August 2, 2026 00:59
@SeanTAllen
SeanTAllen merged commit ee56a6a into main Aug 2, 2026
13 checks passed
@SeanTAllen
SeanTAllen deleted the fix-read-and-alpn-auth-fail-guard branch August 2, 2026 01:02
@ponylang-main ponylang-main removed the discuss during sync Should be discussed during an upcoming sync label Aug 2, 2026
github-actions Bot pushed a commit that referenced this pull request Aug 2, 2026
github-actions Bot pushed a commit that referenced this pull request Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SSL.read returns decrypted application data on a session in SSLAuthFail

2 participants