Skip to content

Commit

Permalink
fix(kits): fix vulnerabilities in kit update
Browse files Browse the repository at this point in the history
  • Loading branch information
rockingrohit9639 committed Jan 20, 2025
1 parent 2db4500 commit ef2b27c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/modules/kit/service.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,11 @@ export async function updateKit({
imageExpiration,
status,
createdById,
organizationId,
}: UpdateKitPayload) {
try {
return await db.kit.update({
where: { id },
where: { id, organizationId },
data: {
name,
description,
Expand All @@ -147,10 +148,12 @@ export async function updateKitImage({
request,
kitId,
userId,
organizationId,
}: {
request: Request;
kitId: string;
userId: string;
organizationId: Kit["organizationId"];
}) {
try {
const fileData = await parseFileFormData({
Expand All @@ -176,6 +179,7 @@ export async function updateKitImage({
image: signedUrl,
imageExpiration: oneDayFromNow(),
createdById: userId,
organizationId,
});
} catch (cause) {
throw new ShelfError({
Expand Down
1 change: 1 addition & 0 deletions app/modules/kit/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type UpdateKitPayload = Partial<
| "image"
| "imageExpiration"
| "createdById"
| "organizationId"
>
> & {
id: Kit["id"];
Expand Down
2 changes: 2 additions & 0 deletions app/routes/_layout+/kits.$kitId_.edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,13 @@ export async function action({ context, request, params }: ActionFunctionArgs) {
createdById: userId,
name: payload.name,
description: payload.description,
organizationId,
}),
updateKitImage({
request,
kitId,
userId,
organizationId,
}),
]);

Expand Down
1 change: 1 addition & 0 deletions app/routes/_layout+/kits.new.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export async function action({ context, request }: LoaderFunctionArgs) {
request,
kitId: kit.id,
userId,
organizationId,
});

sendNotification({
Expand Down

0 comments on commit ef2b27c

Please sign in to comment.