mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 18:41:14 +00:00
fix(core): Ensure ID is a positive integer when fetching execution (#9629)
This commit is contained in:
@@ -8,6 +8,8 @@ import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { parseRangeQuery } from './parse-range-query.middleware';
|
||||
import type { User } from '@/databases/entities/User';
|
||||
import type { Scope } from '@n8n/permissions';
|
||||
import { isPositiveInteger } from '@/utils';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
|
||||
@RestController('/executions')
|
||||
export class ExecutionsController {
|
||||
@@ -59,6 +61,10 @@ export class ExecutionsController {
|
||||
|
||||
@Get('/:id')
|
||||
async getOne(req: ExecutionRequest.GetOne) {
|
||||
if (!isPositiveInteger(req.params.id)) {
|
||||
throw new BadRequestError('Execution ID is not a number');
|
||||
}
|
||||
|
||||
const workflowIds = await this.getAccessibleWorkflowIds(req.user, 'workflow:read');
|
||||
|
||||
if (workflowIds.length === 0) throw new NotFoundError('Execution not found');
|
||||
|
||||
Reference in New Issue
Block a user