Language: TypeScript
Label: vulnerable
CWE: CWE-918 \u2014 Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.

Code:
        _id: new ObjectId(input.id),
        workspaceId: ctx.auth.workspaceId
      });

      if (!contentPiece) throw errors.notFound("contentPiece");

      await contentPiecesCollection.deleteOne({ _id: contentPiece._id });
      await contentsCollection.deleteOne({ contentPieceId: contentPiece._id });
      await contentPieceVariantsCollection.deleteMany({
        contentPieceId: contentPiece._id,
        workspaceId: ctx.auth.workspaceId
      });
      await contentVariantsCollection.deleteMany({
        contentPieceId: contentPiece._id
      });
      runGitSyncHook(ctx, "contentPieceRemoved", { contentPiece });
      runWebhooks(ctx, "contentPieceRemoved", webhookPayload(contentPiece));
      publishEvent(ctx, `${contentPiece.contentGroupId}`, {
        action: "delete",
        userId: `${ctx.auth.userId}`,
        data: { id: input.id }
      });
      ctx.fastify.search.deleteContent({
        contentPieceId: contentPiece._id,
        workspaceId: ctx.auth.workspaceId
      });

      return { id: input.id };
    }),