Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e0f5e7f

Browse filesBrowse files
committed
[AMQP] [Messenger] Do not leak any credentials when connection fails
I noticed that when the connection to AMQP fails for whatever reason all the DSK credentials are leaked. Yes, the password is masked. But it still leaks the server, port and username. I think these things should be private and not be logged to a logger server or error capture service.
1 parent 9a2b25d commit e0f5e7f
Copy full SHA for e0f5e7f

File tree

Expand file treeCollapse file tree

2 files changed

+3
-7
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+3
-7
lines changed

‎src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/ConnectionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/ConnectionTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,10 +559,10 @@ public function testItDelaysTheMessageWithADifferentRoutingKeyAndTTLs()
559559
$connection->publish('{}', [], 120000);
560560
}
561561

562-
public function testObfuscatePasswordInDsn()
562+
public function testNoCredentialLeakageWhenConnectionFails()
563563
{
564564
$this->expectException(\AMQPException::class);
565-
$this->expectExceptionMessage('Could not connect to the AMQP server. Please verify the provided DSN. ({"host":"localhost","port":5672,"vhost":"/","login":"user","password":"********"})');
565+
$this->expectExceptionMessage('Could not connect to the AMQP server. Please verify the provided DSN.');
566566
$factory = new TestAmqpFactory(
567567
$amqpConnection = $this->createMock(\AMQPConnection::class),
568568
$amqpChannel = $this->createMock(\AMQPChannel::class),

‎src/Symfony/Component/Messenger/Bridge/Amqp/Transport/Connection.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Bridge/Amqp/Transport/Connection.php
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -495,11 +495,7 @@ public function channel(): \AMQPChannel
495495
try {
496496
$connection->{$connectMethod}();
497497
} catch (\AMQPConnectionException $e) {
498-
$credentials = $this->connectionOptions;
499-
$credentials['password'] = '********';
500-
unset($credentials['delay']);
501-
502-
throw new \AMQPException(sprintf('Could not connect to the AMQP server. Please verify the provided DSN. (%s).', json_encode($credentials, \JSON_UNESCAPED_SLASHES)), 0, $e);
498+
throw new \AMQPException('Could not connect to the AMQP server. Please verify the provided DSN.', 0, $e);
503499
}
504500
$this->amqpChannel = $this->amqpFactory->createChannel($connection);
505501

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.