Forum Discussion
How to disable file sharing with external/guest users in Teams
if you are chatting with an external user (federation) you can't share files
A guest that is invited to a team can share files in the team because it gets access to the SharePoint library. You can technically change the permissions to the library and/or folders for the team or channels in the team, but that is not recommended
In private meetings by default internal users can share files with all participants - in theory - in fact a new message where users can change the file permissions to "People currently in this chat". From my testing however this is not the case. Access is granted only to users that are existing guests. External users that have been invited with their email address will not be able to access the file.
Given access that shared files in a team meeting are stored in OneDrive, the explanation I have for this is based on OneDrive settings being "new and existing guests" meaning the meeting participants need to be existing guests (a new guest is only created with a Teams invitation, not by just sharing a file in OneDrive)