securedact_read_file
Read a local file and return sanitized (PII/secrets removed) text for external AI, with defenses against path traversal and sensitive paths.
Instructions
Safely read a local file and return only its sanitized (PII/secrets removed) text.
Use this when you must ingest a local file's contents for use with an external AI but want path-traversal, size, and binary defenses plus sanitization applied first. If the content is already in memory, use prepare_for_external_ai; for a sanitized file on disk, use create_safe_copy.
Side effects: reads a file from local disk and never transmits it. Sensitive paths and escapes are blocked before any file content is read. The returned 'sanitized_text' is safe to forward.
Returns a JSON object with 'status' ('ok' or 'blocked'), 'path', and 'sanitized_text' (present only when approved).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Local filesystem path to read. It is resolved and defended against path traversal, symlink/UNC escapes, and oversized or binary content (FW-011/012/013); sensitive paths are blocked before any file content is read. | |
| policy | No | Named redaction policy applied to the file contents. Defaults to 'strict_external_ai'. An unknown name returns a policy_not_found error. | strict_external_ai |
| max_bytes | No | Optional cap on the number of bytes read from the file. When omitted, the engine's configured size limit applies. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||