Skip to content

Commit a01ce80

Browse files
committed
bug #46735 [Messenger] Do not log the message object itself (ajardin)
This PR was merged into the 5.4 branch. Discussion ---------- [Messenger] Do not log the message object itself In order to avoid the leak of sensitive data (e.g. credentials) or the overflow of third-party services. | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | This is a follow-up of #46450 where we had a discussion with @Nyholm about the problems related to the logging of the message object. I'm targeting the `5.4` branch as we see this change as a (security ?) fix rather than a new feature. Commits ------- f1604e6 [Messenger] Do not log the message object itself
2 parents b3c1841 + f1604e6 commit a01ce80

File tree

4 files changed

+0
-4
lines changed

4 files changed

+0
-4
lines changed

src/Symfony/Component/Messenger/EventListener/SendFailedMessageForRetryListener.php

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ public function onMessageFailed(WorkerMessageFailedEvent $event)
5656

5757
$message = $envelope->getMessage();
5858
$context = [
59-
'message' => $message,
6059
'class' => \get_class($message),
6160
];
6261

src/Symfony/Component/Messenger/Middleware/HandleMessageMiddleware.php

-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ public function handle(Envelope $envelope, StackInterface $stack): Envelope
5353
$message = $envelope->getMessage();
5454

5555
$context = [
56-
'message' => $message,
5756
'class' => \get_class($message),
5857
];
5958

src/Symfony/Component/Messenger/Middleware/SendMessageMiddleware.php

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public function __construct(SendersLocatorInterface $sendersLocator, EventDispat
4646
public function handle(Envelope $envelope, StackInterface $stack): Envelope
4747
{
4848
$context = [
49-
'message' => $envelope->getMessage(),
5049
'class' => \get_class($envelope->getMessage()),
5150
];
5251

src/Symfony/Component/Messenger/Worker.php

-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ private function ack(): bool
208208
if (null !== $this->logger) {
209209
$message = $envelope->getMessage();
210210
$context = [
211-
'message' => $message,
212211
'class' => \get_class($message),
213212
];
214213
$this->logger->info('{class} was handled successfully (acknowledging to transport).', $context);

0 commit comments

Comments
 (0)