fix(proxy): add path validation guardrail to imageproxy (#2531)
This commit is contained in:
@@ -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') {
|
||||||
|
|||||||
Reference in New Issue
Block a user