Skip to content

Commit e0e834e

Browse files
Merge branch '5.4' into 6.0
* 5.4: Fix tests [HttpKernel] skip test on appveyor [AMQP] [Messenger] Do not leak any credentials when connection fails
2 parents 318d3f7 + a8934a6 commit e0e834e

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

Tests/Transport/ConnectionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,10 +525,10 @@ public function testItDelaysTheMessageWithADifferentRoutingKeyAndTTLs()
525525
$connection->publish('{}', [], 120000);
526526
}
527527

528-
public function testObfuscatePasswordInDsn()
528+
public function testNoCredentialLeakageWhenConnectionFails()
529529
{
530530
$this->expectException(\AMQPException::class);
531-
$this->expectExceptionMessage('Could not connect to the AMQP server. Please verify the provided DSN. ({"host":"localhost","port":5672,"vhost":"/","login":"user","password":"********"})');
531+
$this->expectExceptionMessage('Could not connect to the AMQP server. Please verify the provided DSN.');
532532
$factory = new TestAmqpFactory(
533533
$amqpConnection = $this->createMock(\AMQPConnection::class),
534534
$amqpChannel = $this->createMock(\AMQPChannel::class),

Transport/Connection.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -490,11 +490,7 @@ public function channel(): \AMQPChannel
490490
try {
491491
$connection->{$connectMethod}();
492492
} catch (\AMQPConnectionException $e) {
493-
$credentials = $this->connectionOptions;
494-
$credentials['password'] = '********';
495-
unset($credentials['delay']);
496-
497-
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);
493+
throw new \AMQPException('Could not connect to the AMQP server. Please verify the provided DSN.', 0, $e);
498494
}
499495
$this->amqpChannel = $this->amqpFactory->createChannel($connection);
500496

0 commit comments

Comments
 (0)