Add support for SCRAM-SHA-*-PLUS channel binding in PHP streams (e.g., tls-unique, tls-exporter)
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
Hello,
I'm the maintainer of the fabiang/sasl library, which implements various SASL mechanisms. Since many SASL mechanisms have been deprecated over the years due to security issues, I am interested in improving the security of the SCRAM-SHA-* SASL mechanisms.
The SCRAM-SHA-*-PLUS mechanisms offer better security through channel binding. The recommended channel binding types are:
- tls-unique for TLS <= 1.2
- tls-server-end-point
- tls-exporter for TLS >= 1.3
Currently, PHP lacks support for channel binding, as no API is exposed to access data from the underlying secure socket. Additionally, more and more server software is adding support for channel binding.
For example, Python:
- supports at least "tls-unique" through SSLSocket.get_channel_binding
- and has an open Pull Request for tls-exporter.
To enable this in PHP, a simple API to retrieve channel binding data from a stream context would be beneficial.
A potential function could:
- return data from OpenSSL's
SSL_get_peer_finishedwhen channel binding is set to "tls-unique" and TLS 1.2 is used, - use OpenSSL's
SSL_export_keying_materialwhen channel binding is set to "tls-exporter" and TLS <= 1.3 is used, - trigger a warning when "tls-unique" is used with TLS 1.3,
- and trigger an error if the stream or context is not a TLS connection.
(Note: "tls-exporter" should also be supported on TLS 1.2 connections.)
stream_crypto_channel_binding(resource $stream_or_context, string $channel_binding_type): string;
Making this function compatible with both streams and contexts should cover all use cases.
Thank you.
Contributor guide
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 by reviewing the PHP streams and stream-context APIs, then the OpenSSL interfaces named in the issue: SSL_get_peer_finished and SSL_export_keying_material. Done means a documented API can retrieve the requested channel-binding data for TLS streams or contexts and reports the specified unsupported-connection and TLS-version cases; the payload does not name implementation files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, php
- Domain
- api, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100