Spaces:
Configuration error
Configuration error
| import pytest | |
| from app.security import URLSafetyError, validate_provider_base_url, validate_public_url | |
| async def test_rejects_ssrf_and_non_http_targets(url: str) -> None: | |
| with pytest.raises(URLSafetyError): | |
| await validate_public_url(url) | |
| async def test_accepts_public_https_and_strips_fragment() -> None: | |
| result = await validate_public_url("https://1.1.1.1/research?q=1#section") | |
| assert result == "https://1.1.1.1/research?q=1" | |
| async def test_provider_endpoint_requires_https_without_query() -> None: | |
| with pytest.raises(URLSafetyError): | |
| await validate_provider_base_url("http://1.1.1.1/v1") | |
| with pytest.raises(URLSafetyError): | |
| await validate_provider_base_url("https://1.1.1.1/v1?target=x") | |