diff --git a/Tests/Transport/ConnectionTest.php b/Tests/Transport/ConnectionTest.php index c37d896..c2a7063 100644 --- a/Tests/Transport/ConnectionTest.php +++ b/Tests/Transport/ConnectionTest.php @@ -559,10 +559,10 @@ public function testItDelaysTheMessageWithADifferentRoutingKeyAndTTLs() $connection->publish('{}', [], 120000); } - public function testObfuscatePasswordInDsn() + public function testNoCredentialLeakageWhenConnectionFails() { $this->expectException(\AMQPException::class); - $this->expectExceptionMessage('Could not connect to the AMQP server. Please verify the provided DSN. ({"host":"localhost","port":5672,"vhost":"/","login":"user","password":"********"})'); + $this->expectExceptionMessage('Could not connect to the AMQP server. Please verify the provided DSN.'); $factory = new TestAmqpFactory( $amqpConnection = $this->createMock(\AMQPConnection::class), $amqpChannel = $this->createMock(\AMQPChannel::class), diff --git a/Transport/Connection.php b/Transport/Connection.php index e03dc72..1dead15 100644 --- a/Transport/Connection.php +++ b/Transport/Connection.php @@ -495,11 +495,7 @@ public function channel(): \AMQPChannel try { $connection->{$connectMethod}(); } catch (\AMQPConnectionException $e) { - $credentials = $this->connectionOptions; - $credentials['password'] = '********'; - unset($credentials['delay']); - - 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); + throw new \AMQPException('Could not connect to the AMQP server. Please verify the provided DSN.', 0, $e); } $this->amqpChannel = $this->amqpFactory->createChannel($connection);