Repository navigation
Commit a46ad16
fix(consent): stop asking for consent from a policy we failed to fetch (#7766)
* fix(consent): stop asking for consent from a policy we failed to fetch
The consent banner reappears for people who have already answered it. The
policy lookup is a cross-origin call to the consent instance, and that origin
intermittently answers a bot challenge instead: HTTP 403, an HTML body, and
`x-vercel-mitigated: challenge`. A browser fetch cannot solve a JS challenge,
so the runtime substitutes a generic opt-in policy and carries on as though the
lookup succeeded. Because consent records the fingerprint of the policy they
were given under, the substituted policy never matches, the runtime treats it
as a material policy change, clears the stored consent, and asks again — with a
question the visitor's jurisdiction may not even require.
The banner now renders only when the policy was actually resolved. A load that
fell back asks nothing; the next load that reaches the real policy asks if it
still needs to.
The root cause belongs to the consent instance, which should not challenge an
endpoint browsers call over XHR. Reproduced against production: consent given,
cookie present, then one challenged lookup and the banner returns with the
cookie deleted.
Also records why the backend URL must stay cross-origin. The documented
same-origin rewrite would dodge the challenge, but the instance resolves
jurisdiction from the address the request arrives from, and ignores every
forwarding header we could send (measured: x-forwarded-for, x-real-ip,
true-client-ip, cf-connecting-ip, x-vercel-ip-country). Sim has no edge that
supplies a country header, so proxying would resolve every visitor to our own
region and stop asking the EU for consent entirely.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015tTS2kSemtRPmTq9ezGRCc
* fix(consent): keep the explicitly opened dialog working during a fallback
The guard suppressed the whole card, including a dialog the visitor opened from
the Cookie Policy or the footer control. That leaves a published promise —
change your choice at any time — wired to a button that does nothing. Guard the
unsolicited banner only.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015tTS2kSemtRPmTq9ezGRCc
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>1 parent 0f9ecde commit a46ad16
3 files changed
Lines changed: 119 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
32 | 47 | | |
33 | 48 | | |
34 | 49 | | |
35 | 50 | | |
| 51 | + | |
36 | 52 | | |
37 | 53 | | |
| 54 | + | |
38 | 55 | | |
39 | 56 | | |
40 | 57 | | |
41 | 58 | | |
42 | 59 | | |
43 | 60 | | |
44 | 61 | | |
45 | | - | |
| 62 | + | |
46 | 63 | | |
47 | 64 | | |
48 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
17 | 30 | | |
18 | 31 | | |
19 | 32 | | |
| |||
0 commit comments