Skip to content

Commit 7a18723

Browse files
waleedlatif1claude
andcommitted
revert(security): remove workspace-env admin gate
Defer to a credential-based access model (separate change). Restores GET /api/workspaces/[id]/environment to main behavior and removes the test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 3f61c4a commit 7a18723

2 files changed

Lines changed: 6 additions & 124 deletions

File tree

apps/sim/app/api/workspaces/[id]/environment/route.test.ts

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

apps/sim/app/api/workspaces/[id]/environment/route.ts

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ import {
2323
getPersonalAndWorkspaceEnv,
2424
invalidateEffectiveDecryptedEnvCache,
2525
} from '@/lib/environment/utils'
26-
import {
27-
getUserEntityPermissions,
28-
getWorkspaceById,
29-
hasWorkspaceAdminAccess,
30-
} from '@/lib/workspaces/permissions/utils'
26+
import { getUserEntityPermissions, getWorkspaceById } from '@/lib/workspaces/permissions/utils'
3127

3228
const logger = createLogger('WorkspaceEnvironmentAPI')
3329

@@ -57,21 +53,15 @@ export const GET = withRouteHandler(
5753
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
5854
}
5955

60-
const [isAdmin, { workspaceEncrypted, workspaceDecrypted, personalDecrypted, conflicts }] =
61-
await Promise.all([
62-
hasWorkspaceAdminAccess(userId, workspaceId),
63-
getPersonalAndWorkspaceEnv(userId, workspaceId),
64-
])
65-
66-
// Only workspace admins may read plaintext secrets; others get variable names with empty values.
67-
const workspace = isAdmin
68-
? workspaceDecrypted
69-
: Object.fromEntries(Object.keys(workspaceEncrypted).map((key) => [key, '']))
56+
const { workspaceDecrypted, personalDecrypted, conflicts } = await getPersonalAndWorkspaceEnv(
57+
userId,
58+
workspaceId
59+
)
7060

7161
return NextResponse.json(
7262
{
7363
data: {
74-
workspace,
64+
workspace: workspaceDecrypted,
7565
personal: personalDecrypted,
7666
conflicts,
7767
},

0 commit comments

Comments
 (0)