Skip to content
Merged
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
15 changes: 14 additions & 1 deletion backend/src/api/acceleration/acceleration.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,20 @@ class AccelerationRoutes {
}

private async $getAcceleratorAccelerationsStats(req: Request, res: Response): Promise<void> {
const url = `${config.MEMPOOL_SERVICES.API}/${req.originalUrl.replace('/api/v1/services/', '')}`;
const allowedPaths = {
'accelerations': 'accelerations',
'accelerations/history': 'accelerations/history',
'accelerations/stats': 'accelerations/stats',
'estimate': 'estimate',
};
const userPath = req.originalUrl.replace('/api/v1/services/', '');
const safePath = allowedPaths[userPath];
if (!safePath) {
logger.err(`Invalid path requested: ${userPath}`, this.tag);
res.status(400).send({ error: 'Invalid path' });
return;
}
const url = `${config.MEMPOOL_SERVICES.API}/${safePath}`;
try {
const response = await axios.get(url, { responseType: 'stream', timeout: 10000 });
for (const key in response.headers) {
Expand Down