Skip to content

Commit 148e4b8

Browse files
Revert "fix(execute): block cross-origin session-authenticated workflow runs (#5062)"
This reverts commit 67e02fa.
1 parent 324299e commit 148e4b8

4 files changed

Lines changed: 0 additions & 121 deletions

File tree

apps/sim/app/api/workflows/[id]/execute/route.async.test.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -194,26 +194,6 @@ describe('workflow execute async route', () => {
194194
)
195195
})
196196

197-
it('rejects cross-origin session requests before authorization work', async () => {
198-
const req = createMockRequest(
199-
'POST',
200-
{ input: { hello: 'world' } },
201-
{
202-
'Content-Type': 'application/json',
203-
'Sec-Fetch-Site': 'cross-site',
204-
}
205-
)
206-
const params = Promise.resolve({ id: 'workflow-1' })
207-
208-
const response = await POST(req, { params })
209-
const body = await response.json()
210-
211-
expect(response.status).toBe(403)
212-
expect(body.error).toBe('Access denied')
213-
expect(mockAuthorizeWorkflowByWorkspacePermission).not.toHaveBeenCalled()
214-
expect(mockEnqueue).not.toHaveBeenCalled()
215-
})
216-
217197
it('rejects oversized request bodies before authorization work', async () => {
218198
const req = createMockRequest(
219199
'POST',

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
getTimeoutErrorMessage,
2121
isTimeoutError,
2222
} from '@/lib/core/execution-limits'
23-
import { isCrossOriginSessionRequest } from '@/lib/core/security/same-origin'
2423
import { generateRequestId } from '@/lib/core/utils/request'
2524
import { SSE_HEADERS } from '@/lib/core/utils/sse'
2625
import {
@@ -394,17 +393,6 @@ async function handleExecutePost(
394393

395394
try {
396395
const auth = await checkHybridAuth(req, { requireWorkflowId: false })
397-
398-
// CSRF guard: reject session-cookie execution that is provably cross-origin
399-
// (a different site driving the user's browser). Scoped to session auth —
400-
// API-key / public-API / internal-JWT callers don't use cookies. This is not
401-
// a defense against a non-browser client forging headers; that surface is
402-
// covered by the credit and execution rate-limit gates.
403-
if (auth.success && auth.authType === AuthType.SESSION && isCrossOriginSessionRequest(req)) {
404-
reqLogger.warn('Rejected cross-origin session-authenticated execute request')
405-
return NextResponse.json({ error: 'Access denied' }, { status: 403 })
406-
}
407-
408396
const isMcpBridgeRequest =
409397
auth.authType === AuthType.INTERNAL_JWT && req.headers.get(MCP_TOOL_BRIDGE_HEADER) === 'true'
410398
const useMcpBridgeAuthenticatedUserAsActor =

apps/sim/lib/core/security/same-origin.test.ts

Lines changed: 0 additions & 53 deletions
This file was deleted.

apps/sim/lib/core/security/same-origin.ts

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)