I would go one further and say that the default should be that programs cannot read, open, or see files at all unless they're either explicitly allow-listed to open those files, or the user has given permission for them to open those files (i.e. by using the file name as a command-line argument, or selecting the file in an os-provided file selection dialog box).
I like this about Deno (not to suggest that the runtime is without its flaws). Whenever I try to run a script and it tells me I need to allow e.g. read access to the filesystem, I’m more grateful than annoyed. And it lets you choose the granularity of the permissions that you grant. Hopefully this approach will become more common.