Skip to content

Commit 89812d4

Browse files
authored
Merge pull request #117 from AgentWorkforce/workspace-deploy
fix(deploy): workspace deploys
2 parents 2c01845 + 93e5059 commit 89812d4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/cloud/server.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ export async function createServer(): Promise<CloudServer> {
222222
const isWorkspaceProxyRoute = (path: string) => /^\/api\/workspaces\/[^/]+\/proxy\//.test(path);
223223
app.use((req: Request, res: Response, next: NextFunction) => {
224224
// Skip CSRF for webhook endpoints and workspace proxy routes
225-
if (CSRF_EXEMPT_PATHS.some(path => req.path.startsWith(path)) || isWorkspaceProxyRoute(req.path)) {
225+
const isExemptPath = CSRF_EXEMPT_PATHS.some(exemptPath => req.path.startsWith(exemptPath));
226+
if (isExemptPath || isWorkspaceProxyRoute(req.path)) {
226227
return next();
227228
}
228229

@@ -252,6 +253,12 @@ export async function createServer(): Promise<CloudServer> {
252253
return next();
253254
}
254255

256+
// Skip CSRF for admin API key authenticated requests
257+
const adminSecret = req.get('x-admin-secret');
258+
if (adminSecret) {
259+
return next();
260+
}
261+
255262
// Skip CSRF for test endpoints in non-production
256263
if (process.env.NODE_ENV !== 'production' && req.path.startsWith('/api/test/')) {
257264
return next();

0 commit comments

Comments
 (0)