fix: correct README inconsistencies and add TORRENTCLAW_ALLOW_PRIVATE
- Rename get_torrent_download_url → get_torrent_url in README tools table - Add TORRENTCLAW_ALLOW_PRIVATE env var to bypass SSRF checks for self-hosted setups (localhost, private IPs) - Update self-hosted config example with TORRENTCLAW_ALLOW_PRIVATE=true - Add Prompts section to README - Add 3 tests for ALLOW_PRIVATE behavior (88 tests total)
This commit is contained in:
parent
d471c9b695
commit
e011c0f63e
3 changed files with 52 additions and 8 deletions
|
|
@ -24,11 +24,14 @@ export function validateApiUrl(raw: string): string {
|
|||
);
|
||||
}
|
||||
|
||||
const hostname = parsed.hostname.replace(/^\[|\]$/g, "");
|
||||
if (PRIVATE_IP_PATTERNS.some((re) => re.test(hostname))) {
|
||||
throw new Error(
|
||||
`Invalid TORRENTCLAW_API_URL: private/reserved addresses not allowed`,
|
||||
);
|
||||
const allowPrivate = process.env.TORRENTCLAW_ALLOW_PRIVATE === "true";
|
||||
if (!allowPrivate) {
|
||||
const hostname = parsed.hostname.replace(/^\[|\]$/g, "");
|
||||
if (PRIVATE_IP_PATTERNS.some((re) => re.test(hostname))) {
|
||||
throw new Error(
|
||||
`Invalid TORRENTCLAW_API_URL: private/reserved addresses not allowed. Set TORRENTCLAW_ALLOW_PRIVATE=true for self-hosted setups.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return raw;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue