Well, the safest way to share files between two computers is to copy the files to a disk then take the disk to the other computer and copy them from the disk to the 2nd computer.

Next to that, using a router, (to my knowledge) is the next safest route, since you can use the settings on the router to only allow access to the files from one specific address.

When you connect via a router, each computer on the network is given a different address. This can be overridden and a specific address for a computer can be used. This is called a static address. If you set static addresses on both computers, then you can configure the router to only allow access to files if the address matches.

That's the simple version. A more detailed and complicated version of how to do it would depend on the type (wired or wireless), make & model of the router.