Commit 80464fb
fix(presets): re-validate catalog URL after redirects (HTTPS parity)
PresetCatalog._fetch_single_catalog opened the catalog URL and trusted the
payload without re-validating response.geturl() after redirects. _open_url
follows redirects (stripping auth only on an HTTPS->HTTP downgrade), so an
https:// catalog entry that 30x-redirects to http://attacker/... was still
fetched and trusted. The catalog payload supplies each preset's download_url +
sha256, so a redirected payload can drive install of an arbitrary archive that
passes verify_archive_sha256.
Add the post-redirect geturl() re-validation via _validate_catalog_url,
mirroring integrations/catalog.py, workflows/catalog.py, and bundler adapters —
and presets/_commands.py, which already does this on its --from download path.
This is the lone preset catalog-fetch site missing the guard.
Test: an HTTPS URL whose response.geturl() reports http:// is rejected
(PresetValidationError). Completed four existing fetch-test mocks that predated
this behavior to report geturl() like a real urllib response.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent faeb956 commit 80464fb
2 files changed
Lines changed: 49 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2187 | 2187 | | |
2188 | 2188 | | |
2189 | 2189 | | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
| 2196 | + | |
| 2197 | + | |
| 2198 | + | |
| 2199 | + | |
2190 | 2200 | | |
2191 | 2201 | | |
2192 | 2202 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1754 | 1754 | | |
1755 | 1755 | | |
1756 | 1756 | | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
1757 | 1790 | | |
1758 | 1791 | | |
1759 | 1792 | | |
| |||
1787 | 1820 | | |
1788 | 1821 | | |
1789 | 1822 | | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
1790 | 1826 | | |
1791 | 1827 | | |
1792 | 1828 | | |
| |||
1856 | 1892 | | |
1857 | 1893 | | |
1858 | 1894 | | |
| 1895 | + | |
1859 | 1896 | | |
1860 | 1897 | | |
1861 | 1898 | | |
| |||
2101 | 2138 | | |
2102 | 2139 | | |
2103 | 2140 | | |
| 2141 | + | |
2104 | 2142 | | |
2105 | 2143 | | |
2106 | 2144 | | |
| |||
2153 | 2191 | | |
2154 | 2192 | | |
2155 | 2193 | | |
| 2194 | + | |
2156 | 2195 | | |
2157 | 2196 | | |
2158 | 2197 | | |
| |||
0 commit comments