Persistence
highContextual risklow confidenceThe filename taken from the remote response's Content-Disposition header is joined into the output path without stripping path separators, so a malicious or compromised API endpoint (including one set via CONVERTICA_API_BASE) could write files outside the intended output directory.
if (plain) return plain[1].trim();
Counter-argument considered
The filename comes from the server's Content-Disposition header. It is never stripped of path separators before path.join and writeFileSync. A name like ../../x would write outside the output directory, which contradicts the declared behavior of saving next to the input or into output_dir. This is a real but low-severity path traversal bug.