Skip to content

Commit

Permalink
Merge pull request #3625 from activepieces/fix/app-credentials-authz
Browse files Browse the repository at this point in the history
fix(authz): remove project check for list app-credentials endpoint
  • Loading branch information
khaledmashaly committed Jan 14, 2024
2 parents 44e8843 + e0d07ec commit a5f4e7c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-cloud-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:
Release:
env:
MY_VERSION: sign2
MY_VERSION: sign3
runs-on: ubuntu-latest
steps:
- name: Check out repository code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export class ProjectAuthzHandler extends BaseSecurityHandler {
'/v1/users/projects/:projectId/token',
'/v1/admin/platforms',
'/v1/admin/pieces',
'/v1/app-credentials',
]

protected canHandle(request: FastifyRequest): Promise<boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ const appCredentialController: FastifyPluginAsyncTypebox = async (fastify) => {
}>,
reply,
) => {
await appCredentialService.delete(request.params.credentialId)
await appCredentialService.delete({
id: request.params.credentialId,
projectId: request.principal.projectId,
})

return reply.status(StatusCodes.OK).send()
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,15 @@ export const appCredentialService = {
}, ['projectId', 'appName'])
return appCredentialRepo.findOneBy({ projectId, appName: request.appName })
},
async delete(id: AppCredentialId): Promise<void> {
async delete({ id, projectId }: DeleteParams): Promise<void> {
await appCredentialRepo.delete({
id,
projectId,
})
},
}

type DeleteParams = {
id: AppCredentialId
projectId: ProjectId
}

0 comments on commit a5f4e7c

Please sign in to comment.