Commit c1e91c5
committed
bug #62037 Fix generating logout link with stateless csrf (pierredup)
This PR was squashed before being merged into the 7.3 branch.
Discussion
----------
Fix generating logout link with stateless csrf
| Q | A
| ------------- | ---
| Branch? | 7.3
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | N/A
| License | MIT
When using the `logout_path` (or `logout_url`) twig function with stateless csrf, the generator creates a link with an invalid CSRF token parameter (`/logout?_csrf_token=csrf-token`), which then causes an error during logout (`Invalid CSRF token`), since the LogoutListener reads the token from the query parameter first.
Reproducer:
```yaml
framework:
csrf_protection:
stateless_token_ids: ['logout']
```
```twig
<form method="post" action="{{ logout_path() }}">
<input type="hidden" data-controller="csrf-protection" name="_csrf_token" value="{{ csrf_token('logout') }}"/>
<button type="submit">Logout</button>
</form>
```
Commits
-------
9e5e32b Fix generating logout link with stateless csrfFile tree
2 files changed
+45
-1
lines changed- src/Symfony/Component/Security/Http
- Firewall
- Tests/Firewall
2 files changed
+45
-1
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
Lines changed: 44 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
91 | 135 | | |
92 | 136 | | |
93 | 137 | | |
| |||
0 commit comments