Skip to content

Commit 174b64f

Browse files
carderneTrigger.dev RepoOps
authored andcommitted
fix(webapp): scope API key permissions to the organization
Use the target project's role when checking access to environment API keys. Mono-RevId: 05828afe9b804a3060fb5b15b4a62460ee98acf3
1 parent f1987fe commit 174b64f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.apikeys

‎apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.apikeys/route.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ import {
7474
validateCreateApiKeyPreset,
7575
type ApiKeyPreset,
7676
} from "~/services/apiKeyPresetValidation.server";
77+
import { resolveProjectAuthScope } from "~/services/projectAuthScope.server";
7778
import { rbac } from "~/services/rbac.server";
7879
import { dashboardAction, dashboardLoader } from "~/services/routeBuilders/dashboardBuilder";
7980
import { cn } from "~/utils/cn";
@@ -133,6 +134,7 @@ export const loader = dashboardLoader(
133134
{
134135
params: EnvironmentParamSchema,
135136
searchParams: ApiKeySearchParams,
137+
context: (params) => resolveProjectAuthScope(params.organizationSlug, params.projectParam),
136138
},
137139
async ({ params, searchParams, user, ability }) => {
138140
try {
@@ -184,6 +186,7 @@ export const loader = dashboardLoader(
184186
export const action = dashboardAction(
185187
{
186188
params: EnvironmentParamSchema,
189+
context: (params) => resolveProjectAuthScope(params.organizationSlug, params.projectParam),
187190
// The environment tier is only known after resolving the route params,
188191
// so write:apiKeys is enforced in the handler before any mutation.
189192
},

0 commit comments

Comments
 (0)