Content Extractor
The content-extractor policy gets content from URLs in request messages. It records the URL text in policy details. A host allowlist and size limits control each request.
Configuration
policy:
content-extractor:
allow_hosts:
- docs.example.com
- support.example.com
timeout_ms: 2000
max_bytes: 65536
fetch_urls: true
action_on_error: warn
pack:
name: content-extractor-example-1
version: 1.0.0
enabled: true
policies:
chain:
- content-extractor
Fields
| Field | Type | Description | Default |
|---|---|---|---|
allow_hosts | string[] | Permitted hostnames. An empty list denies all URLs. Add each specified hostname. Wildcards are not supported. | [] |
timeout_ms | integer (min: 1) | Fetch timeout for each URL in milliseconds. Requests that exceed this timeout are errors. | 2000 |
max_bytes | integer (min: 1) | Maximum response body size in bytes. Responses exceeding this limit are truncated. | 65536 (64 KB) |
fetch_urls | bool | Detects and gets URLs from request content. A value of false stops this work. | true |
action_on_error | string | Action when extraction returns a blocked_reason. "warn" allows the request. "block" rejects it. Errors include invalid URLs, unsupported schemes, denied hosts, DNS failures, fetch failures, and body-read failures. Oversize bodies are truncated and do not trigger this setting. | "warn" |
Use cases
Audit allowlisted URL fetches
Get referenced documentation from approved hosts. Record the URL text in the policy result details.
pack:
name: rag-content-fetch
version: 0.1.0
enabled: true
policies:
chain:
- content-extractor
- audit-logger
policy:
content-extractor:
allow_hosts:
- docs.company.com
- confluence.company.com
timeout_ms: 5000
max_bytes: 131072
fetch_urls: true
action_on_error: warn
audit-logger: {}
Fail-closed allowlisted fetches
Get linked documents from approved hosts with strict size limits. Block the request when safe extraction cannot finish.
pack:
name: "doc-summarizer"
version: "0.1.0"
enabled: true
policies:
chain:
- content-extractor
policy:
content-extractor:
allow_hosts:
- "files.example.com"
timeout_ms: 10000
max_bytes: 524288
fetch_urls: true
action_on_error: "block"
Verify an allowlisted link
Verify that request URLs are available from an approved host. Block requests with broken or denied links.
pack:
name: "link-verifier"
version: "0.1.0"
enabled: true
policies:
chain:
- content-extractor
policy:
content-extractor:
allow_hosts:
- "api.example.com"
timeout_ms: 3000
max_bytes: 1024
fetch_urls: true
action_on_error: "block"
How it works
- URL detection: When
fetch_urlsis enabled, the gateway checks request messages for URLs. - Safety checks: Each URL must use
httporhttpsand matchallow_hosts. - The URL must resolve only to public IP addresses. The gateway rejects private and internal addresses.
- HTTP request: The gateway gets permitted URLs with HTTP GET and the configured
timeout_ms. - It truncates a response that is larger than
max_bytes. - Policy details: The policy stores content and detected URLs in
details.extracted_text. - Errors: The extractor stops at the first invalid or failed URL and sets
blocked_reason. action_on_error: "warn"allows the request.action_on_error: "block"blocks the request.
The evaluator does not add the fetched text to request messages. Subsequent
prompt, DLP, and safety policies examine their documented inputs, not
details.extracted_text.
Best practices
- Always specify
allow_hosts. An empty list blocks all requests. Do not use broad host lists. - Set small
max_byteslimits. Large documents increase fetch and event-detail size. Start with 64 KB. - Use
"block"for critical pipelines. Setaction_on_errorto"block"when the fetch must succeed. Then, a fetch error blocks the request. - Protect policy details. They can contain the fetched text. Limit access and retention through the owning evidence workflow.
- Do not assume downstream inspection. The extractor does not rewrite the forwarded request body.
- Monitor timeout settings. The default is 2 seconds. Increase
timeout_msonly for a slower host or document.
Next steps
- Document Analyzer — check supported document fields in request JSON
- Audit Logger — add a policy marker to the decision stream