Repository navigation
Commit c004672
committed
Let the consent form post without an Origin header
Staging found what the test could not: pressing "İzin ver ve devam et" answered
origin_forbidden. Browsers do not send an Origin header on a same-origin
top-level form submission, and requireAllowedOrigin rejects a missing header.
My end-to-end test set the header by hand, so it verified that the check
passes when the header is present and never measured what the browser actually
sends. Green for the wrong reason, in the exact shape this repo has been
bitten by before.
The consent endpoint now uses its own check: if Origin is present it must
match, and if Sec-Fetch-Site is present it must not be cross-site. A missing
Origin is accepted, which is safe because the dangerous case always carries
one — a form submitted from another site is cross-origin, and browsers have
sent Origin for that for years. The real gate is unchanged and is not this: it
is the CSRF value bound to the session's digest.
The test helper now posts the way a browser does, with no Origin, and the
cases that want the header pass it explicitly. Reverting to
requireAllowedOrigin fails six tests including the new one, which is the proof
the old shape was untested rather than merely unlucky.1 parent 11f16e2 commit c004672
2 files changed
Lines changed: 74 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
146 | 153 | | |
147 | 154 | | |
148 | 155 | | |
149 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
150 | 163 | | |
151 | 164 | | |
152 | 165 | | |
153 | 166 | | |
154 | 167 | | |
155 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
156 | 176 | | |
157 | 177 | | |
158 | 178 | | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
| 179 | + | |
165 | 180 | | |
166 | 181 | | |
167 | 182 | | |
| |||
469 | 484 | | |
470 | 485 | | |
471 | 486 | | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
472 | 510 | | |
473 | 511 | | |
474 | 512 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4006 | 4006 | | |
4007 | 4007 | | |
4008 | 4008 | | |
| 4009 | + | |
| 4010 | + | |
| 4011 | + | |
| 4012 | + | |
| 4013 | + | |
| 4014 | + | |
| 4015 | + | |
| 4016 | + | |
| 4017 | + | |
| 4018 | + | |
| 4019 | + | |
| 4020 | + | |
| 4021 | + | |
| 4022 | + | |
| 4023 | + | |
| 4024 | + | |
| 4025 | + | |
| 4026 | + | |
| 4027 | + | |
| 4028 | + | |
| 4029 | + | |
| 4030 | + | |
| 4031 | + | |
| 4032 | + | |
| 4033 | + | |
| 4034 | + | |
| 4035 | + | |
| 4036 | + | |
4009 | 4037 | | |
4010 | 4038 | | |
4011 | 4039 | | |
| |||
4441 | 4469 | | |
4442 | 4470 | | |
4443 | 4471 | | |
4444 | | - | |
| 4472 | + | |
4445 | 4473 | | |
4446 | 4474 | | |
4447 | 4475 | | |
| |||
0 commit comments