Commit bb9422c
authored
Fix/tests (#2526)
* Add test reproducing the issue - test mocks https://some.com/image.png returning 302 Location: http://169.254.169.254/latest/meta-data, then expects load_image_from_url() to reject it before fetching the redirected URL. current code follows the redirect and decodes the mocked image bytes (resulting in test failure)
* tests
* test
* fix
* Secure URL image redirects against SSRF
* test
* revert
* Harden image URL loading against SSRF
Disable automatic redirects for URL image fetches, reject hosts that resolve to
non-public addresses by default, and add an opt-in env flag for deployments that
intentionally load images from private networks. Add unit coverage for redirect
blocking, metadata-address DNS resolution, and the private-network override.
* fix unrelated test
* remove stale test
* keep only tests
* remove1 parent d1dd1c3 commit bb9422c
1 file changed
Lines changed: 3 additions & 2 deletions
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
| 35 | + | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
| 42 | + | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
0 commit comments