Skip to content

Commit bb55c9d

Browse files
committed
fix(webapp): scope archive API key auth to the key's own project
1 parent b84c228 commit bb55c9d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

apps/webapp/app/routes/api.v1.projects.$projectRef.branches.archive.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ export async function action({ request, params }: ActionFunctionArgs) {
7878
);
7979
}
8080

81+
// API keys can only act on their own project
82+
if (
83+
authenticationResult.type === "apiKey" &&
84+
apiKeyEnvironment?.project.externalRef !== projectRef
85+
) {
86+
return json({ error: "Project not found" }, { status: 404 });
87+
}
88+
8189
const environmentType = toBranchableEnvironmentType(env);
8290

8391
const organizationFilter =

0 commit comments

Comments
 (0)