Add guard to prevent recursive proxying even when origin=1

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
This commit is contained in:
ゆめ 2024-10-17 23:53:26 -05:00
parent fb690169f3
commit 086532218e
No known key found for this signature in database

View file

@ -319,6 +319,12 @@ export class FileServerService {
);
}
if (!request.headers['user-agent']) {
throw new StatusError('User-Agent is required', 400, 'User-Agent is required');
} else if (request.headers['user-agent'].includes(this.config.userAgent)) {
throw new StatusError('Proxy is recursive', 400, 'Proxy is recursive');
}
// Create temp file
const file = await this.getStreamAndTypeFromUrl(url);
if (file === '404') {