fix(proxy): add path validation guardrail to imageproxy (#2531)

This commit is contained in:
Rin
2026-02-28 02:14:05 +07:00
committed by GitHub
parent 720a75b58d
commit e086081b19

View File

@@ -32,6 +32,12 @@ function initTvdbImageProxy() {
router.get('/:type/*', async (req, res) => { router.get('/:type/*', async (req, res) => {
const imagePath = req.path.replace(/^\/\w+/, ''); const imagePath = req.path.replace(/^\/\w+/, '');
if (imagePath.startsWith('//') || imagePath.includes('://')) {
logger.error('Invalid URL for image proxy', { imagePath });
return res.status(403).send('Invalid URL for image proxy');
}
try { try {
let imageData; let imageData;
if (req.params.type === 'tmdb') { if (req.params.type === 'tmdb') {