Skip to content

Commit a33a624

Browse files
authored
Merge pull request #38 from SimonFrings/sensitive_parameter
Mark passwords and URIs as `#[\SensitiveParameter]` (PHP 8.2+)
2 parents d60a5d8 + 869a401 commit a33a624

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/SshProcessConnector.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@ class SshProcessConnector implements ConnectorInterface
3838
* @param ?LoopInterface $loop
3939
* @throws \InvalidArgumentException
4040
*/
41-
public function __construct($uri, LoopInterface $loop = null)
42-
{
41+
public function __construct(
42+
#[\SensitiveParameter]
43+
$uri,
44+
LoopInterface $loop = null
45+
) {
4346
// URI must use optional ssh:// scheme, must contain host and neither pass nor target must start with dash
4447
$parts = \parse_url((\strpos($uri, '://') === false ? 'ssh://' : '') . $uri);
4548
$pass = isset($parts['pass']) ? \rawurldecode($parts['pass']) : null;

src/SshSocksConnector.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ class SshSocksConnector implements ConnectorInterface
4949
* @param ?LoopInterface $loop
5050
* @throws \InvalidArgumentException
5151
*/
52-
public function __construct($uri, LoopInterface $loop = null)
53-
{
52+
public function __construct(
53+
#[\SensitiveParameter]
54+
$uri,
55+
LoopInterface $loop = null
56+
) {
5457
// URI must use optional ssh:// scheme, must contain host and neither pass nor target must start with dash
5558
$parts = \parse_url((\strpos($uri, '://') === false ? 'ssh://' : '') . $uri);
5659
$pass = isset($parts['pass']) ? \rawurldecode($parts['pass']) : null;

0 commit comments

Comments
 (0)