Salesforce Fact #549 | Default visibility for files
There are different visibility options: InternalUsers, AllUsers related to records. When there are no communities defined in the org, a File shared with a record will have a default visibility set to AllUsers. When there is at least one community defined in the org, a File shared with a record will have its visibility set to InternalUsers, by default. In order to change the visibility, we need to write a trigger on ContentDocumentLink object. Reference: https://help.salesforce.com/s/articleView?id=000384243&type=1