Repository navigation
Commit a70d75a
authored
transport: block redirects from token server to private/link-local addresses (SSRF fix) (#2292)
* transport: block redirects from token server to private addresses
refreshOauth and refreshBasic constructed http.Client without a
CheckRedirect handler, allowing a malicious token server to issue an
HTTP redirect to an internal address (e.g. 169.254.169.254) that would
pass the initial validateRealmURL check but still reach private services.
Add realmRedirectCheck, which applies the same scheme and private-IP
restrictions as validateRealmURL to every redirect hop during a
token-fetch request. Wire it as CheckRedirect on both clients.
Add TestTokenServerRedirectSSRF to confirm the redirect is rejected.
* transport: address review feedback
- Shorten realmRedirectCheck doc comment.
- Extract allowInsecure local in refreshOauth and refreshBasic.
- Drop redundant inline comment in TestTokenServerRedirectSSRF.
* transport: rename unused handler param to satisfy revive linter1 parent a4da0ed commit a70d75a
2 files changed
Lines changed: 54 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
112 | 126 | | |
113 | 127 | | |
114 | 128 | | |
| |||
378 | 392 | | |
379 | 393 | | |
380 | 394 | | |
381 | | - | |
| 395 | + | |
| 396 | + | |
382 | 397 | | |
383 | 398 | | |
384 | 399 | | |
| |||
415 | 430 | | |
416 | 431 | | |
417 | 432 | | |
418 | | - | |
| 433 | + | |
| 434 | + | |
419 | 435 | | |
420 | 436 | | |
421 | 437 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
560 | 560 | | |
561 | 561 | | |
562 | 562 | | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
563 | 599 | | |
564 | 600 | | |
565 | 601 | | |
| |||
0 commit comments