Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/providers/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,14 @@
let fileBuffer: Buffer;
try {
assertPublicHttpUrl(torrentUrl);
const resp = await axios.get(torrentUrl, {
const safeUrl = new URL(torrentUrl).toString();
const resp = await axios.get(safeUrl, {
responseType: 'arraybuffer',
timeout: 30000,
maxRedirects: 0,
httpAgent: new http.Agent({ family: 4 }),
httpsAgent: new https.Agent({ family: 4 }),
});

Check failure

Code scanning / CodeQL

Server-side request forgery Critical

The
URL
of this request depends on a
user-provided value
.
The
URL
of this request depends on a
user-provided value
.
fileBuffer = Buffer.from(resp.data);
console.log(`[${new Date().toISOString()}][registry] Downloaded .torrent file (${fileBuffer.length} bytes)`);
} catch (err: any) {
Expand Down
Loading