Commit 785de5e
fix: implement RFC 6265 domain matching in Chrome cookies capability (#84)
The previous implementation built a `LIKE '%.${host}'` pattern, which
only matched cookie host_keys that end in the full request hostname.
Cookies set with an explicit parent Domain attribute (e.g.
`.reddit.com`) were missed when the request URL used a subdomain
(`https://www.reddit.com`), because `.reddit.com` does not end in
`.www.reddit.com`.
Replace with proper RFC 6265 §5.1.3 matching: enumerate all valid
host_key values for a given request host (self host-only, self with
leading dot, each parent domain with leading dot — stopping before bare
TLDs) and query with `IN (...)`.
Verified live against Chrome cookie DB:
- https://reddit.com → 10 cookies, reddit_session present
- https://www.reddit.com → 14 cookies, reddit_session present (includes
extra host-only cookies on www.reddit.com, correctly excluded from
the apex query)
Co-authored-by: Chen <99816898+donteatfriedrice@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent a62a9ec commit 785de5e
2 files changed
Lines changed: 86 additions & 7 deletions
Lines changed: 54 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 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 | + | |
5 | 58 | | |
6 | 59 | | |
7 | 60 | | |
| |||
Lines changed: 32 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
127 | 151 | | |
128 | | - | |
| 152 | + | |
129 | 153 | | |
130 | 154 | | |
131 | 155 | | |
| |||
134 | 158 | | |
135 | 159 | | |
136 | 160 | | |
137 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
138 | 165 | | |
139 | | - | |
| 166 | + | |
140 | 167 | | |
141 | 168 | | |
142 | 169 | | |
| |||
190 | 217 | | |
191 | 218 | | |
192 | 219 | | |
193 | | - | |
194 | | - | |
| 220 | + | |
195 | 221 | | |
196 | 222 | | |
197 | 223 | | |
| |||
0 commit comments