Commit bfaa483
committed
feature #62230 [Messenger] Support signing messages per handler (nicolas-grekas)
This PR was merged into the 7.4 branch.
Discussion
----------
[Messenger] Support signing messages per handler
| Q | A
| ------------- | ---
| Branch? | 7.4
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Issues | -
| License | MIT
At the moment, if one is able to inject a forged payload into a queue, one can trigger any handler via the messenger consumer, including eg `RunProcessHandler`. This is not a security issue in Symfony itself because queues should be protected from arbitrary payload injection. But it'd still be nice to harden this.
This PR adds a new `sign` attribute to the `messenger.message_handler` DI tag (which can be set either via explicit config or via `#[AsMessageHandler]`).
When at least one handler does so, a `SigningSerializer` decorator is added to all transport serializers. This then computes the signature when encoding a message bound to such handlers, and verifies it when decoding one.
The `sign` attribute is enabled for `RunProcessHandler` and `RunCommandHandler`, and can be for any others of yours.
Submitting for 7.4 as having a hardened LTS looks important to me.
Commits
-------
21c5ac56aca [Messenger] Support signing messages per handlerFile tree
5 files changed
+76
-12
lines changed- DependencyInjection
- Resources/config
- Tests/DependencyInjection
5 files changed
+76
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2556 | 2556 | | |
2557 | 2557 | | |
2558 | 2558 | | |
| 2559 | + | |
2559 | 2560 | | |
2560 | 2561 | | |
2561 | 2562 | | |
| |||
2572 | 2573 | | |
2573 | 2574 | | |
2574 | 2575 | | |
| 2576 | + | |
2575 | 2577 | | |
2576 | 2578 | | |
2577 | 2579 | | |
| |||
2599 | 2601 | | |
2600 | 2602 | | |
2601 | 2603 | | |
2602 | | - | |
2603 | | - | |
2604 | | - | |
| 2604 | + | |
| 2605 | + | |
2605 | 2606 | | |
2606 | | - | |
2607 | | - | |
2608 | | - | |
| 2607 | + | |
| 2608 | + | |
2609 | 2609 | | |
2610 | 2610 | | |
2611 | 2611 | | |
| |||
2616 | 2616 | | |
2617 | 2617 | | |
2618 | 2618 | | |
2619 | | - | |
| 2619 | + | |
2620 | 2620 | | |
2621 | 2621 | | |
2622 | 2622 | | |
| |||
2645 | 2645 | | |
2646 | 2646 | | |
2647 | 2647 | | |
| 2648 | + | |
| 2649 | + | |
| 2650 | + | |
| 2651 | + | |
| 2652 | + | |
| 2653 | + | |
| 2654 | + | |
| 2655 | + | |
| 2656 | + | |
| 2657 | + | |
| 2658 | + | |
| 2659 | + | |
2648 | 2660 | | |
2649 | 2661 | | |
2650 | 2662 | | |
| |||
2943 | 2955 | | |
2944 | 2956 | | |
2945 | 2957 | | |
2946 | | - | |
| 2958 | + | |
2947 | 2959 | | |
2948 | 2960 | | |
2949 | 2961 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
410 | | - | |
| 410 | + | |
411 | 411 | | |
412 | 412 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
| 51 | + | |
49 | 52 | | |
50 | 53 | | |
51 | 54 | | |
52 | | - | |
53 | | - | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| |||
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
82 | 99 | | |
83 | 100 | | |
84 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
425 | 426 | | |
426 | 427 | | |
427 | 428 | | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
428 | 463 | | |
429 | 464 | | |
430 | 465 | | |
| |||
0 commit comments