Returns a securer::securer_tool() that reads files from specified
directories with format detection and size limits.
Details
Supported formats: csv, json, txt, xlsx, parquet, rds. Format is detected
automatically from the file extension, or can be specified explicitly via
the format argument.
Security measures:
Path validation: All paths are resolved via
base::normalizePath()and checked againstallowed_dirs. Symlinks are resolved before the directory check, preventing symlink-based escapes.RDS sandboxing: RDS files are deserialized in a separate subprocess via callr, isolating the main process from malicious objects that execute code on load.
Size limits: Files exceeding
max_file_sizeare rejected before reading.Row limits: Tabular formats (csv, xlsx) are capped at
max_rowsrows.
See also
Other tool factories:
calculator_tool(),
data_profile_tool(),
fetch_url_tool(),
plot_tool(),
query_sql_tool(),
r_help_tool(),
write_file_tool()
Examples
# \donttest{
tool <- read_file_tool(
allowed_dirs = c("/data/reports", "/data/exports"),
max_file_size = "10MB",
max_rows = 5000
)
# }