import pytest from void_workers.safe_fetch import safe_fetch, SafeFetchError def test_rejects_file_scheme(): with pytest.raises(SafeFetchError): safe_fetch("file:///etc/passwd") def test_rejects_loopback(): with pytest.raises(SafeFetchError): safe_fetch("http://127.0.0.1/x") def test_rejects_rfc1918(): with pytest.raises(SafeFetchError): safe_fetch("http://192.168.1.1/x") def test_rejects_metadata_endpoint(): with pytest.raises(SafeFetchError): safe_fetch("http://169.254.169.254/latest/") def test_rejects_cgnat(): with pytest.raises(SafeFetchError): safe_fetch("http://100.64.0.1/x")