Sharing a folder and files creates an exception of ports in Windows Firewall for File and Printer Sharing. These ports are needed for communication and sharing files.
The exception opens the ports listed in the following table:
The default configuration is to allow other computer inside the network to access from any location, including computers on the Internet. Unless you block incoming connections on these ports using the table above as reference.
Hope this helps!