Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
feat(sdks): top-level checkPromptInjection in the .NET, Elixir, Go, Java, PHP, Ruby and Rust SDKs (#5028)
Gergő Móricze55325ca2735
diff --git a/apps/dot-net-sdk/Firecrawl.Tests/ModelsTests.cs b/apps/dot-net-sdk/Firecrawl.Tests/ModelsTests.csindex 9c8d14ed2..a4f229e89 100644--- a/apps/dot-net-sdk/Firecrawl.Tests/ModelsTests.cs+++ b/apps/dot-net-sdk/Firecrawl.Tests/ModelsTests.cs@@ -18,6 +18,7 @@ public class ModelsTestsTimeout = 30000,Mobile = false,RedactPII = true,+ CheckPromptInjection = true,AuditMetadata = new AuditMetadata { Username = "[email protected]" }};@@ -29,6 +30,7 @@ public class ModelsTestsAssert.Contains("\"timeout\":30000", json);Assert.Contains("\"mobile\":false", json);Assert.Contains("\"redactPII\":true", json);+ Assert.Contains("\"checkPromptInjection\":true", json);Assert.Contains("\"auditMetadata\":{\"username\":\"[email protected]\"}", json);}@@ -45,6 +47,7 @@ public class ModelsTestsAssert.DoesNotContain("\"timeout\"", json);Assert.DoesNotContain("\"mobile\"", json);Assert.DoesNotContain("\"headers\"", json);+ Assert.DoesNotContain("\"checkPromptInjection\"", json);}[Fact]diff --git a/apps/dot-net-sdk/Firecrawl.Tests/ParseTests.cs b/apps/dot-net-sdk/Firecrawl.Tests/ParseTests.csindex aa239b8b4..f19b2c2e7 100644--- a/apps/dot-net-sdk/Firecrawl.Tests/ParseTests.cs+++ b/apps/dot-net-sdk/Firecrawl.Tests/ParseTests.cs@@ -69,6 +69,18 @@ public class ParseTestsAssert.Contains("\"auditMetadata\":{\"username\":\"[email protected]\"}", json);}+ [Fact]+ public void ParseOptions_Serializes_CheckPromptInjection()+ {+ var options = new ParseOptions { CheckPromptInjection = true };++ var json = JsonSerializer.Serialize(options, FirecrawlHttpClient.JsonOptions);+ Assert.Contains("\"checkPromptInjection\":true", json);++ var unset = JsonSerializer.Serialize(new ParseOptions(), FirecrawlHttpClient.JsonOptions);+ Assert.DoesNotContain("\"checkPromptInjection\"", unset);+ }+[Fact]public void ParseOptions_Validate_RejectsUnsupportedFormats(){diff --git a/apps/dot-net-sdk/Firecrawl/Models/JsonFormat.cs b/apps/dot-net-sdk/Firecrawl/Models/JsonFormat.csindex e56989bce..4f2572b39 100644--- a/apps/dot-net-sdk/Firecrawl/Models/JsonFormat.cs+++ b/apps/dot-net-sdk/Firecrawl/Models/JsonFormat.cs@@ -18,6 +18,7 @@ public class JsonFormat[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]public Dictionary<string, object>? Schema { get; set; }+ [Obsolete("Use the top-level ScrapeOptions.CheckPromptInjection option instead.")][JsonPropertyName("checkPromptInjection")][JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]public bool? CheckPromptInjection { get; set; }diff --git a/apps/dot-net-sdk/Firecrawl/Models/ParseOptions.cs b/apps/dot-net-sdk/Firecrawl/Models/ParseOptions.csindex 1992811ff..055888938 100644--- a/apps/dot-net-sdk/Firecrawl/Models/ParseOptions.cs+++ b/apps/dot-net-sdk/Firecrawl/Models/ParseOptions.cs@@ -79,6 +79,14 @@ public class ParseOptions[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]public string? Integration { get; set; }+ /// <summary>+ /// Scans the parsed content for prompt injection before LLM-backed formats run.+ /// A detection fails the parse with SCRAPE_PROMPT_INJECTION_DETECTED. Adds 4 credits when the check scans the whole content.+ /// </summary>+ [JsonPropertyName("checkPromptInjection")]+ [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]+ public bool? CheckPromptInjection { get; set; }+[JsonPropertyName("redactPII")][JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]public bool? RedactPII { get; set; }diff --git a/apps/dot-net-sdk/Firecrawl/Models/ScrapeOptions.cs b/apps/dot-net-sdk/Firecrawl/Models/ScrapeOptions.csindex 8a7b561c1..76dbe4658 100644--- a/apps/dot-net-sdk/Firecrawl/Models/ScrapeOptions.cs+++ b/apps/dot-net-sdk/Firecrawl/Models/ScrapeOptions.cs@@ -75,6 +75,14 @@ public class ScrapeOptions[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]public bool? StoreInCache { get; set; }+ /// <summary>+ /// Scans the page content for prompt injection with any format except rawBase64, before LLM-backed formats run.+ /// A detection fails the scrape with SCRAPE_PROMPT_INJECTION_DETECTED. Adds 4 credits when the check scans the whole page.+ /// </summary>+ [JsonPropertyName("checkPromptInjection")]+ [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]+ public bool? CheckPromptInjection { get; set; }+[JsonPropertyName("redactPII")][JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]public bool? RedactPII { get; set; }diff --git a/apps/elixir-sdk/lib/firecrawl.ex b/apps/elixir-sdk/lib/firecrawl.exindex 1cffa6cdb..18c7d3c18 100644--- a/apps/elixir-sdk/lib/firecrawl.ex+++ b/apps/elixir-sdk/lib/firecrawl.ex@@ -1844,6 +1844,7 @@ defmodule Firecrawl do@parse_file_schema NimbleOptions.new!([audit_metadata: [type: :keyword_list, keys: [username: [type: :string, required: true]], doc: "User attribution included with SIEM logging events when SIEM Logging is enabled for the organization."],block_ads: [type: :boolean, doc: "Enable ad and cookie popup blocking."],+ check_prompt_injection: [type: :boolean, doc: "When enabled, scans the parsed content for prompt injection attempts before any LLM-backed format (such as json, summary or question) runs. If an injection is detected, the request fails with a 403 and error code SCRAPE_PROMPT_INJECTION_DETECTED. Adds 4 credits when the check runs. If the check cannot scan all of the content, the parse continues with a warning and the check is not billed."],exclude_tags: [type: {:list, :string}, doc: "Tags to exclude from the output."],formats: [type: {:list, :any}, doc: "Output formats supported for `/parse` uploads. Browser-rendering formats and change tracking are not supported."],headers: [type: :any, doc: "Headers to send when additional network requests are required."],@@ -1860,7 +1861,7 @@ defmodule Firecrawl dozero_data_retention: [type: :boolean, doc: "If true, this will enable zero data retention for this parse. To enable this feature, please contact [email protected]"]])- @parse_file_key_mapping %{audit_metadata: {"auditMetadata", %{username: "username"}}, block_ads: "blockAds", exclude_tags: "excludeTags", formats: "formats", headers: "headers", include_tags: "includeTags", integration: "integration", only_main_content: "onlyMainContent", origin: "origin", parsers: "parsers", proxy: "proxy", redact_pii: "redactPII", remove_base64_images: "removeBase64Images", skip_tls_verification: "skipTlsVerification", timeout: "timeout", zero_data_retention: "zeroDataRetention"}+ @parse_file_key_mapping %{audit_metadata: {"auditMetadata", %{username: "username"}}, block_ads: "blockAds", check_prompt_injection: "checkPromptInjection", exclude_tags: "excludeTags", formats: "formats", headers: "headers", include_tags: "includeTags", integration: "integration", only_main_content: "onlyMainContent", origin: "origin", parsers: "parsers", proxy: "proxy", redact_pii: "redactPII", remove_base64_images: "removeBase64Images", skip_tls_verification: "skipTlsVerification", timeout: "timeout", zero_data_retention: "zeroDataRetention"}@doc """Upload and parse a file@@ -1947,6 +1948,7 @@ defmodule Firecrawl doactions: [type: {:list, :any}, doc: "Actions to perform on the page before grabbing the content"],audit_metadata: [type: :keyword_list, keys: [username: [type: :string, required: true]], doc: "User attribution included with SIEM logging events when SIEM Logging is enabled for the organization."],block_ads: [type: :boolean, doc: "Enables ad-blocking and cookie popup blocking."],+ check_prompt_injection: [type: :boolean, doc: "When enabled, scans the page content for prompt injection attempts before any LLM-backed format (such as json, summary or question) runs. Works with any format except rawBase64. If an injection is detected, the request fails with a 403 and error code SCRAPE_PROMPT_INJECTION_DETECTED. Adds 4 credits when the check runs. If the check cannot scan all of the content, the scrape continues with a warning and the check is not billed."],exclude_tags: [type: {:list, :string}, doc: "Tags to exclude from the output."],formats: [type: {:list, :any}, doc: "Output formats to include in the response. You can specify one or more formats, either as strings (e.g., `'markdown'`) or as objects with additional options (e.g., `{ type: 'json', schema: {...} }`). Some formats require specific options to be set. Example: `['markdown', { type: 'json', schema: {...} }]`."],headers: [type: :any, doc: "Headers to send with the request. Can be used to send cookies, user-agent, etc."],@@ -1973,7 +1975,7 @@ defmodule Firecrawl dodomain_tools: [type: :boolean, doc: "When true on an ordinary URL scrape, `data.tools` lists tool contracts matched to the scraped page's domain (same `DiscoveredTool` shape as search). Requires the team's Alexandria access to be enabled and no zero data retention (403 otherwise). Free."]])- @scrape_and_extract_from_url_key_mapping %{url: "url", actions: "actions", audit_metadata: {"auditMetadata", %{username: "username"}}, block_ads: "blockAds", exclude_tags: "excludeTags", formats: "formats", headers: "headers", include_tags: "includeTags", location: "location", lockdown: "lockdown", max_age: "maxAge", min_age: "minAge", mobile: "mobile", only_clean_content: "onlyCleanContent", only_main_content: "onlyMainContent", parsers: "parsers", profile: "profile", proxy: "proxy", redact_pii: "redactPII", remove_base64_images: "removeBase64Images", skip_tls_verification: "skipTlsVerification", store_in_cache: "storeInCache", threat_protection: "threatProtection", timeout: "timeout", wait_for: "waitFor", zero_data_retention: "zeroDataRetention", alexandria: "alexandria", domain_tools: "domainTools"}+ @scrape_and_extract_from_url_key_mapping %{url: "url", actions: "actions", audit_metadata: {"auditMetadata", %{username: "username"}}, block_ads: "blockAds", check_prompt_injection: "checkPromptInjection", exclude_tags: "excludeTags", formats: "formats", headers: "headers", include_tags: "includeTags", location: "location", lockdown: "lockdown", max_age: "maxAge", min_age: "minAge", mobile: "mobile", only_clean_content: "onlyCleanContent", only_main_content: "onlyMainContent", parsers: "parsers", profile: "profile", proxy: "proxy", redact_pii: "redactPII", remove_base64_images: "removeBase64Images", skip_tls_verification: "skipTlsVerification", store_in_cache: "storeInCache", threat_protection: "threatProtection", timeout: "timeout", wait_for: "waitFor", zero_data_retention: "zeroDataRetention", alexandria: "alexandria", domain_tools: "domainTools"}@doc """Scrape a single URL and optionally extract information using an LLM@@ -2018,6 +2020,7 @@ defmodule Firecrawl doactions: [type: {:list, :any}, doc: "Actions to perform on the page before grabbing the content"],audit_metadata: [type: :keyword_list, keys: [username: [type: :string, required: true]], doc: "User attribution included with SIEM logging events when SIEM Logging is enabled for the organization."],block_ads: [type: :boolean, doc: "Enables ad-blocking and cookie popup blocking."],+ check_prompt_injection: [type: :boolean, doc: "When enabled, scans the page content for prompt injection attempts before any LLM-backed format (such as json, summary or question) runs. Works with any format except rawBase64. If an injection is detected, the request fails with a 403 and error code SCRAPE_PROMPT_INJECTION_DETECTED. Adds 4 credits when the check runs. If the check cannot scan all of the content, the scrape continues with a warning and the check is not billed."],exclude_tags: [type: {:list, :string}, doc: "Tags to exclude from the output."],formats: [type: {:list, :any}, doc: "Output formats to include in the response. You can specify one or more formats, either as strings (e.g., `'markdown'`) or as objects with additional options (e.g., `{ type: 'json', schema: {...} }`). Some formats require specific options to be set. Example: `['markdown', { type: 'json', schema: {...} }]`."],headers: [type: :any, doc: "Headers to send with the request. Can be used to send cookies, user-agent, etc."],@@ -2042,7 +2045,7 @@ defmodule Firecrawl dozero_data_retention: [type: :boolean, doc: "If true, this will enable zero data retention for this batch scrape. To enable this feature, please contact [email protected]"]])- @scrape_and_extract_from_urls_key_mapping %{ignore_invalid_urls: "ignoreInvalidURLs", max_concurrency: "maxConcurrency", urls: "urls", webhook: "webhook", actions: "actions", audit_metadata: {"auditMetadata", %{username: "username"}}, block_ads: "blockAds", exclude_tags: "excludeTags", formats: "formats", headers: "headers", include_tags: "includeTags", location: "location", lockdown: "lockdown", max_age: "maxAge", min_age: "minAge", mobile: "mobile", only_clean_content: "onlyCleanContent", only_main_content: "onlyMainContent", parsers: "parsers", profile: "profile", proxy: "proxy", redact_pii: "redactPII", remove_base64_images: "removeBase64Images", skip_tls_verification: "skipTlsVerification", store_in_cache: "storeInCache", threat_protection: "threatProtection", timeout: "timeout", wait_for: "waitFor", zero_data_retention: "zeroDataRetention"}+ @scrape_and_extract_from_urls_key_mapping %{ignore_invalid_urls: "ignoreInvalidURLs", max_concurrency: "maxConcurrency", urls: "urls", webhook: "webhook", actions: "actions", audit_metadata: {"auditMetadata", %{username: "username"}}, block_ads: "blockAds", check_prompt_injection: "checkPromptInjection", exclude_tags: "excludeTags", formats: "formats", headers: "headers", include_tags: "includeTags", location: "location", lockdown: "lockdown", max_age: "maxAge", min_age: "minAge", mobile: "mobile", only_clean_content: "onlyCleanContent", only_main_content: "onlyMainContent", parsers: "parsers", profile: "profile", proxy: "proxy", redact_pii: "redactPII", remove_base64_images: "removeBase64Images", skip_tls_verification: "skipTlsVerification", store_in_cache: "storeInCache", threat_protection: "threatProtection", timeout: "timeout", wait_for: "waitFor", zero_data_retention: "zeroDataRetention"}@doc """Scrape multiple URLs and optionally extract information using an LLMdiff --git a/apps/elixir-sdk/openapi.json b/apps/elixir-sdk/openapi.jsonindex f25d89060..59efd2484 100644--- a/apps/elixir-sdk/openapi.json+++ b/apps/elixir-sdk/openapi.json@@ -8924,7 +8924,8 @@},"checkPromptInjection": {"type": "boolean",- "description": "When enabled, scans the scraped page content for prompt injection attempts before running the extraction. If an injection is detected, the request fails with a 403 and error code SCRAPE_PROMPT_INJECTION_DETECTED. Adds 4 credits when the check runs. Defaults to false.",+ "deprecated": true,+ "description": "Deprecated: use the top-level `checkPromptInjection` scrape option, which this value is merged into. Defaults to false.","default": false}},@@ -9332,6 +9333,11 @@"description": "Enable ad and cookie popup blocking.","default": true},+ "checkPromptInjection": {+ "type": "boolean",+ "description": "When enabled, scans the parsed content for prompt injection attempts before any LLM-backed format (such as json, summary or question) runs. If an injection is detected, the request fails with a 403 and error code SCRAPE_PROMPT_INJECTION_DETECTED. Adds 4 credits when the check runs. If the check cannot scan all of the content, the parse continues with a warning and the check is not billed.",+ "default": false+ },"redactPII": {"oneOf": [{@@ -9829,6 +9835,11 @@"description": "If true, serves the request from Firecrawl's cache only and never makes an outbound request to the target URL. Designed for compliance-constrained or air-gapped environments where the scrape request itself could leak sensitive information. On cache miss, returns a 404 with error code SCRAPE_LOCKDOWN_CACHE_MISS (the URL is never logged on miss). Lockdown requests are treated as zero data retention. Default maxAge is extended to 2 years so existing cached pages remain eligible. Billed at 5 credits on hit, 1 credit on cache miss.","default": false},+ "checkPromptInjection": {+ "type": "boolean",+ "description": "When enabled, scans the page content for prompt injection attempts before any LLM-backed format (such as json, summary or question) runs. Works with any format except rawBase64. If an injection is detected, the request fails with a 403 and error code SCRAPE_PROMPT_INJECTION_DETECTED. Adds 4 credits when the check runs. If the check cannot scan all of the content, the scrape continues with a warning and the check is not billed.",+ "default": false+ },"redactPII": {"oneOf": [{diff --git a/apps/elixir-sdk/test/firecrawl_test.exs b/apps/elixir-sdk/test/firecrawl_test.exsindex 7b09f66d5..66b2e174a 100644--- a/apps/elixir-sdk/test/firecrawl_test.exs+++ b/apps/elixir-sdk/test/firecrawl_test.exs@@ -674,6 +674,110 @@ defmodule FirecrawlTest doassert body["urls"] == ["https://example.com"]end+ test "parse_file sends check_prompt_injection as checkPromptInjection only when set" do+ parent = self()++ adapter = fn request ->+ send(parent, {:request, request})++ resp = Req.Response.new(+ status: 200,+ headers: %{"content-type" => ["application/json"]},+ body: Jason.encode!(%{"success" => true, "data" => %{}})+ )++ {request, resp}+ end++ parse_options = fn params ->+ assert {:ok, %Req.Response{status: 200}} =+ Firecrawl.parse_file(+ [filename: "doc.html", data: "<p>hi</p>", content_type: "text/html"],+ params,+ api_key: "test-key",+ adapter: adapter+ )++ assert_receive {:request, request}+ body = request.body |> Enum.to_list() |> IO.iodata_to_binary()+ [_, options] = Regex.run(~r/name="options"\r\n\r\n(.*?)\r\n--/s, body)+ Jason.decode!(options)+ end++ assert parse_options.(check_prompt_injection: true)["checkPromptInjection"] == true+ refute Map.has_key?(parse_options.([]), "checkPromptInjection")+ end++ test "scrape maps check_prompt_injection to checkPromptInjection" do+ parent = self()++ adapter = fn request ->+ send(parent, {:request, request})++ resp = Req.Response.new(+ status: 200,+ headers: %{"content-type" => ["application/json"]},+ body: Jason.encode!(%{"success" => true, "data" => %{}})+ )++ {request, resp}+ end++ assert {:ok, %Req.Response{status: 200}} =+ Firecrawl.scrape_and_extract_from_url(+ [url: "https://example.com", check_prompt_injection: true],+ api_key: "test-key",+ adapter: adapter+ )++ assert_receive {:request, request}++ body =+ cond do+ is_binary(request.body) -> Jason.decode!(request.body)+ is_map(request.body) -> request.body+ true -> request.options[:json]+ end++ assert body["checkPromptInjection"] == true+ refute Map.has_key?(body, "formats")+ end++ test "batch scrape maps check_prompt_injection to checkPromptInjection" do+ parent = self()++ adapter = fn request ->+ send(parent, {:request, request})++ resp = Req.Response.new(+ status: 200,+ headers: %{"content-type" => ["application/json"]},+ body: Jason.encode!(%{"success" => true, "id" => "batch-id"})+ )++ {request, resp}+ end++ assert {:ok, %Req.Response{status: 200}} =+ Firecrawl.scrape_and_extract_from_urls(+ [urls: ["https://example.com"], check_prompt_injection: true],+ api_key: "test-key",+ adapter: adapter+ )++ assert_receive {:request, request}++ body =+ cond do+ is_binary(request.body) -> Jason.decode!(request.body)+ is_map(request.body) -> request.body+ true -> request.options[:json]+ end++ assert body["checkPromptInjection"] == true+ assert body["urls"] == ["https://example.com"]+ end+test "request endpoints map audit_metadata to auditMetadata" doparent = self()diff --git a/apps/go-sdk/options.go b/apps/go-sdk/options.goindex 5acfc0394..f73acfd37 100644--- a/apps/go-sdk/options.go+++ b/apps/go-sdk/options.go@@ -95,6 +95,11 @@ type ScrapeOptions struct {Integration *string `json:"integration,omitempty"`JsonOptions *JsonOptions `json:"jsonOptions,omitempty"`DomainTools *bool `json:"domainTools,omitempty"`+ // CheckPromptInjection scans the page content for prompt injection with any+ // format except rawBase64, before LLM-backed formats run. A detection fails+ // the scrape with SCRAPE_PROMPT_INJECTION_DETECTED. Adds 4 credits when the+ // check scans the whole page.+ CheckPromptInjection *bool `json:"checkPromptInjection,omitempty"`}// MarshalJSON preserves string formats while allowing object formats such as QuestionFormat.@@ -260,9 +265,10 @@ type WebhookConfig struct {// JsonOptions configures JSON extraction within formats.type JsonOptions struct {- Prompt string `json:"prompt,omitempty"`- Schema map[string]interface{} `json:"schema,omitempty"`- CheckPromptInjection *bool `json:"checkPromptInjection,omitempty"`+ Prompt string `json:"prompt,omitempty"`+ Schema map[string]interface{} `json:"schema,omitempty"`+ // Deprecated: Use ScrapeOptions.CheckPromptInjection or ParseOptions.CheckPromptInjection.+ CheckPromptInjection *bool `json:"checkPromptInjection,omitempty"`}// Pointer helpers for optional fields.diff --git a/apps/go-sdk/options_test.go b/apps/go-sdk/options_test.goindex 466a439e6..406aed31d 100644--- a/apps/go-sdk/options_test.go+++ b/apps/go-sdk/options_test.go@@ -162,6 +162,19 @@ func TestScrapeOptionsSerializesRedactPII(t *testing.T) {}}+func TestScrapeOptionsSerializesCheckPromptInjection(t *testing.T) {+ payload, err := json.Marshal(ScrapeOptions{+ CheckPromptInjection: Bool(true),+ })+ if err != nil {+ t.Fatalf("Marshal ScrapeOptions: %v", err)+ }++ if !strings.Contains(string(payload), `"checkPromptInjection":true`) {+ t.Fatalf("serialized checkPromptInjection = %s", payload)+ }+}+func TestScrapeOptionsSerializesDomainTools(t *testing.T) {payload, err := json.Marshal(ScrapeOptions{DomainTools: Bool(true),diff --git a/apps/go-sdk/parse.go b/apps/go-sdk/parse.goindex 4ee1376ed..d564fca24 100644--- a/apps/go-sdk/parse.go+++ b/apps/go-sdk/parse.go@@ -92,6 +92,11 @@ type ParseOptions struct {RedactPII *bool `json:"redactPII,omitempty"`AuditMetadata *AuditMetadata `json:"auditMetadata,omitempty"`JsonOptions *JsonOptions `json:"jsonOptions,omitempty"`+ // CheckPromptInjection scans the parsed content for prompt injection before+ // LLM-backed formats run. A detection fails the parse with+ // SCRAPE_PROMPT_INJECTION_DETECTED. Adds 4 credits when the check scans the+ // whole content.+ CheckPromptInjection *bool `json:"checkPromptInjection,omitempty"`}// MarshalJSON preserves string formats while allowing object formats such as QuestionFormat.diff --git a/apps/go-sdk/parse_test.go b/apps/go-sdk/parse_test.goindex df2231951..ca02bb841 100644--- a/apps/go-sdk/parse_test.go+++ b/apps/go-sdk/parse_test.go@@ -74,9 +74,10 @@ func TestParseSendsMultipartRequest(t *testing.T) {file.ContentType = "text/html"doc, err := client.Parse(context.Background(), file, &ParseOptions{- Formats: []string{"markdown"},- OnlyMainContent: Bool(true),- RedactPII: Bool(true),+ Formats: []string{"markdown"},+ OnlyMainContent: Bool(true),+ RedactPII: Bool(true),+ CheckPromptInjection: Bool(true),})if err != nil {t.Fatalf("Parse: %v", err)@@ -94,6 +95,9 @@ func TestParseSendsMultipartRequest(t *testing.T) {if !strings.Contains(gotOptions, `"redactPII":true`) {t.Errorf("options missing redactPII: %q", gotOptions)}+ if !strings.Contains(gotOptions, `"checkPromptInjection":true`) {+ t.Errorf("options missing checkPromptInjection: %q", gotOptions)+ }if gotFilename != "upload.html" {t.Errorf("filename = %q, want upload.html", gotFilename)}diff --git a/apps/java-sdk/src/main/java/com/firecrawl/models/JsonFormat.java b/apps/java-sdk/src/main/java/com/firecrawl/models/JsonFormat.javaindex bfcde509b..95c8c85a1 100644--- a/apps/java-sdk/src/main/java/com/firecrawl/models/JsonFormat.java+++ b/apps/java-sdk/src/main/java/com/firecrawl/models/JsonFormat.java@@ -33,6 +33,8 @@ public class JsonFormat {public String getType() { return type; }public String getPrompt() { return prompt; }public Map<String, Object> getSchema() { return schema; }+ /** @deprecated Use {@link ScrapeOptions#getCheckPromptInjection()} instead. */+ @Deprecatedpublic Boolean getCheckPromptInjection() { return checkPromptInjection; }public static Builder builder() { return new Builder(); }@@ -50,7 +52,12 @@ public class JsonFormat {/** JSON Schema for structured extraction. */public Builder schema(Map<String, Object> schema) { this.schema = schema; return this; }- /** Check scraped content for prompt-injection attempts before extraction. */+ /**+ * Check scraped content for prompt-injection attempts before extraction.+ *+ * @deprecated Use the top-level {@link ScrapeOptions.Builder#checkPromptInjection(Boolean)} option instead.+ */+ @Deprecatedpublic Builder checkPromptInjection(Boolean checkPromptInjection) { this.checkPromptInjection = checkPromptInjection; return this; }public JsonFormat build() {diff --git a/apps/java-sdk/src/main/java/com/firecrawl/models/ParseOptions.java b/apps/java-sdk/src/main/java/com/firecrawl/models/ParseOptions.javaindex ff88c6f5f..7cd80d251 100644--- a/apps/java-sdk/src/main/java/com/firecrawl/models/ParseOptions.java+++ b/apps/java-sdk/src/main/java/com/firecrawl/models/ParseOptions.java@@ -29,6 +29,7 @@ public class ParseOptions {private Boolean blockAds;private String proxy;private String integration;+ private Boolean checkPromptInjection;@JsonProperty("redactPII")private Boolean redactPII;private AuditMetadata auditMetadata;@@ -47,6 +48,7 @@ public class ParseOptions {public Boolean getBlockAds() { return blockAds; }public String getProxy() { return proxy; }public String getIntegration() { return integration; }+ public Boolean getCheckPromptInjection() { return checkPromptInjection; }@JsonProperty("redactPII")public Boolean getRedactPII() { return redactPII; }@JsonProperty("auditMetadata")@@ -68,6 +70,7 @@ public class ParseOptions {b.blockAds = this.blockAds;b.proxy = this.proxy;b.integration = this.integration;+ b.checkPromptInjection = this.checkPromptInjection;b.redactPII = this.redactPII;b.auditMetadata = this.auditMetadata;return b;@@ -116,6 +119,7 @@ public class ParseOptions {private Boolean blockAds;private String proxy;private String integration;+ private Boolean checkPromptInjection;private Boolean redactPII;private AuditMetadata auditMetadata;@@ -134,6 +138,11 @@ public class ParseOptions {public Builder blockAds(Boolean blockAds) { this.blockAds = blockAds; return this; }public Builder proxy(String proxy) { this.proxy = proxy; return this; }public Builder integration(String integration) { this.integration = integration; return this; }+ /**+ * Scans the parsed content for prompt injection before LLM-backed formats run.+ * A detection fails the parse with SCRAPE_PROMPT_INJECTION_DETECTED. Adds 4 credits when the check scans the whole content.+ */+ public Builder checkPromptInjection(Boolean checkPromptInjection) { this.checkPromptInjection = checkPromptInjection; return this; }public Builder redactPII(Boolean redactPII) { this.redactPII = redactPII; return this; }public Builder auditMetadata(AuditMetadata auditMetadata) { this.auditMetadata = auditMetadata; return this; }@@ -168,6 +177,7 @@ public class ParseOptions {o.blockAds = this.blockAds;o.proxy = this.proxy;o.integration = this.integration;+ o.checkPromptInjection = this.checkPromptInjection;o.redactPII = this.redactPII;o.auditMetadata = this.auditMetadata;return o;diff --git a/apps/java-sdk/src/main/java/com/firecrawl/models/ScrapeOptions.java b/apps/java-sdk/src/main/java/com/firecrawl/models/ScrapeOptions.javaindex 8381b554a..77f84a7cc 100644--- a/apps/java-sdk/src/main/java/com/firecrawl/models/ScrapeOptions.java+++ b/apps/java-sdk/src/main/java/com/firecrawl/models/ScrapeOptions.java@@ -33,6 +33,7 @@ public class ScrapeOptions {private Long maxAge;private Boolean storeInCache;private Boolean lockdown;+ private Boolean checkPromptInjection;@JsonProperty("redactPII")private Boolean redactPII;private AuditMetadata auditMetadata;@@ -58,6 +59,7 @@ public class ScrapeOptions {public Long getMaxAge() { return maxAge; }public Boolean getStoreInCache() { return storeInCache; }public Boolean getLockdown() { return lockdown; }+ public Boolean getCheckPromptInjection() { return checkPromptInjection; }@JsonProperty("redactPII")public Boolean getRedactPII() { return redactPII; }@JsonProperty("auditMetadata")@@ -86,6 +88,7 @@ public class ScrapeOptions {b.maxAge = this.maxAge;b.storeInCache = this.storeInCache;b.lockdown = this.lockdown;+ b.checkPromptInjection = this.checkPromptInjection;b.redactPII = this.redactPII;b.auditMetadata = this.auditMetadata;b.integration = this.integration;@@ -111,6 +114,7 @@ public class ScrapeOptions {private Long maxAge;private Boolean storeInCache;private Boolean lockdown;+ private Boolean checkPromptInjection;private Boolean redactPII;private AuditMetadata auditMetadata;private String integration;@@ -175,6 +179,12 @@ public class ScrapeOptions {/** Lockdown mode: serve only previously cached results, never make outbound requests. */public Builder lockdown(Boolean lockdown) { this.lockdown = lockdown; return this; }+ /**+ * Scans the page content for prompt injection with any format except rawBase64, before LLM-backed formats run.+ * A detection fails the scrape with SCRAPE_PROMPT_INJECTION_DETECTED. Adds 4 credits when the check scans the whole page.+ */+ public Builder checkPromptInjection(Boolean checkPromptInjection) { this.checkPromptInjection = checkPromptInjection; return this; }+/** Redact personally identifiable information from returned content. */public Builder redactPII(Boolean redactPII) { this.redactPII = redactPII; return this; }@@ -204,6 +214,7 @@ public class ScrapeOptions {o.maxAge = this.maxAge;o.storeInCache = this.storeInCache;o.lockdown = this.lockdown;+ o.checkPromptInjection = this.checkPromptInjection;o.redactPII = this.redactPII;o.auditMetadata = this.auditMetadata;o.integration = this.integration;diff --git a/apps/java-sdk/src/test/java/com/firecrawl/FirecrawlClientTest.java b/apps/java-sdk/src/test/java/com/firecrawl/FirecrawlClientTest.javaindex f1c1da01d..cac5c3c24 100644--- a/apps/java-sdk/src/test/java/com/firecrawl/FirecrawlClientTest.java+++ b/apps/java-sdk/src/test/java/com/firecrawl/FirecrawlClientTest.java@@ -10,6 +10,7 @@ import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;import java.nio.charset.StandardCharsets;import java.util.List;+import java.util.Map;import java.util.concurrent.TimeUnit;import static org.junit.jupiter.api.Assertions.*;@@ -150,6 +151,18 @@ class FirecrawlClientTest {assertTrue(modified.getRedactPII());}+ @Test+ void testScrapeOptionsSerializesCheckPromptInjection() {+ com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper();+ ScrapeOptions options = ScrapeOptions.builder()+ .checkPromptInjection(true)+ .build();++ assertEquals(Boolean.TRUE, mapper.convertValue(options, Map.class).get("checkPromptInjection"));+ assertTrue(options.toBuilder().build().getCheckPromptInjection());+ assertFalse(mapper.convertValue(ScrapeOptions.builder().build(), Map.class).containsKey("checkPromptInjection"));+ }+@Testvoid testBrowserExecuteRequiresSessionId() {FirecrawlClient client = FirecrawlClient.builder()@@ -394,6 +407,19 @@ class FirecrawlClientTest {assertTrue(options.getRedactPII());}+ @Test+ void testParseOptionsSerializesCheckPromptInjection() {+ com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper();+ ParseOptions options = ParseOptions.builder()+ .formats(List.of("markdown"))+ .checkPromptInjection(true)+ .build();++ assertEquals(Boolean.TRUE, mapper.convertValue(options, Map.class).get("checkPromptInjection"));+ assertTrue(options.toBuilder().build().getCheckPromptInjection());+ assertFalse(mapper.convertValue(ParseOptions.builder().build(), Map.class).containsKey("checkPromptInjection"));+ }+// ================================================================// E2E TESTS (require FIRECRAWL_API_KEY)// ================================================================diff --git a/apps/php-sdk/src/Models/JsonFormat.php b/apps/php-sdk/src/Models/JsonFormat.phpindex a87d209dc..f92358dc2 100644--- a/apps/php-sdk/src/Models/JsonFormat.php+++ b/apps/php-sdk/src/Models/JsonFormat.php@@ -15,6 +15,7 @@ final class JsonFormat/*** @param array<string, mixed>|null $schema+ * @param bool|null $checkPromptInjection {@deprecated Use the top-level checkPromptInjection option on ScrapeOptions instead.}*/public static function with(?string $prompt = null,@@ -46,6 +47,7 @@ final class JsonFormatreturn $this->schema;}+ /** @deprecated Use the top-level checkPromptInjection option on ScrapeOptions instead. */public function getCheckPromptInjection(): ?bool{return $this->checkPromptInjection;diff --git a/apps/php-sdk/src/Models/ParseOptions.php b/apps/php-sdk/src/Models/ParseOptions.phpindex dc8a7396a..4db215470 100644--- a/apps/php-sdk/src/Models/ParseOptions.php+++ b/apps/php-sdk/src/Models/ParseOptions.php@@ -45,6 +45,7 @@ final class ParseOptionsprivate readonly ?bool $skipTlsVerification = null,private readonly ?bool $removeBase64Images = null,private readonly ?bool $blockAds = null,+ private readonly ?bool $checkPromptInjection = null,private readonly ?string $proxy = null,private readonly ?string $integration = null,private readonly ?bool $redactPII = null,@@ -58,6 +59,9 @@ final class ParseOptions* @param list<string>|null $excludeTags* @param list<string|PDFParser|array<string, mixed>>|null $parsers* @param AuditMetadata|null $auditMetadata+ * @param bool|null $checkPromptInjection Scans the parsed content for prompt injection+ * before LLM-backed formats run. A detection fails the parse with SCRAPE_PROMPT_INJECTION_DETECTED.+ * Adds 4 credits when the check scans the whole content.*/public static function with(?array $formats = null,@@ -74,6 +78,7 @@ final class ParseOptions?string $integration = null,?bool $redactPII = null,?AuditMetadata $auditMetadata = null,+ ?bool $checkPromptInjection = null,): self {if ($timeout !== null && $timeout <= 0) {throw new FirecrawlException('timeout must be positive');@@ -103,6 +108,7 @@ final class ParseOptions$skipTlsVerification,$removeBase64Images,$blockAds,+ $checkPromptInjection,$proxy,$integration,$redactPII,@@ -141,6 +147,7 @@ final class ParseOptions'skipTlsVerification' => $this->skipTlsVerification,'removeBase64Images' => $this->removeBase64Images,'blockAds' => $this->blockAds,+ 'checkPromptInjection' => $this->checkPromptInjection,'proxy' => $this->proxy,'integration' => $this->integration,'redactPII' => $this->redactPII,@@ -234,6 +241,11 @@ final class ParseOptionsreturn $this->blockAds;}+ public function getCheckPromptInjection(): ?bool+ {+ return $this->checkPromptInjection;+ }+public function getProxy(): ?string{return $this->proxy;diff --git a/apps/php-sdk/src/Models/ScrapeOptions.php b/apps/php-sdk/src/Models/ScrapeOptions.phpindex 5b35b4372..1c9fc3b46 100644--- a/apps/php-sdk/src/Models/ScrapeOptions.php+++ b/apps/php-sdk/src/Models/ScrapeOptions.php@@ -35,6 +35,7 @@ final class ScrapeOptionsprivate readonly ?int $minAge = null,private readonly ?bool $storeInCache = null,private readonly ?bool $lockdown = null,+ private readonly ?bool $checkPromptInjection = null,private readonly ?string $integration = null,/** @var array<string, string>|null */private readonly ?array $profile = null,@@ -52,6 +53,9 @@ final class ScrapeOptions* @param list<array<string, mixed>>|null $actions* @param array<string, string>|null $profile* @param AuditMetadata|null $auditMetadata+ * @param bool|null $checkPromptInjection Scans the page content for prompt+ * injection with any format except rawBase64, before LLM-backed formats run. A detection fails the scrape+ * with SCRAPE_PROMPT_INJECTION_DETECTED. Adds 4 credits when the check scans the whole page.*/public static function with(?array $formats = null,@@ -78,13 +82,14 @@ final class ScrapeOptions?bool $changeTracking = null,?bool $redactPII = null,?AuditMetadata $auditMetadata = null,+ ?bool $checkPromptInjection = null,): self {return new self($formats, $headers, $includeTags, $excludeTags, $onlyMainContent,$timeout, $waitFor, $mobile, $parsers, $actions, $location,$skipTlsVerification, $removeBase64Images, $blockAds, $proxy,- $maxAge, $minAge, $storeInCache, $lockdown, $integration, $profile,- $changeTracking, $redactPII, $auditMetadata,+ $maxAge, $minAge, $storeInCache, $lockdown, $checkPromptInjection,+ $integration, $profile, $changeTracking, $redactPII, $auditMetadata,);}@@ -129,6 +134,7 @@ final class ScrapeOptions'minAge' => $this->minAge,'storeInCache' => $this->storeInCache,'lockdown' => $this->lockdown,+ 'checkPromptInjection' => $this->checkPromptInjection,'integration' => $this->integration,'profile' => $this->profile,'changeTracking' => $this->changeTracking,@@ -246,6 +252,11 @@ final class ScrapeOptionsreturn $this->lockdown;}+ public function getCheckPromptInjection(): ?bool+ {+ return $this->checkPromptInjection;+ }+public function getIntegration(): ?string{return $this->integration;diff --git a/apps/php-sdk/tests/Unit/ModelsTest.php b/apps/php-sdk/tests/Unit/ModelsTest.phpindex 30b0fa878..e9b1f3677 100644--- a/apps/php-sdk/tests/Unit/ModelsTest.php+++ b/apps/php-sdk/tests/Unit/ModelsTest.php@@ -10,6 +10,7 @@ use Firecrawl\Models\MapData;use Firecrawl\Models\BatchScrapeJob;use Firecrawl\Models\CrawlJob;use Firecrawl\Models\HighlightsFormat;+use Firecrawl\Models\JsonFormat;use Firecrawl\Models\AgentOptions;use Firecrawl\Models\AuditMetadata;use Firecrawl\Models\MapOptions;@@ -401,6 +402,29 @@ it('serializes redactPII in ScrapeOptions', function (): void {expect(array_key_exists('formats', $options->toArray()))->toBeFalse();});+it('serializes top-level checkPromptInjection in ScrapeOptions', function (): void {+ $options = ScrapeOptions::with(+ formats: [JsonFormat::with(prompt: 'Extract the title')],+ checkPromptInjection: true,+ );++ expect($options->getCheckPromptInjection())->toBeTrue();+ expect($options->toArray())->toMatchArray([+ 'checkPromptInjection' => true,+ ]);+ expect(array_key_exists('checkPromptInjection', $options->toArray()['formats'][0]))->toBeFalse();+ expect(array_key_exists('checkPromptInjection', ScrapeOptions::with()->toArray()))->toBeFalse();+});++it('still serializes the deprecated JsonFormat checkPromptInjection', function (): void {+ expect(JsonFormat::with(prompt: 'Extract the title', checkPromptInjection: true)->toArray())+ ->toBe([+ 'type' => 'json',+ 'prompt' => 'Extract the title',+ 'checkPromptInjection' => true,+ ]);+});+it('serializes audit metadata across request options', function (): void {$metadata = AuditMetadata::with('[email protected]');$serialized = ['username' => '[email protected]'];diff --git a/apps/php-sdk/tests/Unit/ParseTest.php b/apps/php-sdk/tests/Unit/ParseTest.phpindex 4c711ad83..c5d897110 100644--- a/apps/php-sdk/tests/Unit/ParseTest.php+++ b/apps/php-sdk/tests/Unit/ParseTest.php@@ -37,6 +37,20 @@ it('serializes ParseOptions with JSON format', function (): void {expect($array['redactPII'])->toBeTrue();});+it('serializes checkPromptInjection in ParseOptions', function (): void {+ $options = ParseOptions::with(+ formats: [JsonFormat::with(prompt: 'Extract')],+ checkPromptInjection: true,+ );++ expect($options->getCheckPromptInjection())->toBeTrue();+ expect($options->toArray())->toMatchArray([+ 'checkPromptInjection' => true,+ ]);+ expect(array_key_exists('checkPromptInjection', $options->toArray()['formats'][0]))->toBeFalse();+ expect(array_key_exists('checkPromptInjection', ParseOptions::with()->toArray()))->toBeFalse();+});+it('rejects unsupported parse formats', function (): void {ParseOptions::with(formats: ['screenshot']);})->throws(FirecrawlException::class);diff --git a/apps/ruby-sdk/lib/firecrawl/models/parse_options.rb b/apps/ruby-sdk/lib/firecrawl/models/parse_options.rbindex 8892a5210..470f0d1fe 100644--- a/apps/ruby-sdk/lib/firecrawl/models/parse_options.rb+++ b/apps/ruby-sdk/lib/firecrawl/models/parse_options.rb@@ -7,6 +7,11 @@ module Firecrawl# Parse does not support browser-rendering features (actions, waitFor,# location, mobile) nor screenshot/branding/product/menu/audio/video/changeTracking formats. The# proxy field only accepts "auto" or "basic".+ #+ # check_prompt_injection scans the parsed content for prompt injection+ # before LLM-backed formats run. A detection fails the parse with+ # SCRAPE_PROMPT_INJECTION_DETECTED. Adds 4 credits when the check scans+ # the whole content.class ParseOptionsUNSUPPORTED_FORMATS = %w[changeTracking screenshot screenshot@fullPage branding product menu audio video].freeze@@ -14,6 +19,7 @@ module Firecrawlformats headers include_tags exclude_tags only_main_contenttimeout parsers skip_tls_verification remove_base64_imagesblock_ads proxy integration redact_pii json_options audit_metadata+ check_prompt_injection].freezeattr_reader(*FIELDS)@@ -42,6 +48,7 @@ module Firecrawl"proxy" => proxy,"integration" => integration,"redactPII" => redact_pii,+ "checkPromptInjection" => check_prompt_injection,"jsonOptions" => json_options.is_a?(Hash) ? json_options : json_options&.to_h,"auditMetadata" => audit_metadata&.to_h,}.compactdiff --git a/apps/ruby-sdk/lib/firecrawl/models/query_format.rb b/apps/ruby-sdk/lib/firecrawl/models/query_format.rbindex 724539145..79b34b076 100644--- a/apps/ruby-sdk/lib/firecrawl/models/query_format.rb+++ b/apps/ruby-sdk/lib/firecrawl/models/query_format.rb@@ -43,6 +43,9 @@ module Firecrawlend# JSON format for extracting structured data from page content using a schema.+ #+ # check_prompt_injection is deprecated: use ScrapeOptions#check_prompt_injection+ # or ParseOptions#check_prompt_injection.class JsonFormatattr_reader :schema, :prompt, :check_prompt_injectiondiff --git a/apps/ruby-sdk/lib/firecrawl/models/scrape_options.rb b/apps/ruby-sdk/lib/firecrawl/models/scrape_options.rbindex 10049e813..729181ee9 100644--- a/apps/ruby-sdk/lib/firecrawl/models/scrape_options.rb+++ b/apps/ruby-sdk/lib/firecrawl/models/scrape_options.rb@@ -3,12 +3,18 @@module Firecrawlmodule Models# Options for scraping a single URL.+ #+ # check_prompt_injection scans the page content for prompt injection with+ # any format except rawBase64, before LLM-backed formats run. A detection+ # fails the scrape with SCRAPE_PROMPT_INJECTION_DETECTED. Adds 4 credits+ # when the check scans the whole page.class ScrapeOptionsFIELDS = %i[formats headers include_tags exclude_tags only_main_contenttimeout wait_for mobile parsers actions locationskip_tls_verification remove_base64_images block_ads proxy- max_age store_in_cache lockdown redact_pii integration audit_metadata+ max_age store_in_cache lockdown check_prompt_injection redact_pii+ integration audit_metadata].freezeattr_reader(*FIELDS)@@ -41,6 +47,7 @@ module Firecrawl"maxAge" => max_age,"storeInCache" => store_in_cache,"lockdown" => lockdown,+ "checkPromptInjection" => check_prompt_injection,"redactPII" => redact_pii,"integration" => integration,"auditMetadata" => audit_metadata&.to_h,diff --git a/apps/ruby-sdk/test/firecrawl/client_test.rb b/apps/ruby-sdk/test/firecrawl/client_test.rbindex d1ce330b5..e6098934b 100644--- a/apps/ruby-sdk/test/firecrawl/client_test.rb+++ b/apps/ruby-sdk/test/firecrawl/client_test.rb@@ -1345,6 +1345,15 @@ class ClientTest < Minitest::Test)end+ def test_scrape_options_to_h_check_prompt_injection+ opts = Firecrawl::Models::ScrapeOptions.new(+ formats: ["markdown"],+ check_prompt_injection: true+ )+ assert_equal true, opts.to_h["checkPromptInjection"]+ refute Firecrawl::Models::ScrapeOptions.new.to_h.key?("checkPromptInjection")+ end+def test_json_format_to_h_keeps_explicit_falseformat = Firecrawl::Models::JsonFormat.new(check_prompt_injection: false)assert_equal false, format.to_h["checkPromptInjection"]@@ -1565,9 +1574,11 @@ class ClientTest < Minitest::Testonly_main_content: true,timeout: 30000,proxy: "auto",- redact_pii: true+ redact_pii: true,+ check_prompt_injection: true)h = opts.to_h+ assert_equal true, h["checkPromptInjection"]assert_equal ["markdown"], h["formats"]assert_equal true, h["onlyMainContent"]assert_equal 30000, h["timeout"]diff --git a/apps/rust-sdk/src/parse.rs b/apps/rust-sdk/src/parse.rsindex 89a7a2470..dedc0ba8c 100644--- a/apps/rust-sdk/src/parse.rs+++ b/apps/rust-sdk/src/parse.rs@@ -170,6 +170,10 @@ pub struct ParseOptions {/// Redact personally identifiable information from returned content.#[serde(rename = "redactPII")]pub redact_pii: Option<bool>,+ /// Scan the parsed content for prompt injection before LLM-backed formats run.+ /// A detection fails the parse with SCRAPE_PROMPT_INJECTION_DETECTED. Adds 4 credits+ /// when the check scans the whole content.+ pub check_prompt_injection: Option<bool>,/// User attribution to include with SIEM logging events.pub audit_metadata: Option<AuditMetadata>,/// Origin label for request attribution (e.g., "[email protected]").@@ -484,6 +488,20 @@ mod tests {Ok(())}+ #[test]+ fn test_parse_options_serializes_check_prompt_injection() {+ let options = ParseOptions {+ check_prompt_injection: Some(true),+ ..Default::default()+ };++ let payload = serde_json::to_value(options).unwrap();+ assert_eq!(payload["checkPromptInjection"], serde_json::json!(true));++ let unset = serde_json::to_value(ParseOptions::default()).unwrap();+ assert!(unset.get("checkPromptInjection").is_none());+ }+#[test]fn test_parse_file_from_missing_path() {let result = ParseFile::from_path("/tmp/this-file-should-not-exist-for-parse-sdk-test");diff --git a/apps/rust-sdk/src/scrape.rs b/apps/rust-sdk/src/scrape.rsindex a467db2f6..040c7f39b 100644--- a/apps/rust-sdk/src/scrape.rs+++ b/apps/rust-sdk/src/scrape.rs@@ -79,6 +79,11 @@ pub struct ScrapeOptions {/// Lockdown mode: serve only previously cached results, never make outbound requests.pub lockdown: Option<bool>,+ /// Scan the page content for prompt injection with any format except rawBase64,+ /// before LLM-backed formats run. A detection fails the scrape with+ /// SCRAPE_PROMPT_INJECTION_DETECTED. Adds 4 credits when the check scans the whole page.+ pub check_prompt_injection: Option<bool>,+/// Redact personally identifiable information from returned content.#[serde(rename = "redactPII")]pub redact_pii: Option<bool>,@@ -746,6 +751,20 @@ mod tests {assert!(payload.get("formats").is_none());}+ #[test]+ fn test_scrape_options_serializes_check_prompt_injection() {+ let options = ScrapeOptions {+ check_prompt_injection: Some(true),+ ..Default::default()+ };++ let payload = serde_json::to_value(options).unwrap();+ assert_eq!(payload["checkPromptInjection"], json!(true));++ let unset = serde_json::to_value(ScrapeOptions::default()).unwrap();+ assert!(unset.get("checkPromptInjection").is_none());+ }+#[test]fn test_pdf_parser_serializes_blocks() {let options = ScrapeOptions {diff --git a/apps/rust-sdk/src/types.rs b/apps/rust-sdk/src/types.rsindex 791f74818..a27fa93b8 100644--- a/apps/rust-sdk/src/types.rs+++ b/apps/rust-sdk/src/types.rs@@ -334,6 +334,9 @@ pub struct JsonOptions {/// Extraction prompt for the LLM agent.pub prompt: Option<String>,/// Whether to check scraped content for prompt-injection attempts before extraction.+ #[deprecated(+ note = "use ScrapeOptions::check_prompt_injection or ParseOptions::check_prompt_injection"+ )]pub check_prompt_injection: Option<bool>,}