Commit d166ece
authored
fix: keep a stranger on the relay, where the protocols already refuse them (#71)
`/ablage/sync/1.0.0` is gated by the admission dialog, and for a while that was
believed to cover everything. It does not: bitswap is a second protocol on the
same node and serves any block it holds to anyone who names the address. That
is #43, and it was measured rather than argued.
What could not be settled at the time was why. `@helia/bitswap` registers its
handler with `runOnLimitedConnection: false`, so a relayed connection should
already have been refused - and the first reading said the leak happened over
one anyway, concluding it was older than DCUtR.
That reading was wrong, and the `holePunch: false` switch from #66 is what
settles it. With no DCUtR and no `/webrtc` address the circuit is the only path
two peers can have, and an unadmitted read over it times out. So the earlier
`limited: true` observation was a second, unlimited connection standing beside
the one being reported.
The hole is the upgrade, not the circuit. A stranger is refused for as long as
they are stuck on the relay and served the moment DCUtR gets them off it,
because a direct connection is unlimited and every protocol on the node becomes
reachable at once.
So `peer.js` closes a direct connection to a peer that was neither scanned nor
admitted. Narrow on purpose: it inherits every gate the relayed path already
has, instead of adding a second list of protocols to keep in step.
Two things had to be narrowed before it was right, and both were the same
mistake - a guard aimed at strangers hitting our own people first.
It closed the relay connection. The relay is unlimited, and a peer this node
has no relationship with by construction. Discovery went with it and neither
peer heard the other at all. Only `/webrtc` is a link to another browser;
everything else is infrastructure.
It closed scanned peers. `acceptOffer` and `acceptAnswer` recorded the scan
*after* the call that establishes the connection, so `connection:open` fired
first and a connection that existed because somebody scanned a code looked
exactly like a stranger's. Ten QR specs failed there. The scan is recorded
before the session call now, still only after `decodePayload` verifies the
signature - an unverifiable code was never consent and still is not.
Three specs, and the mutation check shows they test three things: disable the
guard and only the third fails.
a stranger over a direct connection reads - the protocol hole, unchanged
a stranger with only a circuit reads nothing
a stranger with the hole punch available never gets the direct connection
171 unit tests, 443 browser tests green.
Withdrawal is split out as #70: somebody admitted once keeps every address they
saw, and taking that back needs the blocks to be useless without a key.1 parent ae660a5 commit d166ece
7 files changed
Lines changed: 281 additions & 27 deletions
File tree
- src
- app
- test/browser
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
481 | 491 | | |
482 | 492 | | |
483 | 493 | | |
| |||
903 | 913 | | |
904 | 914 | | |
905 | 915 | | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
906 | 924 | | |
907 | 925 | | |
908 | 926 | | |
| |||
1031 | 1049 | | |
1032 | 1050 | | |
1033 | 1051 | | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
1034 | 1056 | | |
1035 | 1057 | | |
1036 | 1058 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | | - | |
| 177 | + | |
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
196 | 202 | | |
197 | 203 | | |
198 | 204 | | |
| |||
263 | 269 | | |
264 | 270 | | |
265 | 271 | | |
266 | | - | |
| 272 | + | |
267 | 273 | | |
268 | 274 | | |
269 | 275 | | |
270 | 276 | | |
271 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
272 | 288 | | |
273 | 289 | | |
274 | 290 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
150 | 163 | | |
151 | 164 | | |
152 | 165 | | |
| |||
316 | 329 | | |
317 | 330 | | |
318 | 331 | | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
319 | 416 | | |
320 | 417 | | |
321 | 418 | | |
| |||
503 | 600 | | |
504 | 601 | | |
505 | 602 | | |
506 | | - | |
| 603 | + | |
507 | 604 | | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
| 605 | + | |
519 | 606 | | |
520 | 607 | | |
521 | 608 | | |
522 | 609 | | |
| 610 | + | |
| 611 | + | |
523 | 612 | | |
524 | 613 | | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
525 | 617 | | |
526 | 618 | | |
527 | 619 | | |
| |||
0 commit comments