Skip to content

Commit d68558c

Browse files
committed
fix(security): collapse 403 to 404 on v1 detail-by-ID routes
1 parent 0b1feb5 commit d68558c

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

apps/sim/app/api/v1/logs/[id]/route.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ export const GET = withRouteHandler(
7373
}
7474

7575
const accessError = await validateWorkspaceAccess(rateLimit, userId, log.workspaceId)
76-
if (accessError) return accessError
76+
if (accessError) {
77+
return NextResponse.json({ error: 'Log not found' }, { status: 404 })
78+
}
7779

7880
const workflowSummary = {
7981
id: log.workflowId,

apps/sim/app/api/v1/logs/executions/[executionId]/route.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ export const GET = withRouteHandler(
4747
const workflowLog = rows[0]
4848

4949
const accessError = await validateWorkspaceAccess(rateLimit, userId, workflowLog.workspaceId)
50-
if (accessError) return accessError
50+
if (accessError) {
51+
return NextResponse.json({ error: 'Workflow execution not found' }, { status: 404 })
52+
}
5153

5254
const [snapshot] = await db
5355
.select()

apps/sim/app/api/v1/workflows/[id]/route.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ export const GET = withRouteHandler(
5151
userId,
5252
workflowData.workspaceId!
5353
)
54-
if (accessError) return accessError
54+
if (accessError) {
55+
return NextResponse.json({ error: 'Workflow not found' }, { status: 404 })
56+
}
5557

5658
const blockRows = await db
5759
.select({

0 commit comments

Comments
 (0)