Official Crawl4AI Cloud: a hosted web scraping, extraction, and search API for AI agents. Free API key, 1,000 credits a month, no card. Fully open source: this repo is the Apache-2.0 crawler that powers it, and you can self-host it.
Python aiai-agentscrawl4ai-cloudcrawlerdata-extractionllmmarkdownmcpopen-sourceplaywrightpythonragscraperweb-crawlerweb-crawlingweb-scraping
fix(security): refuse CosineStrategy.model_name from untrusted bodies
ntohidi9bfe9c57070c
diff --git a/crawl4ai/async_configs.py b/crawl4ai/async_configs.pyindex 0a350fb1..3478183b 100644--- a/crawl4ai/async_configs.py+++ b/crawl4ai/async_configs.py@@ -222,6 +222,10 @@ UNTRUSTED_FORBIDDEN_FIELDS = {"PDFContentScrapingStrategy": {"image_save_dir", "save_images_locally",},+ # Same reason, no scalar allowlist. model_name is a HuggingFace repo id+ # handed to from_pretrained: the caller would pick the weights the server+ # downloads and unpickles.+ "CosineStrategy": {"model_name"},}# Field names that must NEVER be set from an untrusted body on ANY alloweddiff --git a/tests/unit/test_untrusted_field_sinks.py b/tests/unit/test_untrusted_field_sinks.pyindex 5b974440..73b6e80f 100644--- a/tests/unit/test_untrusted_field_sinks.py+++ b/tests/unit/test_untrusted_field_sinks.py@@ -47,3 +47,14 @@ def test_untrusted_bare_wait_for_is_pinned_to_css():def test_trusted_wait_for_unchanged():value = "js:() => true"assert _load({"wait_for": value}, Provenance.TRUSTED).wait_for == value+++# ── CosineStrategy.model_name ──────────────────────────────────────────+++def test_untrusted_cosine_model_name_refused():+ with pytest.raises(UntrustedConfigError):+ _load({"extraction_strategy": {+ "type": "CosineStrategy",+ "params": {"model_name": "attacker-org/evil-model"},+ }})