@@ -57,18 +57,32 @@ final class Server
5757 * @param ?ConnectorInterface $connector
5858 * @param null|array|callable $auth
5959 */
60- public function __construct (LoopInterface $ loop = null , ConnectorInterface $ connector = null , $ auth = null )
61- {
60+ public function __construct (
61+ LoopInterface $ loop = null ,
62+ ConnectorInterface $ connector = null ,
63+ #[\SensitiveParameter]
64+ $ auth = null
65+ ) {
6266 if (\is_array ($ auth )) {
6367 // wrap authentication array in authentication callback
64- $ this ->auth = function ($ username , $ password ) use ($ auth ) {
68+ $ this ->auth = function (
69+ $ username ,
70+ #[\SensitiveParameter]
71+ $ password
72+ ) use ($ auth ) {
6573 return \React \Promise \resolve (
6674 isset ($ auth [$ username ]) && (string )$ auth [$ username ] === $ password
6775 );
6876 };
6977 } elseif (\is_callable ($ auth )) {
7078 // wrap authentication callback in order to cast its return value to a promise
71- $ this ->auth = function ($ username , $ password , $ remote ) use ($ auth ) {
79+ $ this ->auth = function (
80+ $ username ,
81+ #[\SensitiveParameter]
82+ $ password ,
83+ #[\SensitiveParameter]
84+ $ remote
85+ ) use ($ auth ) {
7286 return \React \Promise \resolve (
7387 \call_user_func ($ auth , $ username , $ password , $ remote )
7488 );
@@ -247,7 +261,10 @@ public function handleSocks5(ConnectionInterface $stream, $auth, StreamReader $r
247261 })->then (function ($ username ) use ($ reader , $ auth , $ stream , &$ remote ) {
248262 return $ reader ->readByte ()->then (function ($ length ) use ($ reader ) {
249263 return $ reader ->readLength ($ length );
250- })->then (function ($ password ) use ($ username , $ auth , $ stream , &$ remote ) {
264+ })->then (function (
265+ #[\SensitiveParameter]
266+ $ password
267+ ) use ($ username , $ auth , $ stream , &$ remote ) {
251268 // username and password given => authenticate
252269
253270 // prefix username/password to remote URI
0 commit comments