From 869a401c162df7803d422cb8ca96c7f75ae757d8 Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Fri, 2 Sep 2022 13:49:25 +0200 Subject: [PATCH] Mark passwords and URIs as `#[\SensitiveParameter]` (PHP 8.2+) --- src/SshProcessConnector.php | 7 +++++-- src/SshSocksConnector.php | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/SshProcessConnector.php b/src/SshProcessConnector.php index 389c687..603746a 100644 --- a/src/SshProcessConnector.php +++ b/src/SshProcessConnector.php @@ -38,8 +38,11 @@ class SshProcessConnector implements ConnectorInterface * @param ?LoopInterface $loop * @throws \InvalidArgumentException */ - public function __construct($uri, LoopInterface $loop = null) - { + public function __construct( + #[\SensitiveParameter] + $uri, + LoopInterface $loop = null + ) { // URI must use optional ssh:// scheme, must contain host and neither pass nor target must start with dash $parts = \parse_url((\strpos($uri, '://') === false ? 'ssh://' : '') . $uri); $pass = isset($parts['pass']) ? \rawurldecode($parts['pass']) : null; diff --git a/src/SshSocksConnector.php b/src/SshSocksConnector.php index 47e6c7c..969c835 100644 --- a/src/SshSocksConnector.php +++ b/src/SshSocksConnector.php @@ -49,8 +49,11 @@ class SshSocksConnector implements ConnectorInterface * @param ?LoopInterface $loop * @throws \InvalidArgumentException */ - public function __construct($uri, LoopInterface $loop = null) - { + public function __construct( + #[\SensitiveParameter] + $uri, + LoopInterface $loop = null + ) { // URI must use optional ssh:// scheme, must contain host and neither pass nor target must start with dash $parts = \parse_url((\strpos($uri, '://') === false ? 'ssh://' : '') . $uri); $pass = isset($parts['pass']) ? \rawurldecode($parts['pass']) : null;