Customer document upload APIs
Capability-gated handlers, secret fields for filenames, and typed extraction - an upload endpoint that cannot grow arbitrary egress.
The problem
Customers upload PDFs and expect structured fields back through your API. The risky version is a Flask app with full network access that passes files to an LLM and logs whatever comes back. Security review asks whether the handler could exfiltrate the document to an unapproved endpoint.
Why Ecko
- Grant at the import
- The upload route gets
grant [net, fs:read]; the schema validator getsgrant []. Reviewers read one line per module instead of auditing every import transitively. - Secrets for paths and content
- Wrap upload paths and extracted PII in
secretso error handlers and debug logs do not leak customer filenames or account numbers. - HTTP in the stdlib
std.httpandstd.webserve the API from the same binary as the extraction logic - no separate Node service to keep in sync.
In practice
import extract grant [net]
routes = [
{ method: "POST", path: "/v1/extract", handler: handle_upload },
]
Try it on your workload.